Go to the documentation of this file.
37 #define DEBUG_TYPE "ve-asmprinter"
46 explicit VEAsmPrinter(
TargetMachine &
TM, std::unique_ptr<MCStreamer> Streamer)
49 StringRef getPassName()
const override {
return "VE Assembly Printer"; }
176 emitANDrm(OutStreamer, RD, M032, RD, STI);
180 void VEAsmPrinter::lowerGETGOTAndEmitMCInsts(
const MachineInstr *
MI,
183 OutContext.getOrCreateSymbol(
Twine(
"_GLOBAL_OFFSET_TABLE_"));
188 if (!isPositionIndependent()) {
190 switch (
TM.getCodeModel()) {
213 emitLEAzii(*OutStreamer, cim24, loImm, MCRegOP, STI);
215 emitANDrm(*OutStreamer, MCRegOP, M032, MCRegOP, STI);
216 emitSIC(*OutStreamer, RegPLT, STI);
219 emitLEASLrri(*OutStreamer, RegGOT, RegPLT, hiImm, MCRegOP, STI);
222 void VEAsmPrinter::lowerGETFunPLTAndEmitMCInsts(
const MachineInstr *
MI,
229 switch (
Addr.getType()) {
240 AddrSym = GetExternalSymbolSymbol(
Addr.getSymbolName());
243 AddrSym = getSymbol(
Addr.getGlobal());
247 if (!isPositionIndependent()) {
261 emitLEAzii(*OutStreamer, cim24, loImm, MCRegOP, STI);
263 emitANDrm(*OutStreamer, MCRegOP, M032, MCRegOP, STI);
264 emitSIC(*OutStreamer, RegPLT, STI);
267 emitLEASLrri(*OutStreamer, MCRegOP, RegPLT, hiImm, MCRegOP, STI);
270 void VEAsmPrinter::lowerGETTLSAddrAndEmitMCInsts(
const MachineInstr *
MI,
275 switch (
Addr.getType()) {
286 AddrSym = GetExternalSymbolSymbol(
Addr.getSymbolName());
289 AddrSym = getSymbol(
Addr.getGlobal());
296 MCSymbol *GetTLSLabel = OutContext.getOrCreateSymbol(
Twine(
"__tls_get_addr"));
309 emitLEAzii(*OutStreamer, cim24, loImm, RegS0, STI);
311 emitANDrm(*OutStreamer, RegS0, M032, RegS0, STI);
319 emitLEAzii(*OutStreamer, ci8, loImm2, RegS12, STI);
320 emitANDrm(*OutStreamer, RegS12, M032, RegS12, STI);
328 VE_MC::verifyInstructionPredicates(
MI->getOpcode(),
329 getSubtargetInfo().getFeatureBits());
331 switch (
MI->getOpcode()) {
334 case TargetOpcode::DBG_VALUE:
338 lowerGETGOTAndEmitMCInsts(
MI, getSubtargetInfo());
341 lowerGETFunPLTAndEmitMCInsts(
MI, getSubtargetInfo());
344 lowerGETTLSAddrAndEmitMCInsts(
MI, getSubtargetInfo());
353 EmitToStreamer(*OutStreamer, TmpInst);
354 }
while ((++
I !=
E) &&
I->isInsideBundle());
371 bool VEAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
373 if (ExtraCode && ExtraCode[0]) {
374 if (ExtraCode[1] != 0)
377 switch (ExtraCode[0]) {
static MCOperand createGOTRelExprOp(VEMCExpr::VariantKind Kind, MCSymbol *GOTLabel, MCContext &OutContext)
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createImm(int64_t Val)
Context object for machine code objects.
static void emitLEASLrri(MCStreamer &OutStreamer, MCOperand &RS1, MCOperand &RS2, MCOperand &Imm, MCOperand &RD, const MCSubtargetInfo &STI)
static void emitBSIC(MCStreamer &OutStreamer, MCOperand &R1, MCOperand &R2, const MCSubtargetInfo &STI)
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
static void emitLEASLzzi(MCStreamer &OutStreamer, MCOperand &Imm, MCOperand &RD, const MCSubtargetInfo &STI)
static const char * getRegisterName(unsigned RegNo, unsigned AltIdx=VE::NoRegAltName)
Instances of this class represent a single low-level machine instruction.
@ MO_Register
Register operand.
void setOpcode(unsigned Op)
Streaming machine code generation interface.
Target & getTheVETarget()
@ MO_GlobalAddress
Address of a global value.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static void emitANDrm(MCStreamer &OutStreamer, MCOperand &RS1, MCOperand &Imm, MCOperand &RD, const MCSubtargetInfo &STI)
MachineOperand class - Representation of each machine instruction operand.
unsigned M0(unsigned Val)
static const VEMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class implements an extremely fast bulk output stream that can only output to a stream.
static MCOperand createVEMCOperand(VEMCExpr::VariantKind Kind, MCSymbol *Sym, MCContext &OutContext)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
void addOperand(const MCOperand Op)
Representation of each machine instruction.
#define LLVM_EXTERNAL_VISIBILITY
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
std::string lower() const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Primary interface to the complete machine description for the target machine.
static void emitSIC(MCStreamer &OutStreamer, MCOperand &RD, const MCSubtargetInfo &STI)
Register getReg() const
getReg - Returns the register number.
Represent a reference to a symbol from inside an expression.
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVEAsmPrinter()
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static MCOperand createReg(unsigned Reg)
@ MO_MachineBasicBlock
MachineBasicBlock reference.
static void emitBinary(MCStreamer &OutStreamer, unsigned Opcode, MCOperand &RS1, MCOperand &Src2, MCOperand &RD, const MCSubtargetInfo &STI)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Iterator for intrusive lists based on ilist_node.
@ MO_ExternalSymbol
Name of external global symbol.
This class is intended to be used as a driving class for all asm writers.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
static void emitLEAzzi(MCStreamer &OutStreamer, MCOperand &Imm, MCOperand &RD, const MCSubtargetInfo &STI)
const char LLVMTargetMachineRef TM
Instances of this class represent operands of the MCInst class.
void LowerVEMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP)
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...
static void emitLEAzii(MCStreamer &OutStreamer, MCOperand &RS1, MCOperand &Imm, MCOperand &RD, const MCSubtargetInfo &STI)
Generic base class for all target subtargets.
static void emitHiLo(MCStreamer &OutStreamer, MCSymbol *GOTSym, VEMCExpr::VariantKind HiKind, VEMCExpr::VariantKind LoKind, MCOperand &RD, MCContext &OutContext, const MCSubtargetInfo &STI)
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
static std::string getRegisterName(const TargetRegisterInfo *TRI, Register Reg)