57 #define DEBUG_TYPE "asm-printer"
60 std::unique_ptr<MCStreamer> Streamer)
61 :
AsmPrinter(TM, std::move(Streamer)), AFI(nullptr), MCP(nullptr),
62 InConstantPool(
false), OptimizationGoals(-1) {}
69 InConstantPool =
false;
85 assert(Size &&
"C++ constructor pointer had zero size!");
88 assert(GV &&
"C++ constructor pointer was not a GlobalValue!");
101 if (PromotedGlobals.count(GV))
123 PromotedGlobals.insert(GV);
126 unsigned OptimizationGoal;
129 OptimizationGoal = 6;
132 OptimizationGoal = 4;
135 OptimizationGoal = 3;
138 OptimizationGoal = 2;
141 OptimizationGoal = 1;
144 OptimizationGoal = 5;
147 if (OptimizationGoals == -1)
148 OptimizationGoals = OptimizationGoal;
149 else if (OptimizationGoals != (
int)OptimizationGoal)
150 OptimizationGoals = 0;
173 if (! ThumbIndirectPads.empty()) {
176 for (
unsigned i = 0, e = ThumbIndirectPads.size();
i < e;
i++) {
179 .addReg(ThumbIndirectPads[
i].first)
184 ThumbIndirectPads.clear();
202 if(ARM::GPRPairRegClass.
contains(Reg)) {
211 int64_t Imm = MO.
getImm();
229 GetARMGVSymbol(GV, TF)->
print(O,
MAI);
245 GetARMJTIPICJumpTableLabel(
unsigned uid)
const {
254 unsigned AsmVariant,
const char *ExtraCode,
257 if (ExtraCode && ExtraCode[0]) {
258 if (ExtraCode[1] != 0)
return true;
260 switch (ExtraCode[0]) {
288 if (!ARM::DPRRegClass.
contains(*SR))
310 unsigned RegBegin = MO.
getReg();
315 if (ARM::GPRPairRegClass.
contains(RegBegin)) {
317 unsigned Reg0 = TRI->
getSubReg(RegBegin, ARM::gsub_0);
319 RegBegin = TRI->
getSubReg(RegBegin, ARM::gsub_1);
327 unsigned RegOps = OpNum + 1;
343 if (!FlagsOP.
isImm())
366 if (RC == ARM::GPRPairRegClassID) {
374 ARM::gsub_0 : ARM::gsub_1);
380 unsigned RegOp = ExtraCode[0] ==
'Q' ? OpNum : OpNum + 1;
396 if (!ARM::QPRRegClass.
contains(Reg))
400 ARM::dsub_0 : ARM::dsub_1);
415 if(!ARM::GPRPairRegClass.
contains(Reg))
429 unsigned OpNum,
unsigned AsmVariant,
430 const char *ExtraCode,
433 if (ExtraCode && ExtraCode[0]) {
434 if (ExtraCode[1] != 0)
return true;
436 switch (ExtraCode[0]) {
438 default:
return true;
448 assert(MO.
isReg() &&
"unexpected inline asm memory operand");
461 const bool WasThumb =
isThumb(StartInfo);
462 if (!EndInfo || WasThumb !=
isThumb(*EndInfo)) {
523 if (!Stubs.empty()) {
528 for (
auto &Stub : Stubs)
536 if (!Stubs.empty()) {
541 for (
auto &Stub : Stubs)
564 TLOF.emitLinkerFlagsForGlobal(OS, &
Function);
565 for (
const auto &Global : M.globals())
566 TLOF.emitLinkerFlagsForGlobal(OS, &Global);
567 for (
const auto &Alias : M.aliases())
568 TLOF.emitLinkerFlagsForGlobal(OS, &Alias);
573 if (!Flags.empty()) {
574 OutStreamer->SwitchSection(TLOF.getDrectveSection());
583 if (OptimizationGoals > 0 &&
587 OptimizationGoals = -1;
647 void ARMAsmPrinter::emitAttributes() {
666 ArchFS = (
Twine(ArchFS) +
"," + FS).str();
682 if (STI.hasDivide() || STI.hasDivideInARMMode())
692 if (STI.hasV7Ops() ||
isV8M(&STI)) {
693 if (STI.isAClass()) {
696 }
else if (STI.isRClass()) {
699 }
else if (STI.isMClass()) {
711 }
else if (STI.isThumb1Only()) {
713 }
else if (STI.hasThumb2()) {
721 if (STI.hasFPARMv8()) {
723 ATS.
emitFPU(ARM::FK_CRYPTO_NEON_FP_ARMV8);
725 ATS.
emitFPU(ARM::FK_NEON_FP_ARMV8);
726 }
else if (STI.hasVFP4())
727 ATS.
emitFPU(ARM::FK_NEON_VFPV4);
729 ATS.
emitFPU(STI.hasFP16() ? ARM::FK_NEON_FP16 : ARM::FK_NEON);
736 if (STI.hasFPARMv8())
740 ? (STI.isFPOnlySP() ? ARM::FK_FPV5_SP_D16 : ARM::FK_FPV5_D16)
742 else if (STI.hasVFP4())
744 ? (STI.isFPOnlySP() ? ARM::FK_FPV4_SP_D16 : ARM::FK_VFPV4_D16)
746 else if (STI.hasVFP3())
750 ? (STI.hasFP16() ? ARM::FK_VFPV3XD_FP16 : ARM::FK_VFPV3XD)
751 : (STI.hasFP16() ? ARM::FK_VFPV3_D16_FP16 : ARM::FK_VFPV3_D16))
753 : (STI.hasFP16() ? ARM::FK_VFPV3_FP16 : ARM::FK_VFPV3));
754 else if (STI.hasVFP2())
762 }
else if (STI.isRWPI()) {
800 if (!STI.hasVFP2()) {
810 }
else if (STI.hasVFP3()) {
827 "no-trapping-math",
"true") ||
849 if (STI.allowsUnalignedMem())
862 if (STI.isFPOnlySP())
882 if (STI.hasMPExtension())
891 if (STI.hasDivideInARMMode() && !STI.hasV8Ops())
894 if (STI.hasDSP() &&
isV8M(&STI))
901 if (
auto WCharWidthValue = mdconst::extract_or_null<ConstantInt>(
902 SourceModule->getModuleFlag(
"wchar_size"))) {
903 int WCharWidth = WCharWidthValue->getZExtValue();
904 assert((WCharWidth == 2 || WCharWidth == 4) &&
905 "wchar_t width must be 2 or 4 bytes");
912 if (
auto EnumWidthValue = mdconst::extract_or_null<ConstantInt>(
913 SourceModule->getModuleFlag(
"min_enum_size"))) {
914 int EnumWidth = EnumWidthValue->getZExtValue();
915 assert((EnumWidth == 1 || EnumWidth == 4) &&
916 "Minimum enum width must be 1 or 4 bytes");
917 int EnumBuildAttr = EnumWidth == 1 ? 1 : 2;
927 else if (STI.isR9Reserved())
934 if (STI.hasTrustZone() && STI.hasVirtualization())
937 else if (STI.hasTrustZone())
940 else if (STI.hasVirtualization())
951 +
"PC" +
Twine(FunctionNumber) +
"_" +
Twine(LabelId));
993 if (!StubSym.getPointer())
999 "Windows is the only supported COFF target");
1033 auto *ACPC = cast<ARMConstantPoolConstant>(ACPV);
1034 auto *GV = ACPC->getPromotedGlobal();
1035 if (!EmittedPromotedGlobalLabels.count(GV)) {
1038 EmittedPromotedGlobalLabels.insert(GV);
1048 cast<ARMConstantPoolConstant>(ACPV)->getBlockAddress();
1051 const GlobalValue *GV = cast<ARMConstantPoolConstant>(ACPV)->getGV();
1056 MCSym = GetARMGVSymbol(GV, TF);
1062 auto Sym = cast<ARMConstantPoolSymbol>(ACPV)->
getSymbol();
1103 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1112 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1114 for (
unsigned i = 0, e = JTBBs.size();
i != e; ++
i) {
1145 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1151 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1153 for (
unsigned i = 0, e = JTBBs.size();
i != e; ++
i) {
1159 .addExpr(MBBSymbolExpr)
1166 unsigned OffsetWidth) {
1167 assert((OffsetWidth == 1 || OffsetWidth == 2) &&
"invalid tbb/tbh width");
1174 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1180 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1186 for (
auto MBB : JTBBs) {
1218 void ARMAsmPrinter::EmitUnwindingInstruction(
const MachineInstr *
MI) {
1220 "Only instruction which are involved into frame setup code are allowed");
1230 unsigned SrcReg, DstReg;
1232 if (Opc == ARM::tPUSH || Opc == ARM::tLDRpci) {
1238 SrcReg = DstReg = ARM::SP;
1247 assert(DstReg == ARM::SP &&
1248 "Only stack pointer as a destination reg is supported");
1252 unsigned StartOp = 2 + 2;
1254 unsigned NumOffset = 0;
1262 StartOp = 2; NumOffset = 2;
1263 case ARM::STMDB_UPD:
1264 case ARM::t2STMDB_UPD:
1265 case ARM::VSTMDDB_UPD:
1266 assert(SrcReg == ARM::SP &&
1267 "Only stack pointer as a source reg is supported");
1278 case ARM::STR_PRE_IMM:
1279 case ARM::STR_PRE_REG:
1280 case ARM::t2STR_PRE:
1282 "Only stack pointer as a source reg is supported");
1287 ATS.
emitRegSave(RegList, Opc == ARM::VSTMDDB_UPD);
1290 if (SrcReg == ARM::SP) {
1315 case ARM::tLDRpci: {
1322 assert(CPI != -1U &&
"Invalid constpool index");
1328 Offset = -cast<ConstantInt>(CPE.
Val.
ConstVal)->getSExtValue();
1334 if (DstReg == FramePtr && FramePtr != ARM::SP)
1337 ATS.
emitSetFP(FramePtr, ARM::SP, -Offset);
1338 else if (DstReg == ARM::SP) {
1348 }
else if (DstReg == ARM::SP) {
1361 #include "ARMGenMCPseudoLowering.inc"
1369 if (InConstantPool && MI->
getOpcode() != ARM::CONSTPOOL_ENTRY) {
1371 InConstantPool =
false;
1377 EmitUnwindingInstruction(MI);
1380 if (emitPseudoExpansionLowering(*
OutStreamer, MI))
1384 "Pseudo flag setting opcode should be expanded early");
1389 case ARM::t2MOVi32imm:
llvm_unreachable(
"Should be lowered by thumb2it pass");
1390 case ARM::DBG_VALUE:
llvm_unreachable(
"Should be handled by generic printing");
1392 case ARM::tLEApcrel:
1393 case ARM::t2LEApcrel: {
1397 ARM::t2LEApcrel ? ARM::t2ADR
1398 : (MI->
getOpcode() == ARM::tLEApcrel ? ARM::tADR
1407 case ARM::LEApcrelJT:
1408 case ARM::tLEApcrelJT:
1409 case ARM::t2LEApcrelJT: {
1413 ARM::t2LEApcrelJT ? ARM::t2ADR
1414 : (MI->
getOpcode() == ARM::tLEApcrelJT ? ARM::tADR
1425 case ARM::BX_CALL: {
1439 case ARM::tBX_CALL: {
1451 for (
unsigned i = 0, e = ThumbIndirectPads.size();
i < e;
i++) {
1452 if (ThumbIndirectPads[
i].first == TReg) {
1453 TRegSym = ThumbIndirectPads[
i].second;
1460 ThumbIndirectPads.push_back(std::make_pair(TReg, TRegSym));
1470 case ARM::BMOVPCRX_CALL: {
1490 case ARM::BMOVPCB_CALL: {
1503 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1512 case ARM::MOVi16_ga_pcrel:
1513 case ARM::t2MOVi16_ga_pcrel: {
1515 TmpInst.
setOpcode(Opc == ARM::MOVi16_ga_pcrel? ARM::MOVi16 : ARM::t2MOVi16);
1520 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1527 unsigned PCAdj = (Opc == ARM::MOVi16_ga_pcrel) ? 8 : 4;
1528 const MCExpr *PCRelExpr =
1543 case ARM::MOVTi16_ga_pcrel:
1544 case ARM::t2MOVTi16_ga_pcrel: {
1546 TmpInst.
setOpcode(Opc == ARM::MOVTi16_ga_pcrel
1547 ? ARM::MOVTi16 : ARM::t2MOVTi16);
1553 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
1560 unsigned PCAdj = (Opc == ARM::MOVTi16_ga_pcrel) ? 8 : 4;
1561 const MCExpr *PCRelExpr =
1575 case ARM::tPICADD: {
1626 case ARM::PICLDRSH: {
1643 case ARM::PICSTR: Opcode = ARM::STRrs;
break;
1644 case ARM::PICSTRB: Opcode = ARM::STRBrs;
break;
1645 case ARM::PICSTRH: Opcode = ARM::STRH;
break;
1646 case ARM::PICLDR: Opcode = ARM::LDRrs;
break;
1647 case ARM::PICLDRB: Opcode = ARM::LDRBrs;
break;
1648 case ARM::PICLDRH: Opcode = ARM::LDRH;
break;
1649 case ARM::PICLDRSB: Opcode = ARM::LDRSB;
break;
1650 case ARM::PICLDRSH: Opcode = ARM::LDRSH;
break;
1663 case ARM::CONSTPOOL_ENTRY: {
1673 if (!InConstantPool) {
1675 InConstantPool =
true;
1687 case ARM::JUMPTABLE_ADDRS:
1690 case ARM::JUMPTABLE_INSTS:
1693 case ARM::JUMPTABLE_TBB:
1694 case ARM::JUMPTABLE_TBH:
1697 case ARM::t2BR_JT: {
1708 case ARM::t2TBH_JT: {
1709 unsigned Opc = MI->
getOpcode() == ARM::t2TBB_JT ? ARM::t2TBB : ARM::t2TBH;
1721 case ARM::tTBH_JT: {
1723 bool Is8Bit = MI->
getOpcode() == ARM::tTBB_JT;
1762 unsigned Opc = Is8Bit ? ARM::tLDRBi : ARM::tLDRHi;
1766 .addImm(Is8Bit ? 4 : 2)
1776 unsigned Opc = Is8Bit ? ARM::tLDRBr : ARM::tLDRHr;
1810 unsigned Opc = MI->
getOpcode() == ARM::BR_JTr ?
1811 ARM::MOVr : ARM::tMOVr;
1819 if (Opc == ARM::MOVr)
1847 case ARM::BR_JTadd: {
1875 case ARM::TRAPNaCl: {
1885 uint16_t Val = 0xdefe;
1892 case ARM::t2Int_eh_sjlj_setjmp:
1893 case ARM::t2Int_eh_sjlj_setjmp_nofp:
1894 case ARM::tInt_eh_sjlj_setjmp: {
1944 .addExpr(SymbolExpr)
1961 case ARM::Int_eh_sjlj_setjmp_nofp:
1962 case ARM::Int_eh_sjlj_setjmp: {
2021 case ARM::Int_eh_sjlj_longjmp: {
2059 case ARM::tInt_eh_sjlj_longjmp: {
2108 case ARM::tInt_WIN_eh_sjlj_longjmp: {
2138 case ARM::PATCHABLE_FUNCTION_ENTER:
2141 case ARM::PATCHABLE_FUNCTION_EXIT:
2144 case ARM::PATCHABLE_TAIL_CALL:
virtual void EmitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
MCSection * getNonLazySymbolPointerSection() const
MachineConstantPoolValue * MachineCPVal
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
virtual void emitInst(uint32_t Inst, char Suffix= '\0')
A parsed version of the target data layout string in and methods for querying it. ...
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...
virtual void emitFPU(unsigned FPU)
StringRef getPrivateGlobalPrefix() const
StringRef getTargetCPU() const
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 GlobalValue * getGlobal() const
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
static ARMBuildAttrs::CPUArch getArchForCPU(StringRef CPU, const ARMSubtarget *Subtarget)
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSymbol * getSymbol(const GlobalValue *GV) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
const std::string & getCPUString() const
MachineBasicBlock * getMBB() 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. ...
const DataLayout & getDataLayout() const
Return information about data layout.
void EmitJumpTableTBInst(const MachineInstr *MI, unsigned OffsetWidth)
MCContext & OutContext
This is the context for the output file that we are streaming.
static MCOperand createExpr(const MCExpr *Val)
virtual void emitArchExtension(unsigned ArchExt)
bool isTargetEHABICompatible() const
ARMConstantPoolValue - ARM specific constantpool value.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
Target specific streamer interface.
virtual void emitPad(int64_t Offset)
const MachineFunction * MF
The current machine function.
Global Offset Table, Thread Pointer Offset.
A raw_ostream that writes to an SmallVector or SmallString.
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...
MachineBasicBlock reference.
unsigned getFunctionNumber() const
Return a unique ID for the current function.
bool isThumbFunction() const
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - This uses the EmitInstruction() method to print assembly for each instruction...
virtual void finishAttributeSection()
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
setjmp/longjmp based exceptions
void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI)
Global Offset Table, PC Relative.
Target & getTheThumbLETarget()
bool isThumb1Only() const
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
bool optForSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
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()
void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo, const MCSubtargetInfo *EndInfo) const override
Let the target do anything it needs to do after emitting inlineasm.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
return AArch64::GPR64RegClass contains(Reg)
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
void EmitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
const Triple & getTargetTriple() const
bool isGlobalValue() const
const std::vector< MachineJumpTableEntry > & getJumpTables() const
The address of a basic block.
bool isTargetAEABI() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static MCOperand createReg(unsigned Reg)
MCSuperRegIterator enumerates all super-registers of Reg.
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool hasInternalLinkage() const
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)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Base class for the full range of assembler expressions which are needed for parsing.
bool hasV8MMainlineOps() const
bool mustAddCurrentAddress() const
const Module * getModule() const
Reg
All possible values of the reg field in the ModR/M byte.
virtual unsigned getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
MCContext & getContext() const
Target & getTheARMBETarget()
unsigned getNumOperands() const
Access to explicit operands of the instruction.
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...
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)
PointerTy getPointer() const
.code16 (X86) / .code 16 (ARM)
bool isTargetCOFF() const
Target & getTheThumbBETarget()
bool isTargetMachO() const
Function Alias Analysis false
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
virtual void emitMovSP(unsigned Reg, int64_t Offset=0)
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
This class is a data container for one entry in a MachineConstantPool.
static MCSymbolRefExpr::VariantKind getModifierVariantKind(ARMCP::ARMCPModifier Modifier)
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
static const char * getRegisterName(unsigned RegNo)
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isMachineBasicBlock() const
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.
Instances of this class represent a single low-level machine instruction.
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
virtual void emitAttribute(unsigned Attribute, unsigned Value)
const MachineBasicBlock * getParent() const
const Constant * ConstVal
Address of a global value.
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O)
unsigned getTargetFlags() const
Streaming machine code generation interface.
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
bool isBlockAddress() const
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.
Constant * stripPointerCasts()
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...
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
unsigned getSubReg(unsigned Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
virtual void emitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset=0)
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
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)
bool isLittleEndian() 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.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
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)
ExceptionHandling getExceptionHandlingType() const
A function that returns a base type.
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
int64_t getOffset() const
Return the offset from the symbol in this operand.
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)
bool hasV8MBaselineOps() const
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
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 isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
SmallPtrSet< const GlobalVariable *, 2 > & getGlobalsPromotedToConstantPool()
FPDenormal::DenormalMode FPDenormalMode
FPDenormalMode - This flags specificies which denormal numbers the code is permitted to require...
unsigned getSubReg() 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.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
static bool isV8M(const ARMSubtarget *Subtarget)
#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...
bool genExecuteOnly() const
Triple - Helper class for working with autoconf configuration names.
MCSection * getThreadLocalPointerSection() const
void EmitAlignment(unsigned NumBits, const GlobalObject *GO=nullptr) const
Emit an alignment directive to the specified power of two boundary.
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
void EmitJumpTableInsts(const MachineInstr *MI)
void setOpcode(unsigned Op)
bool isGVIndirectSymbol(const GlobalValue *GV) const
True if the GV will be accessed via an indirect symbol.
SymbolListTy GetThreadLocalGVStubList()
StringRef getTargetFeatureString() const
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
static void emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel, MachineModuleInfoImpl::StubValueTy &MCSym)
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
void dump(const TargetInstrInfo *TII=nullptr) const
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
Type * getType() const
getType - get type of this MachineConstantPoolValue.
bool isPositionIndependent() const
SymbolStorageClass
Storage class tells where and what the symbol represents.
MCSymbol * getCurExceptionSym()
void LowerARMMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, ARMAsmPrinter &AP)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
bool isTargetGNUAEABI() const
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
.code32 (X86) / .code 32 (ARM)
FunctionNumber(functionNumber)
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
Section Relative (Windows TLS)
static bool startswith(StringRef Magic, const char(&S)[N])
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool isPromotedGlobal() const
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
static bool checkFunctionsAttributeConsistency(const Module &M, StringRef Attr, StringRef Value)
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
void EmitJumpTableAddrs(const MachineInstr *MI)
static const ARMMCExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
MCSubtargetInfo - Generic base class for all target subtargets.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
unsigned getReg() const
getReg - Returns the register number.
StringRef getValueAsString() const
Return the attribute's value as a string.
unsigned getLabelId() const
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
bool isTargetMuslAEABI() const
unsigned char getPCAdjustment() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
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...
RegisterAsmPrinter - Helper template for registering a target specific assembly printer, for use in the target machine initialization function.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which...
std::string ParseARMTriple(const Triple &TT, StringRef CPU)
static const unsigned FramePtr
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
const std::vector< MachineConstantPoolEntry > & getConstants() const
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void addOperand(const MCOperand &Op)
virtual void print(raw_ostream &O, const Module *M) const
print - Print out the internal state of the pass.
StringRef - Represent a constant reference to a string, i.e.
Address of indexed Constant in Constant Pool.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
union llvm::MachineConstantPoolEntry::@35 Val
The constant itself.
unsigned getOriginalCPIdx(unsigned CloneIdx) const
Target & getTheARMLETarget()
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...
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
ARMCP::ARMCPModifier getModifier() const
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
static MCOperand createImm(int64_t Val)
bool isTargetWindows() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
MO_HI16 - On a symbol operand, this represents a relocation containing higher 16 bit of the address...
virtual void switchVendor(StringRef Vendor)
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line...
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...