53 #define DEBUG_TYPE "asm-printer" 56 std::unique_ptr<MCStreamer> Streamer)
57 :
AsmPrinter(TM,
std::move(Streamer)), AFI(nullptr), MCP(nullptr),
58 InConstantPool(
false), OptimizationGoals(-1) {}
65 InConstantPool =
false;
81 assert(Size &&
"C++ constructor pointer had zero size!");
84 assert(GV &&
"C++ constructor pointer was not a GlobalValue!");
97 if (PromotedGlobals.count(GV))
119 PromotedGlobals.insert(GV);
122 unsigned OptimizationGoal;
125 OptimizationGoal = 6;
128 OptimizationGoal = 4;
131 OptimizationGoal = 3;
134 OptimizationGoal = 2;
137 OptimizationGoal = 1;
140 OptimizationGoal = 5;
143 if (OptimizationGoals == -1)
144 OptimizationGoals = OptimizationGoal;
145 else if (OptimizationGoals != (
int)OptimizationGoal)
146 OptimizationGoals = 0;
169 if (! ThumbIndirectPads.empty()) {
172 for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
180 ThumbIndirectPads.clear();
209 if(ARM::GPRPairRegClass.
contains(Reg)) {
254 GetARMJTIPICJumpTableLabel(
unsigned uid)
const {
265 if (ExtraCode && ExtraCode[0]) {
266 if (ExtraCode[1] != 0)
return true;
268 switch (ExtraCode[0]) {
283 if (!ARM::DPRRegClass.
contains(*SR))
310 if (ARM::GPRPairRegClass.
contains(RegBegin)) {
314 RegBegin = TRI->
getSubReg(RegBegin, ARM::gsub_1);
322 unsigned RegOps = OpNum + 1;
338 if (!FlagsOP.
isImm())
340 unsigned Flags = FlagsOP.
getImm();
367 if (ExtraCode[0] ==
'Q')
374 ARM::GPRPairRegClass.hasSubClassEq(TRI->
getRegClass(RC))) {
388 unsigned RegOp = FirstHalf ? OpNum : OpNum + 1;
404 if (!ARM::QPRRegClass.
contains(Reg))
408 TRI->
getSubReg(Reg, ExtraCode[0] ==
'e' ? ARM::dsub_0 : ARM::dsub_1);
423 if(!ARM::GPRPairRegClass.
contains(Reg))
437 unsigned OpNum,
const char *ExtraCode,
440 if (ExtraCode && ExtraCode[0]) {
441 if (ExtraCode[1] != 0)
return true;
443 switch (ExtraCode[0]) {
445 default:
return true;
455 assert(MO.
isReg() &&
"unexpected inline asm memory operand");
468 const bool WasThumb =
isThumb(StartInfo);
469 if (!EndInfo || WasThumb !=
isThumb(*EndInfo)) {
526 if (!Stubs.empty()) {
531 for (
auto &Stub : Stubs)
539 if (!Stubs.empty()) {
544 for (
auto &Stub : Stubs)
563 if (OptimizationGoals > 0 &&
567 OptimizationGoals = -1;
588 void ARMAsmPrinter::emitAttributes() {
607 ArchFS = (
Twine(ArchFS) +
"," + FS).str();
622 }
else if (STI.isRWPI()) {
660 if (!STI.hasVFP2Base()) {
670 }
else if (STI.hasVFP3Base()) {
687 "no-trapping-math",
"true") ||
729 if (
auto WCharWidthValue = mdconst::extract_or_null<ConstantInt>(
730 SourceModule->getModuleFlag(
"wchar_size"))) {
731 int WCharWidth = WCharWidthValue->getZExtValue();
732 assert((WCharWidth == 2 || WCharWidth == 4) &&
733 "wchar_t width must be 2 or 4 bytes");
740 if (
auto EnumWidthValue = mdconst::extract_or_null<ConstantInt>(
741 SourceModule->getModuleFlag(
"min_enum_size"))) {
742 int EnumWidth = EnumWidthValue->getZExtValue();
743 assert((EnumWidth == 1 || EnumWidth == 4) &&
744 "Minimum enum width must be 1 or 4 bytes");
745 int EnumBuildAttr = EnumWidth == 1 ? 1 : 2;
755 else if (STI.isR9Reserved())
769 +
"BF" +
Twine(FunctionNumber) +
"_" +
Twine(LabelId));
777 +
"PC" +
Twine(FunctionNumber) +
"_" +
Twine(LabelId));
803 unsigned char TargetFlags) {
819 if (!StubSym.getPointer())
825 "Windows is the only supported COFF target");
841 if (TargetFlags & ARMII::MO_COFFSTUB) {
847 if (!StubSym.getPointer())
875 auto *ACPC = cast<ARMConstantPoolConstant>(ACPV);
876 for (
const auto *GV : ACPC->promotedGlobals()) {
877 if (!EmittedPromotedGlobalLabels.count(GV)) {
880 EmittedPromotedGlobalLabels.insert(GV);
891 cast<ARMConstantPoolConstant>(ACPV)->getBlockAddress();
894 const GlobalValue *GV = cast<ARMConstantPoolConstant>(ACPV)->getGV();
899 MCSym = GetARMGVSymbol(GV, TF);
905 auto Sym = cast<ARMConstantPoolSymbol>(ACPV)->
getSymbol();
946 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
955 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
992 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
998 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1005 .addExpr(MBBSymbolExpr)
1012 unsigned OffsetWidth) {
1013 assert((OffsetWidth == 1 || OffsetWidth == 2) &&
"invalid tbb/tbh width");
1020 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1026 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1032 for (
auto MBB : JTBBs) {
1064 void ARMAsmPrinter::EmitUnwindingInstruction(
const MachineInstr *
MI) {
1066 "Only instruction which are involved into frame setup code are allowed");
1077 unsigned SrcReg, DstReg;
1079 if (Opc == ARM::tPUSH || Opc == ARM::tLDRpci) {
1085 SrcReg = DstReg = ARM::SP;
1094 assert(DstReg == ARM::SP &&
1095 "Only stack pointer as a destination reg is supported");
1099 unsigned StartOp = 2 + 2;
1101 unsigned NumOffset = 0;
1111 StartOp = 2; NumOffset = 2;
1113 case ARM::STMDB_UPD:
1114 case ARM::t2STMDB_UPD:
1115 case ARM::VSTMDDB_UPD:
1116 assert(SrcReg == ARM::SP &&
1117 "Only stack pointer as a source reg is supported");
1118 for (
unsigned i = StartOp, NumOps = MI->
getNumOperands() - NumOffset;
1131 "Pad registers must come before restored ones");
1145 case ARM::STR_PRE_IMM:
1146 case ARM::STR_PRE_REG:
1147 case ARM::t2STR_PRE:
1149 "Only stack pointer as a source reg is supported");
1154 ATS.
emitRegSave(RegList, Opc == ARM::VSTMDDB_UPD);
1161 if (SrcReg == ARM::SP) {
1186 case ARM::tLDRpci: {
1193 assert(CPI != -1U &&
"Invalid constpool index");
1199 Offset = -cast<ConstantInt>(CPE.
Val.
ConstVal)->getSExtValue();
1205 if (DstReg == FramePtr && FramePtr != ARM::SP)
1208 ATS.
emitSetFP(FramePtr, ARM::SP, -Offset);
1209 else if (DstReg == ARM::SP) {
1219 }
else if (DstReg == ARM::SP) {
1222 }
else if (Opc == ARM::tMOVr) {
1236 #include "ARMGenMCPseudoLowering.inc" 1248 if (InConstantPool && MI->
getOpcode() != ARM::CONSTPOOL_ENTRY) {
1250 InConstantPool =
false;
1256 EmitUnwindingInstruction(MI);
1259 if (emitPseudoExpansionLowering(*
OutStreamer, MI))
1263 "Pseudo flag setting opcode should be expanded early");
1268 case ARM::t2MOVi32imm:
llvm_unreachable(
"Should be lowered by thumb2it pass");
1269 case ARM::DBG_VALUE:
llvm_unreachable(
"Should be handled by generic printing");
1271 case ARM::tLEApcrel:
1272 case ARM::t2LEApcrel: {
1276 ARM::t2LEApcrel ? ARM::t2ADR
1277 : (MI->
getOpcode() == ARM::tLEApcrel ? ARM::tADR
1286 case ARM::LEApcrelJT:
1287 case ARM::tLEApcrelJT:
1288 case ARM::t2LEApcrelJT: {
1292 ARM::t2LEApcrelJT ? ARM::t2ADR
1293 : (MI->
getOpcode() == ARM::tLEApcrelJT ? ARM::tADR
1304 case ARM::BX_CALL: {
1319 case ARM::tBX_CALL: {
1331 for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
1332 if (TIP.first == TReg) {
1333 TRegSym = TIP.second;
1340 ThumbIndirectPads.push_back(std::make_pair(TReg, TRegSym));
1350 case ARM::BMOVPCRX_CALL: {
1370 case ARM::BMOVPCB_CALL: {
1383 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1392 case ARM::MOVi16_ga_pcrel:
1393 case ARM::t2MOVi16_ga_pcrel: {
1395 TmpInst.
setOpcode(Opc == ARM::MOVi16_ga_pcrel? ARM::MOVi16 : ARM::t2MOVi16);
1400 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1407 unsigned PCAdj = (Opc == ARM::MOVi16_ga_pcrel) ? 8 : 4;
1408 const MCExpr *PCRelExpr =
1423 case ARM::MOVTi16_ga_pcrel:
1424 case ARM::t2MOVTi16_ga_pcrel: {
1426 TmpInst.
setOpcode(Opc == ARM::MOVTi16_ga_pcrel
1427 ? ARM::MOVTi16 : ARM::t2MOVTi16);
1433 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1440 unsigned PCAdj = (Opc == ARM::MOVTi16_ga_pcrel) ? 8 : 4;
1441 const MCExpr *PCRelExpr =
1473 const MCExpr *BranchTarget;
1488 MCInst.addExpr(BranchTarget);
1491 if (Opc == ARM::t2BFic) {
1496 MCInst.addExpr(ElseLabel);
1506 case ARM::t2BF_LabelPseudo: {
1515 case ARM::tPICADD: {
1566 case ARM::PICLDRSH: {
1583 case ARM::PICSTR: Opcode = ARM::STRrs;
break;
1584 case ARM::PICSTRB: Opcode = ARM::STRBrs;
break;
1585 case ARM::PICSTRH: Opcode = ARM::STRH;
break;
1586 case ARM::PICLDR: Opcode = ARM::LDRrs;
break;
1587 case ARM::PICLDRB: Opcode = ARM::LDRBrs;
break;
1588 case ARM::PICLDRH: Opcode = ARM::LDRH;
break;
1589 case ARM::PICLDRSB: Opcode = ARM::LDRSB;
break;
1590 case ARM::PICLDRSH: Opcode = ARM::LDRSH;
break;
1603 case ARM::CONSTPOOL_ENTRY: {
1616 if (!InConstantPool) {
1618 InConstantPool =
true;
1630 case ARM::JUMPTABLE_ADDRS:
1633 case ARM::JUMPTABLE_INSTS:
1636 case ARM::JUMPTABLE_TBB:
1637 case ARM::JUMPTABLE_TBH:
1640 case ARM::t2BR_JT: {
1650 case ARM::t2TBH_JT: {
1651 unsigned Opc = MI->
getOpcode() == ARM::t2TBB_JT ? ARM::t2TBB : ARM::t2TBH;
1663 case ARM::tTBH_JT: {
1665 bool Is8Bit = MI->
getOpcode() == ARM::tTBB_JT;
1681 if (Base == ARM::PC) {
1704 unsigned Opc = Is8Bit ? ARM::tLDRBi : ARM::tLDRHi;
1708 .addImm(Is8Bit ? 4 : 2)
1718 unsigned Opc = Is8Bit ? ARM::tLDRBr : ARM::tLDRHr;
1751 unsigned Opc = MI->
getOpcode() == ARM::BR_JTr ?
1752 ARM::MOVr : ARM::tMOVr;
1760 if (Opc == ARM::MOVr)
1765 case ARM::BR_JTm_i12: {
1778 case ARM::BR_JTm_rs: {
1792 case ARM::BR_JTadd: {
1819 case ARM::TRAPNaCl: {
1829 uint16_t Val = 0xdefe;
1836 case ARM::t2Int_eh_sjlj_setjmp:
1837 case ARM::t2Int_eh_sjlj_setjmp_nofp:
1838 case ARM::tInt_eh_sjlj_setjmp: {
1888 .addExpr(SymbolExpr)
1905 case ARM::Int_eh_sjlj_setjmp_nofp:
1906 case ARM::Int_eh_sjlj_setjmp: {
1965 case ARM::Int_eh_sjlj_longjmp: {
2024 case ARM::tInt_eh_sjlj_longjmp: {
2093 case ARM::tInt_WIN_eh_sjlj_longjmp: {
2123 case ARM::PATCHABLE_FUNCTION_ENTER:
2126 case ARM::PATCHABLE_FUNCTION_EXIT:
2129 case ARM::PATCHABLE_TAIL_CALL:
static const char * getRegisterName(unsigned RegNo, unsigned AltIdx=ARM::NoRegAltName)
unsigned getTargetFlags() const
virtual void EmitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
MachineConstantPoolValue * MachineCPVal
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
A parsed version of the target data layout string in and methods for querying it. ...
StringRef getTargetFeatureString() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
unsigned NoTrappingFPMath
NoTrappingFPMath - This flag is enabled when the -enable-no-trapping-fp-math is specified on the comm...
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
bool isTargetGNUAEABI() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
void EmitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
const std::vector< MachineJumpTableEntry > & getJumpTables() const
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
union llvm::MachineConstantPoolEntry::@168 Val
The constant itself.
bool isGlobalValue() const
static MCSymbol * getBFLabel(StringRef Prefix, unsigned FunctionNumber, unsigned LabelId, MCContext &Ctx)
MachineBasicBlock * getMBB() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This class represents lattice values for constants.
PointerTy getPointer() const
bool hasOptNone() const
Do not optimize this function (-O0).
StringRef getPrivateGlobalPrefix() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
void EmitJumpTableTBInst(const MachineInstr *MI, unsigned OffsetWidth)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
MCContext & OutContext
This is the context for the output file that we are streaming.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
static MCOperand createExpr(const MCExpr *Val)
void push_back(const T &Elt)
ARMConstantPoolValue - ARM specific constantpool value.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
Target specific streamer interface.
virtual void emitPad(int64_t Offset)
unsigned getSubReg() const
Global Offset Table, Thread Pointer Offset.
unsigned char getPCAdjustment() const
void EmitAlignment(Align Alignment, const GlobalObject *GV=nullptr) const
Emit an alignment directive to the specified power of two boundary.
bool isTargetCOFF() const
A raw_ostream that writes to an SmallVector or SmallString.
MachineBasicBlock reference.
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - This uses the EmitInstruction() method to print assembly for each instruction...
virtual void finishAttributeSection()
unsigned const TargetRegisterInfo * TRI
MachineFunction * MF
The current machine function.
bool isPromotedGlobal() const
bool isThumb1Only() const
bool isTargetMuslAEABI() const
void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI)
Global Offset Table, PC Relative.
Target & getTheThumbLETarget()
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
static bool isThumb(const MCSubtargetInfo &STI)
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
void LLVMInitializeARMAsmPrinter()
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo, const MCSubtargetInfo *EndInfo) const override
Let the target do anything it needs to do after emitting inlineasm.
return AArch64::GPR64RegClass contains(Reg)
bool genExecuteOnly() const
void EmitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
bool mustAddCurrentAddress() const
ARMCP::ARMCPModifier getModifier() const
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
The address of a basic block.
MCContext & getContext() const
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "...
void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &O) override
Print the MachineOperand as a symbol.
virtual void emitInst(uint32_t Inst, char Suffix='\0')
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
static MCOperand createReg(unsigned Reg)
MCSuperRegIterator enumerates all super-registers of Reg.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const FeatureBitset & getFeatureBits() const
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
unsigned getNumOperands() const
Retuns the total number of operands.
void EmitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
static const MCBinaryExpr * createDiv(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Base class for the full range of assembler expressions which are needed for parsing.
bool isMachineBasicBlock() const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const char * getSymbolName() const
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Target & getTheARMBETarget()
bool isGVIndirectSymbol(const GlobalValue *GV) const
True if the GV will be accessed via an indirect symbol.
void EmitGlobalVariable(const GlobalVariable *GV) override
Emit the specified global variable to the .s file.
void emitXRayTable()
Emit a table with all XRay instrumentation points.
Context object for machine code objects.
static const ARMMCExpr * createLower16(const MCExpr *Expr, MCContext &Ctx)
void EmitFunctionBody()
This method emits the body and trailer for a function.
unsigned NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
Type * getType() const
All values are typed, get the type of this value.
void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override
EmitMachineConstantPoolValue - Print a machine constantpool value to the .s file. ...
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
.code16 (X86) / .code 16 (ARM)
bool isPositionIndependent() const
Target & getTheThumbBETarget()
MCSymbol * GetCPISymbol(unsigned CPID) const override
Return the symbol for the specified constant pool entry.
bool isTargetEHABICompatible() const
Register getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
bool isTargetDarwin() const
virtual void emitMovSP(unsigned Reg, int64_t Offset=0)
RegisterAsmPrinter - Helper template for registering a target specific assembly printer, for use in the target machine initialization function.
This class is a data container for one entry in a MachineConstantPool.
static MCSymbolRefExpr::VariantKind getModifierVariantKind(ARMCP::ARMCPModifier Modifier)
StringRef getTargetCPU() const
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Instances of this class represent a single low-level machine instruction.
bool useR7AsFramePointer() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
virtual void emitAttribute(unsigned Attribute, unsigned Value)
const Constant * ConstVal
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
Address of a global value.
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O)
Streaming machine code generation interface.
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
virtual void emitRegSave(const SmallVectorImpl< unsigned > &RegList, bool isVector)
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
MCSymbol * CurrentFnSym
The symbol for the current function.
const MCAsmInfo * MAI
Target Asm Printer information.
PointerIntPair - This class implements a pair of a pointer and small integer.
The instances of the Type class are immutable: once they are created, they are never changed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const GlobalValue * getGlobal() const
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
virtual void emitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset=0)
MCSection * getNonLazySymbolPointerSection() const
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
static MCSymbol * getPICLabel(StringRef Prefix, unsigned FunctionNumber, unsigned LabelId, MCContext &Ctx)
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
bool hasInternalLinkage() const
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
.subsections_via_symbols (MachO)
TRAP - Trapping instruction.
Thread Local Storage (General Dynamic Mode)
const Triple & getTargetTriple() const
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Ty & getObjFileInfo()
Keep track of various per-function pieces of information for backends that would like to do so...
ARMAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
unsigned NoInfsFPMath
NoInfsFPMath - This flag is enabled when the -enable-no-infs-fp-math flag is specified on the command...
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
SmallPtrSet< const GlobalVariable *, 2 > & getGlobalsPromotedToConstantPool()
FPDenormal::DenormalMode FPDenormalMode
FPDenormalMode - This flags specificies which denormal numbers the code is permitted to require...
DenseMap< unsigned, unsigned > EHPrologueRemappedRegs
const Constant * stripPointerCasts() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void EmitFunctionEntryLabel() override
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
Abstract base class for all machine specific constantpool value subclasses.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MO_LO16 - On a symbol operand, this represents a relocation containing lower 16 bit of the address...
Triple - Helper class for working with autoconf configuration names.
MCSection * getThreadLocalPointerSection() const
void EmitJumpTableInsts(const MachineInstr *MI)
const std::vector< MachineConstantPoolEntry > & getConstants() const
unsigned getFunctionNumber() const
Return a unique ID for the current function.
void setOpcode(unsigned Op)
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
SymbolListTy GetThreadLocalGVStubList()
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
static void emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel, MachineModuleInfoImpl::StubValueTy &MCSym)
bool isTargetAEABI() const
MCSymbol * getSymbol(const GlobalValue *GV) const
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
virtual Register getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
unsigned getOriginalCPIdx(unsigned CloneIdx) const
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
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...
void emitTargetAttributes(const MCSubtargetInfo &STI)
Emit the build attributes that only depend on the hardware that we expect.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
SymbolStorageClass
Storage class tells where and what the symbol represents.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
MCSymbol * getCurExceptionSym()
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
bool isBlockAddress() const
void LowerARMMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, ARMAsmPrinter &AP)
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
.code32 (X86) / .code 32 (ARM)
FunctionNumber(functionNumber)
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
Section Relative (Windows TLS)
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
virtual void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
static bool checkFunctionsAttributeConsistency(const Module &M, StringRef Attr, StringRef Value)
LLVM_NODISCARD bool empty() const
StringRef getValueAsString() const
Return the attribute's value as a string.
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
int64_t getOffset() const
Return the offset from the symbol in this operand.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
void EmitJumpTableAddrs(const MachineInstr *MI)
static const ARMMCExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
Generic base class for all target subtargets.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getType() const
getType - get type of this MachineConstantPoolValue.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
const Module * getModule() const
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
bool isLittleEndian() const
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
bool isTargetMachO() const
unsigned getLabelId() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void EmitGlobalConstant(const DataLayout &DL, const Constant *CV)
Print a general LLVM constant to the .s file.
LLVM Value Representation.
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which...
ExceptionHandling getExceptionHandlingType() const
std::string ParseARMTriple(const Triple &TT, StringRef CPU)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
static const unsigned FramePtr
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isTargetWindows() const
Primary interface to the complete machine description for the target machine.
const DataLayout & getDataLayout() const
Return information about data layout.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
Address of indexed Constant in Constant Pool.
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
Register getReg() const
getReg - Returns the register number.
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
Target & getTheARMLETarget()
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const MachineOperand & getOperand(unsigned i) const
void EmitXXStructor(const DataLayout &DL, const Constant *CV) override
Targets can override this to change how global constants that are part of a C++ static/global constru...
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
bool isThumbFunction() const
static MCOperand createImm(int64_t Val)
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
MO_HI16 - On a symbol operand, this represents a relocation containing higher 16 bit of the address...
Wrapper class representing virtual and physical registers.
virtual void switchVendor(StringRef Vendor)
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line...
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
void EmitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
A function that returns a base type.