50#define DEBUG_TYPE "asm-printer"
53 std::unique_ptr<MCStreamer>
Streamer)
55 InConstantPool(
false), OptimizationGoals(-1) {}
66 InConstantPool =
false;
73 if (AFI->isThumbFunction()) {
81 if (AFI->isCmseNSEntryFunction()) {
93 assert(
Size &&
"C++ constructor pointer had zero size!");
96 assert(GV &&
"C++ constructor pointer was not a GlobalValue!");
107void ARMAsmPrinter::emitCMSEVeneerAlias(
const GlobalAlias &GA) {
132 emitCMSEVeneerAlias(GA);
136 if (PromotedGlobals.count(GV))
147 MCP =
MF.getConstantPool();
156 PromotedGlobals.insert_range(AFI->getGlobalsPromotedToConstantPool());
159 unsigned OptimizationGoal;
162 OptimizationGoal = 6;
163 else if (
F.hasMinSize())
165 OptimizationGoal = 4;
166 else if (
F.hasOptSize())
168 OptimizationGoal = 3;
171 OptimizationGoal = 2;
174 OptimizationGoal = 1;
177 OptimizationGoal = 5;
180 if (OptimizationGoals == -1)
181 OptimizationGoals = OptimizationGoal;
182 else if (OptimizationGoals != (
int)OptimizationGoal)
183 OptimizationGoals = 0;
185 if (
TM.getTargetTriple().isOSBinFormatCOFF()) {
186 bool Local =
F.hasLocalLinkage();
206 if (! ThumbIndirectPads.empty()) {
211 for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
219 ThumbIndirectPads.clear();
257 if(ARM::GPRPairRegClass.
contains(Reg)) {
260 Reg =
TRI->getSubReg(Reg, ARM::gsub_0);
292 "execute-only should not generate constant pools");
310GetARMJTIPICJumpTableLabel(
unsigned uid)
const {
321 if (ExtraCode && ExtraCode[0]) {
322 if (ExtraCode[1] != 0)
return true;
324 switch (ExtraCode[0]) {
333 if (
MI->getOperand(OpNum).isReg()) {
334 MCRegister Reg =
MI->getOperand(OpNum).getReg().asMCReg();
341 bool Lane0 =
TRI->getSubReg(SR, ARM::ssub_0) == Reg;
348 if (!
MI->getOperand(OpNum).isImm())
350 O << ~(
MI->getOperand(OpNum).
getImm());
353 if (!
MI->getOperand(OpNum).isImm())
355 O << (
MI->getOperand(OpNum).
getImm() & 0xffff);
358 if (!
MI->getOperand(OpNum).isReg())
366 if (ARM::GPRPairRegClass.
contains(RegBegin)) {
368 Register Reg0 =
TRI->getSubReg(RegBegin, ARM::gsub_0);
370 RegBegin =
TRI->getSubReg(RegBegin, ARM::gsub_1);
378 unsigned RegOps = OpNum + 1;
379 while (
MI->getOperand(RegOps).isReg()) {
394 if (!FlagsOP.
isImm())
402 if (
F.isUseOperandTiedToDef(TiedIdx)) {
404 unsigned OpFlags =
MI->getOperand(OpNum).getImm();
406 OpNum +=
F.getNumOperandRegisters() + 1;
415 const unsigned NumVals =
F.getNumOperandRegisters();
424 if (ExtraCode[0] ==
'Q')
430 if (
F.hasRegClassConstraint(RC) &&
431 ARM::GPRPairRegClass.hasSubClassEq(
TRI->getRegClass(RC))) {
439 TRI->getSubReg(MO.
getReg(), FirstHalf ? ARM::gsub_0 : ARM::gsub_1);
445 unsigned RegOp = FirstHalf ? OpNum : OpNum + 1;
446 if (RegOp >=
MI->getNumOperands())
458 if (!
MI->getOperand(OpNum).isReg())
460 Register Reg =
MI->getOperand(OpNum).getReg();
461 if (!ARM::QPRRegClass.
contains(Reg))
465 TRI->getSubReg(Reg, ExtraCode[0] ==
'e' ? ARM::dsub_0 : ARM::dsub_1);
480 if(!ARM::GPRPairRegClass.
contains(Reg))
482 Reg =
TRI->getSubReg(Reg, ARM::gsub_1);
494 unsigned OpNum,
const char *ExtraCode,
497 if (ExtraCode && ExtraCode[0]) {
498 if (ExtraCode[1] != 0)
return true;
500 switch (ExtraCode[0]) {
502 default:
return true;
504 if (!
MI->getOperand(OpNum).isReg())
512 assert(MO.
isReg() &&
"unexpected inline asm memory operand");
526 const bool WasThumb =
isThumb(StartInfo);
527 if (!EndInfo || WasThumb !=
isThumb(*EndInfo)) {
538 const Triple &TT =
TM.getTargetTriple();
545 if (TT.isOSBinFormatELF())
550 if (!M.getModuleInlineAsm().empty() && TT.isThumb())
579 const Triple &TT =
TM.getTargetTriple();
580 if (TT.isOSBinFormatMachO()) {
590 if (!Stubs.empty()) {
595 for (
auto &Stub : Stubs)
603 if (!Stubs.empty()) {
608 for (
auto &Stub : Stubs)
627 if (OptimizationGoals > 0 &&
628 (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI()))
630 OptimizationGoals = -1;
647 if (
F.isDeclaration())
649 return F.getFnAttribute(Attr).getValueAsString() !=
Value;
657 if (
F.isDeclaration())
659 return F.getDenormalFPEnv() !=
Value;
668 return !
F.isDeclaration() &&
F.isStrictFP();
674 auto F = M.functions().begin();
675 auto E = M.functions().end();
681 return !
F.isDeclaration() &&
F.getDenormalFPEnv() !=
Value;
685void ARMAsmPrinter::emitAttributes() {
686 MCTargetStreamer &TS = *
OutStreamer->getTargetStreamer();
687 ARMTargetStreamer &ATS =
static_cast<ARMTargetStreamer &
>(TS);
698 const Triple &
TT =
TM.getTargetTriple();
699 StringRef CPU =
TM.getTargetCPU();
700 StringRef
FS =
TM.getTargetFeatureString();
704 ArchFS = (Twine(ArchFS) +
"," +
FS).str();
706 ArchFS = std::string(FS);
708 const ARMBaseTargetMachine &ATM =
709 static_cast<const ARMBaseTargetMachine &
>(
TM);
712 const ARMSubtarget STI(TT, std::string(CPU), ArchFS, ATM,
722 }
else if (STI.isRWPI()) {
745 MMI->getModule()->getModuleFlag(
"arm-eabi-fp-denormal"))) {
746 if (
unsigned TagVal =
DM->getZExtValue())
762 if (!STI.hasVFP2Base()) {
772 }
else if (STI.hasVFP3Base()) {
789 MMI->getModule()->getModuleFlag(
"arm-eabi-fp-exceptions"))) {
790 if (
unsigned TagVal = Ex->getZExtValue())
793 "no-trapping-math",
"true"))
807 MMI->getModule()->getModuleFlag(
"arm-eabi-fp-number-model"))) {
808 if (
unsigned TagVal = NumModel->getZExtValue())
820 if (STI.isAAPCS_ABI() && STI.isTargetHardFloat())
830 if (
const Module *SourceModule =
MMI->getModule()) {
833 int WCharWidth =
TM.getTargetTriple().getDefaultWCharSize();
835 SourceModule->getModuleFlag(
"wchar_size")))
836 WCharWidth = WCharWidthValue->getZExtValue();
837 assert((WCharWidth == 2 || WCharWidth == 4) &&
838 "wchar_t width must be 2 or 4 bytes");
845 SourceModule->getModuleFlag(
"min_enum_size"))) {
846 int EnumWidth = EnumWidthValue->getZExtValue();
847 assert((EnumWidth == 1 || EnumWidth == 4) &&
848 "Minimum enum width must be 1 or 4 bytes");
849 int EnumBuildAttr = EnumWidth == 1 ? 1 : 2;
854 SourceModule->getModuleFlag(
"sign-return-address"));
855 if (PACValue && PACValue->isOne()) {
859 if (!STI.hasPACBTI()) {
867 SourceModule->getModuleFlag(
"branch-target-enforcement"));
868 if (BTIValue && !BTIValue->isZero()) {
872 if (!STI.hasPACBTI()) {
884 else if (STI.isR9Reserved())
898 +
"BF" +
Twine(FunctionNumber) +
"_" +
Twine(LabelId));
906 +
"PC" +
Twine(FunctionNumber) +
"_" +
Twine(LabelId));
931 unsigned char TargetFlags) {
932 const Triple &
TT =
TM.getTargetTriple();
933 if (
TT.isOSBinFormatMachO()) {
942 MachineModuleInfoMachO &MMIMachO =
943 MMI->getObjFileInfo<MachineModuleInfoMachO>();
948 if (!StubSym.getPointer())
952 }
else if (
TT.isOSBinFormatCOFF()) {
953 assert(
TT.isOSWindows() &&
"Windows is the only supported COFF target");
960 SmallString<128>
Name;
970 MachineModuleInfoCOFF &MMICOFF =
971 MMI->getObjFileInfo<MachineModuleInfoCOFF>();
975 if (!StubSym.getPointer())
980 }
else if (
TT.isOSBinFormatELF()) {
1004 for (
const auto *GV : ACPC->promotedGlobals()) {
1005 if (!EmittedPromotedGlobalLabels.count(GV)) {
1008 EmittedPromotedGlobalLabels.insert(GV);
1028 MCSym = GetARMGVSymbol(GV, TF);
1041 TM.getTargetTriple().isOSBinFormatELF() &&
TM.isPositionIndependent() &&
1060 OutStreamer->emitRelocDirective(*CPIExpr,
"R_ARM_REL32", SymExpr,
1066 MCSym =
MBB->getSymbol();
1109 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1117 const std::vector<MachineJumpTableEntry> &JT = MJTI->
getJumpTables();
1118 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1138 else if (AFI->isThumbFunction())
1156 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1161 const std::vector<MachineJumpTableEntry> &JT = MJTI->
getJumpTables();
1162 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1169 .addExpr(MBBSymbolExpr)
1176 unsigned OffsetWidth) {
1177 assert((OffsetWidth == 1 || OffsetWidth == 2) &&
"invalid tbb/tbh width");
1185 MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel(JTI);
1190 const std::vector<MachineJumpTableEntry> &JT = MJTI->
getJumpTables();
1191 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1197 for (
auto *
MBB : JTBBs) {
1233 const MCSymbol *BranchLabel)
const {
1236 uint64_t BaseOffset = 0;
1243 BaseLabel = GetARMJTIPICJumpTableLabel(JTI);
1250 BaseLabel = BranchLabel;
1258 BaseLabel = BranchLabel;
1263 BaseLabel =
nullptr;
1270 return std::make_tuple(BaseLabel, BaseOffset, BranchLabel, EntrySize);
1273void ARMAsmPrinter::EmitUnwindingInstruction(
const MachineInstr *
MI) {
1275 "Only instruction which are involved into frame setup code are allowed");
1285 unsigned Opc =
MI->getOpcode();
1286 unsigned SrcReg, DstReg;
1291 SrcReg = DstReg = ARM::SP;
1295 case ARM::t2MOVTi16:
1316 DstReg =
MI->getOperand(0).getReg();
1319 SrcReg = ARM::FPSCR;
1320 DstReg =
MI->getOperand(0).getReg();
1322 case ARM::VMRS_FPEXC:
1323 SrcReg = ARM::FPEXC;
1324 DstReg =
MI->getOperand(0).getReg();
1327 SrcReg =
MI->getOperand(1).getReg();
1328 DstReg =
MI->getOperand(0).getReg();
1333 if (
MI->mayStore()) {
1335 assert(DstReg == ARM::SP &&
1336 "Only stack pointer as a destination reg is supported");
1340 unsigned StartOp = 2 + 2;
1342 unsigned NumOffset = 0;
1345 unsigned PadBefore = 0;
1348 unsigned PadAfter = 0;
1356 StartOp = 2; NumOffset = 2;
1358 case ARM::STMDB_UPD:
1359 case ARM::t2STMDB_UPD:
1360 case ARM::VSTMDDB_UPD:
1361 assert(SrcReg == ARM::SP &&
1362 "Only stack pointer as a source reg is supported");
1363 for (
unsigned i = StartOp,
NumOps =
MI->getNumOperands() - NumOffset;
1376 "Pad registers must come before restored ones");
1385 if (
unsigned RemappedReg = AFI->EHPrologueRemappedRegs.lookup(
Reg))
1390 case ARM::STR_PRE_IMM:
1391 case ARM::STR_PRE_REG:
1392 case ARM::t2STR_PRE:
1393 assert(
MI->getOperand(2).getReg() == ARM::SP &&
1394 "Only stack pointer as a source reg is supported");
1395 if (
unsigned RemappedReg = AFI->EHPrologueRemappedRegs.lookup(SrcReg))
1396 SrcReg = RemappedReg;
1400 case ARM::t2STRD_PRE:
1401 assert(
MI->getOperand(3).getReg() == ARM::SP &&
1402 "Only stack pointer as a source reg is supported");
1403 SrcReg =
MI->getOperand(1).getReg();
1404 if (
unsigned RemappedReg = AFI->EHPrologueRemappedRegs.lookup(SrcReg))
1405 SrcReg = RemappedReg;
1407 SrcReg =
MI->getOperand(2).getReg();
1408 if (
unsigned RemappedReg = AFI->EHPrologueRemappedRegs.lookup(SrcReg))
1409 SrcReg = RemappedReg;
1411 PadBefore = -
MI->getOperand(4).getImm() - 8;
1424 if (SrcReg == ARM::SP) {
1440 case ARM::t2ADDri12:
1441 case ARM::t2ADDspImm:
1442 case ARM::t2ADDspImm12:
1443 Offset = -
MI->getOperand(2).getImm();
1447 case ARM::t2SUBri12:
1448 case ARM::t2SUBspImm:
1449 case ARM::t2SUBspImm12:
1450 Offset =
MI->getOperand(2).getImm();
1453 Offset =
MI->getOperand(2).getImm()*4;
1457 Offset = -
MI->getOperand(2).getImm()*4;
1461 -AFI->EHPrologueOffsetInRegs.lookup(
MI->getOperand(2).getReg());
1470 else if (DstReg == ARM::SP) {
1480 }
else if (DstReg == ARM::SP) {
1490 AFI->EHPrologueRemappedRegs[DstReg] = SrcReg;
1493 case ARM::VMRS_FPEXC:
1500 case ARM::tLDRpci: {
1503 unsigned CPI =
MI->getOperand(1).getIndex();
1504 const MachineConstantPool *MCP =
MF.getConstantPool();
1505 if (CPI >= MCP->getConstants().size())
1506 CPI = AFI->getOriginalCPIdx(CPI);
1507 assert(CPI != -1U &&
"Invalid constpool index");
1510 const MachineConstantPoolEntry &CPE = MCP->getConstants()[CPI];
1513 AFI->EHPrologueOffsetInRegs[DstReg] =
Offset;
1517 Offset =
MI->getOperand(1).getImm();
1518 AFI->EHPrologueOffsetInRegs[DstReg] =
Offset;
1520 case ARM::t2MOVTi16:
1521 Offset =
MI->getOperand(2).getImm();
1522 AFI->EHPrologueOffsetInRegs[DstReg] |= (
Offset << 16);
1525 Offset =
MI->getOperand(2).getImm();
1526 AFI->EHPrologueOffsetInRegs[DstReg] =
Offset;
1529 assert(
MI->getOperand(3).getImm() == 8 &&
1530 "The shift amount is not equal to 8");
1531 assert(
MI->getOperand(2).getReg() ==
MI->getOperand(0).getReg() &&
1532 "The source register is not equal to the destination register");
1533 AFI->EHPrologueOffsetInRegs[DstReg] <<= 8;
1536 assert(
MI->getOperand(2).getReg() ==
MI->getOperand(0).getReg() &&
1537 "The source register is not equal to the destination register");
1538 Offset =
MI->getOperand(3).getImm();
1539 AFI->EHPrologueOffsetInRegs[DstReg] +=
Offset;
1543 AFI->EHPrologueRemappedRegs[ARM::R12] = ARM::RA_AUTH_CODE;
1555#include "ARMGenMCPseudoLowering.inc"
1568void ARMAsmPrinter::EmitKCFI_CHECK_ARM32(
Register AddrReg, int64_t
Type,
1570 int64_t PrefixNops) {
1572 unsigned ScratchReg = ARM::R12;
1573 if (AddrReg == ARM::R12) {
1574 ScratchReg = ARM::R3;
1579 const ARMBaseRegisterInfo *
TRI =
static_cast<const ARMBaseRegisterInfo *
>(
1580 MF->getSubtarget().getRegisterInfo());
1581 unsigned AddrIndex =
TRI->getEncodingValue(AddrReg);
1582 unsigned ESR = 0x8000 | (31 << 5) | (AddrIndex & 31);
1616 .addImm(-(PrefixNops * 4 + 4))
1621 for (
int i = 0; i < 4; i++) {
1622 uint8_t
byte = (
Type >> (i * 8)) & 0xFF;
1623 uint32_t imm =
byte << (i * 8);
1624 bool isLast = (i == 3);
1629 "Cannot encode immediate as ARM modified immediate");
1633 MCInstBuilder(ARM::EORri)
1639 .addReg(isLast ? ARM::CPSR : ARM::NoRegister));
1657 MCInstBuilder(ARM::Bcc)
1660 .addReg(ARM::CPSR));
1668void ARMAsmPrinter::EmitKCFI_CHECK_Thumb2(
Register AddrReg, int64_t
Type,
1670 int64_t PrefixNops) {
1672 unsigned ScratchReg = ARM::R12;
1673 if (AddrReg == ARM::R12) {
1674 ScratchReg = ARM::R3;
1681 const ARMBaseRegisterInfo *
TRI =
static_cast<const ARMBaseRegisterInfo *
>(
1682 MF->getSubtarget().getRegisterInfo());
1683 unsigned AddrIndex =
TRI->getEncodingValue(AddrReg);
1684 unsigned ESR = 0x80 | (AddrIndex & 0x1F);
1695 MCInstBuilder(ARM::tPUSH).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R3));
1715 .addImm(-(PrefixNops * 4 + 4))
1720 for (
int i = 0; i < 4; i++) {
1721 uint8_t
byte = (
Type >> (i * 8)) & 0xFF;
1722 uint32_t imm =
byte << (i * 8);
1723 bool isLast = (i == 3);
1727 "Cannot encode immediate as Thumb2 modified immediate");
1731 MCInstBuilder(ARM::t2EORri)
1737 .addReg(isLast ? ARM::CPSR : ARM::NoRegister));
1746 MCInstBuilder(ARM::tPOP).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R3));
1752 MCInstBuilder(ARM::t2Bcc)
1755 .addReg(ARM::CPSR));
1763void ARMAsmPrinter::EmitKCFI_CHECK_Thumb1(
Register AddrReg, int64_t
Type,
1765 int64_t PrefixNops) {
1768 unsigned ScratchReg = ARM::R2;
1769 unsigned TempReg = ARM::R3;
1778 MCInstBuilder(ARM::tPUSH).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R3));
1788 MCInstBuilder(ARM::tPUSH).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R2));
1819 int offset = PrefixNops * 4 + 4;
1849 uint8_t byte0 = (
Type >> 0) & 0xFF;
1850 uint8_t byte1 = (
Type >> 8) & 0xFF;
1851 uint8_t byte2 = (
Type >> 16) & 0xFF;
1852 uint8_t byte3 = (
Type >> 24) & 0xFF;
1928 MCInstBuilder(ARM::tPOP).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R2));
1936 MCInstBuilder(ARM::tPOP).addImm(
ARMCC::AL).addReg(0).addReg(ARM::R3));
1942 MCInstBuilder(ARM::tBcc)
1945 .addReg(ARM::CPSR));
1954 Register AddrReg =
MI.getOperand(0).getReg();
1955 const int64_t
Type =
MI.getOperand(1).getImm();
1958 assert(std::next(
MI.getIterator())->isCall() &&
1959 "KCFI_CHECK not followed by a call instruction");
1963 int64_t PrefixNops =
MI.getMF()->getFunction().getFnAttributeAsParsedInteger(
1964 "patchable-function-prefix");
1967 switch (
MI.getOpcode()) {
1968 case ARM::KCFI_CHECK_ARM:
1969 EmitKCFI_CHECK_ARM32(AddrReg,
Type,
Call, PrefixNops);
1971 case ARM::KCFI_CHECK_Thumb2:
1972 EmitKCFI_CHECK_Thumb2(AddrReg,
Type,
Call, PrefixNops);
1974 case ARM::KCFI_CHECK_Thumb1:
1975 EmitKCFI_CHECK_Thumb1(AddrReg,
Type,
Call, PrefixNops);
1983 ARM_MC::verifyInstructionPredicates(
MI->getOpcode(),
1992 if (InConstantPool &&
MI->getOpcode() != ARM::CONSTPOOL_ENTRY) {
1994 InConstantPool =
false;
1998 if (
TM.getTargetTriple().isTargetEHABICompatible() &&
2000 EmitUnwindingInstruction(
MI);
2003 if (
MCInst OutInst; lowerPseudoInstExpansion(
MI, OutInst)) {
2009 "Pseudo flag setting opcode should be expanded early");
2012 unsigned Opc =
MI->getOpcode();
2014 case ARM::t2MOVi32imm:
llvm_unreachable(
"Should be lowered by thumb2it pass");
2015 case ARM::DBG_VALUE:
llvm_unreachable(
"Should be handled by generic printing");
2016 case ARM::KCFI_CHECK_ARM:
2017 case ARM::KCFI_CHECK_Thumb2:
2018 case ARM::KCFI_CHECK_Thumb1:
2022 case ARM::tLEApcrel:
2023 case ARM::t2LEApcrel: {
2027 ARM::t2LEApcrel ? ARM::t2ADR
2028 : (
MI->getOpcode() == ARM::tLEApcrel ? ARM::tADR
2030 .
addReg(
MI->getOperand(0).getReg())
2033 .
addImm(
MI->getOperand(2).getImm())
2034 .
addReg(
MI->getOperand(3).getReg()));
2037 case ARM::LEApcrelJT:
2038 case ARM::tLEApcrelJT:
2039 case ARM::t2LEApcrelJT: {
2041 GetARMJTIPICJumpTableLabel(
MI->getOperand(1).getIndex());
2043 ARM::t2LEApcrelJT ? ARM::t2ADR
2044 : (
MI->getOpcode() == ARM::tLEApcrelJT ? ARM::tADR
2046 .
addReg(
MI->getOperand(0).getReg())
2049 .
addImm(
MI->getOperand(2).getImm())
2050 .
addReg(
MI->getOperand(3).getReg()));
2055 case ARM::BX_CALL: {
2065 assert(STI.hasV4TOps() &&
"Expected V4TOps for BX call");
2070 case ARM::tBX_CALL: {
2071 assert(!STI.hasV5TOps() &&
"Expected BLX to be selected for v5t+");
2081 for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
2082 if (TIP.first == TReg) {
2083 TRegSym = TIP.second;
2090 ThumbIndirectPads.push_back(std::make_pair(TReg, TRegSym));
2100 case ARM::BMOVPCRX_CALL: {
2112 .addReg(
MI->getOperand(0).getReg())
2120 case ARM::BMOVPCB_CALL: {
2132 const unsigned TF =
Op.getTargetFlags();
2133 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
2142 case ARM::MOVi16_ga_pcrel:
2143 case ARM::t2MOVi16_ga_pcrel: {
2145 TmpInst.
setOpcode(
Opc == ARM::MOVi16_ga_pcrel? ARM::MOVi16 : ARM::t2MOVi16);
2148 unsigned TF =
MI->getOperand(1).getTargetFlags();
2150 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
2157 unsigned PCAdj = (
Opc == ARM::MOVi16_ga_pcrel) ? 8 : 4;
2176 case ARM::MOVTi16_ga_pcrel:
2177 case ARM::t2MOVTi16_ga_pcrel: {
2180 ? ARM::MOVTi16 : ARM::t2MOVTi16);
2184 unsigned TF =
MI->getOperand(2).getTargetFlags();
2186 MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
2193 unsigned PCAdj = (
Opc == ARM::MOVTi16_ga_pcrel) ? 8 : 4;
2224 if (
MI->getOperand(1).isReg()) {
2226 MCInst.addReg(
MI->getOperand(1).getReg());
2229 const MCExpr *BranchTarget;
2230 if (
MI->getOperand(1).isMBB())
2233 else if (
MI->getOperand(1).isGlobal()) {
2236 GetARMGVSymbol(GV,
MI->getOperand(1).getTargetFlags()),
OutContext);
2237 }
else if (
MI->getOperand(1).isSymbol()) {
2244 MCInst.addExpr(BranchTarget);
2247 if (
Opc == ARM::t2BFic) {
2252 MCInst.addExpr(ElseLabel);
2253 MCInst.addImm(
MI->getOperand(3).getImm());
2255 MCInst.addImm(
MI->getOperand(2).getImm())
2256 .addReg(
MI->getOperand(3).getReg());
2262 case ARM::t2BF_LabelPseudo: {
2271 case ARM::tPICADD: {
2284 .addReg(
MI->getOperand(0).getReg())
2285 .
addReg(
MI->getOperand(0).getReg())
2305 .addReg(
MI->getOperand(0).getReg())
2307 .
addReg(
MI->getOperand(1).getReg())
2309 .
addImm(
MI->getOperand(3).getImm())
2310 .
addReg(
MI->getOperand(4).getReg())
2322 case ARM::PICLDRSH: {
2336 switch (
MI->getOpcode()) {
2339 case ARM::PICSTR: Opcode = ARM::STRrs;
break;
2340 case ARM::PICSTRB: Opcode = ARM::STRBrs;
break;
2341 case ARM::PICSTRH: Opcode = ARM::STRH;
break;
2342 case ARM::PICLDR: Opcode = ARM::LDRrs;
break;
2343 case ARM::PICLDRB: Opcode = ARM::LDRBrs;
break;
2344 case ARM::PICLDRH: Opcode = ARM::LDRH;
break;
2345 case ARM::PICLDRSB: Opcode = ARM::LDRSB;
break;
2346 case ARM::PICLDRSH: Opcode = ARM::LDRSH;
break;
2349 .addReg(
MI->getOperand(0).getReg())
2351 .
addReg(
MI->getOperand(1).getReg())
2354 .
addImm(
MI->getOperand(3).getImm())
2355 .
addReg(
MI->getOperand(4).getReg()));
2359 case ARM::CONSTPOOL_ENTRY: {
2360 assert(!STI.genExecuteOnly() &&
2361 "execute-only should not generate constant pools");
2368 unsigned LabelId = (
unsigned)
MI->getOperand(0).getImm();
2369 unsigned CPIdx = (
unsigned)
MI->getOperand(1).getIndex();
2372 if (!InConstantPool) {
2374 InConstantPool =
true;
2386 case ARM::JUMPTABLE_ADDRS:
2389 case ARM::JUMPTABLE_INSTS:
2392 case ARM::JUMPTABLE_TBB:
2393 case ARM::JUMPTABLE_TBH:
2396 case ARM::t2BR_JT: {
2399 .addReg(
MI->getOperand(0).getReg())
2406 case ARM::t2TBH_JT: {
2407 unsigned Opc =
MI->getOpcode() == ARM::t2TBB_JT ? ARM::t2TBB : ARM::t2TBH;
2411 .addReg(
MI->getOperand(0).getReg())
2412 .
addReg(
MI->getOperand(1).getReg())
2419 case ARM::tTBH_JT: {
2421 bool Is8Bit =
MI->getOpcode() == ARM::tTBB_JT;
2424 assert(
MI->getOperand(1).isKill() &&
"We need the index register as scratch!");
2437 if (
Base == ARM::PC) {
2460 unsigned Opc = Is8Bit ? ARM::tLDRBi : ARM::tLDRHi;
2464 .addImm(Is8Bit ? 4 : 2)
2474 unsigned Opc = Is8Bit ? ARM::tLDRBr : ARM::tLDRHr;
2507 unsigned Opc =
MI->getOpcode() == ARM::BR_JTr ?
2508 ARM::MOVr : ARM::tMOVr;
2516 if (
Opc == ARM::MOVr)
2521 case ARM::BR_JTm_i12: {
2534 case ARM::BR_JTm_rs: {
2548 case ARM::BR_JTadd: {
2552 .addReg(
MI->getOperand(0).getReg())
2553 .
addReg(
MI->getOperand(1).getReg())
2567 if (!
TM.getTargetTriple().isOSBinFormatMachO()) {
2578 if (!
TM.getTargetTriple().isOSBinFormatMachO()) {
2579 uint16_t Val = 0xdefe;
2586 case ARM::t2Int_eh_sjlj_setjmp:
2587 case ARM::t2Int_eh_sjlj_setjmp_nofp:
2588 case ARM::tInt_eh_sjlj_setjmp: {
2597 Register SrcReg =
MI->getOperand(0).getReg();
2598 Register ValReg =
MI->getOperand(1).getReg();
2638 .addExpr(SymbolExpr)
2655 case ARM::Int_eh_sjlj_setjmp_nofp:
2656 case ARM::Int_eh_sjlj_setjmp: {
2663 Register SrcReg =
MI->getOperand(0).getReg();
2664 Register ValReg =
MI->getOperand(1).getReg();
2715 case ARM::Int_eh_sjlj_longjmp: {
2720 Register SrcReg =
MI->getOperand(0).getReg();
2721 Register ScratchReg =
MI->getOperand(1).getReg();
2774 case ARM::tInt_eh_sjlj_longjmp: {
2780 Register SrcReg =
MI->getOperand(0).getReg();
2781 Register ScratchReg =
MI->getOperand(1).getReg();
2843 case ARM::tInt_WIN_eh_sjlj_longjmp: {
2848 Register SrcReg =
MI->getOperand(0).getReg();
2873 case ARM::PATCHABLE_FUNCTION_ENTER:
2876 case ARM::PATCHABLE_FUNCTION_EXIT:
2879 case ARM::PATCHABLE_TAIL_CALL:
2882 case ARM::SpeculationBarrierISBDSBEndBB: {
2894 case ARM::t2SpeculationBarrierISBDSBEndBB: {
2910 case ARM::SpeculationBarrierSBEndBB: {
2917 case ARM::t2SpeculationBarrierSBEndBB: {
2925 case ARM::SEH_StackAlloc:
2927 MI->getOperand(1).getImm());
2930 case ARM::SEH_SaveRegs:
2931 case ARM::SEH_SaveRegs_Ret:
2933 MI->getOperand(1).getImm());
2936 case ARM::SEH_SaveSP:
2940 case ARM::SEH_SaveFRegs:
2942 MI->getOperand(1).getImm());
2945 case ARM::SEH_SaveLR:
2950 case ARM::SEH_Nop_Ret:
2954 case ARM::SEH_PrologEnd:
2958 case ARM::SEH_EpilogStart:
2962 case ARM::SEH_EpilogEnd:
2984LLVMInitializeARMAsmPrinter() {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isRegisterLiveInCall(const MachineInstr &Call, MCRegister Reg)
static void emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel, MachineModuleInfoImpl::StubValueTy &MCSym)
static uint8_t getModifierSpecifier(ARMCP::ARMCPModifier Modifier)
static MCSymbol * getPICLabel(StringRef Prefix, unsigned FunctionNumber, unsigned LabelId, MCContext &Ctx)
static bool checkDenormalAttributeInconsistency(const Module &M)
static bool checkDenormalAttributeConsistency(const Module &M, DenormalFPEnv Value)
static bool checkFunctionsAttributeConsistency(const Module &M, StringRef Attr, StringRef Value)
static bool checkModuleHasStrictFP(const Module &M)
static bool isThumb(const MCSubtargetInfo &STI)
static MCSymbol * getBFLabel(StringRef Prefix, unsigned FunctionNumber, unsigned LabelId, MCContext &Ctx)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_EXTERNAL_VISIBILITY
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
Module.h This file contains the declarations for the Module class.
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallString class.
std::unique_ptr< MCStreamer > && Streamer
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static const unsigned FramePtr
void emitJumpTableAddrs(const MachineInstr *MI)
void emitJumpTableTBInst(const MachineInstr *MI, unsigned OffsetWidth)
void emitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - This uses the emitInstruction() method to print assembly for each instruction.
MCSymbol * GetCPISymbol(unsigned CPID) const override
Return the symbol for the specified constant pool entry.
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O)
void emitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
ARMAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
void emitFunctionEntryLabel() override
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI)
void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override
EmitMachineConstantPoolValue - Print a machine constantpool value to the .s file.
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.
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...
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI)
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI)
void emitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
std::tuple< const MCSymbol *, uint64_t, const MCSymbol *, codeview::JumpTableEntrySize > getCodeViewJumpTableInfo(int JTI, const MachineInstr *BranchInstr, const MCSymbol *BranchLabel) const override
Gets information required to create a CodeView debug symbol for a jump table.
void emitJumpTableInsts(const MachineInstr *MI)
const ARMBaseTargetMachine & getTM() const
void emitGlobalVariable(const GlobalVariable *GV) override
Emit the specified global variable to the .s file.
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...
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &O) override
Print the MachineOperand as a symbol.
void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo, const MCSubtargetInfo *EndInfo, const MachineInstr *MI) override
Let the target do anything it needs to do after emitting inlineasm.
void LowerKCFI_CHECK(const MachineInstr &MI)
void emitGlobalAlias(const Module &M, const GlobalAlias &GA) override
ARM::ARMABI getEffectiveABI(const Module &M) const
Returns the ABI in effect for M: the "target-abi" module flag if present, otherwise the legacy -targe...
bool isGVIndirectSymbol(const GlobalValue *GV) const
FloatABI::ABIType getFloatABI(const Module &M) const
Returns the floating-point ABI in effect for M: the "float-abi" module flag if present,...
bool isLittleEndian() const
ARMConstantPoolValue - ARM specific constantpool value.
bool isPromotedGlobal() const
unsigned char getPCAdjustment() const
bool isMachineBasicBlock() const
bool isGlobalValue() const
ARMCP::ARMCPModifier getModifier() const
bool mustAddCurrentAddress() const
unsigned getLabelId() const
bool isBlockAddress() const
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
static const char * getRegisterName(MCRegister Reg, unsigned AltIdx=ARM::NoRegAltName)
bool isThumb1Only() const
MCPhysReg getFramePointerReg() const
bool isTargetWindows() const
bool isTargetDarwin() const
void emitTargetAttributes(const MCSubtargetInfo &STI)
Emit the build attributes that only depend on the hardware that we expect.
virtual void emitSetFP(MCRegister FpReg, MCRegister SpReg, int64_t Offset=0)
virtual void finishAttributeSection()
virtual void emitMovSP(MCRegister Reg, int64_t Offset=0)
virtual void emitARMWinCFISaveSP(unsigned Reg)
virtual void emitInst(uint32_t Inst, char Suffix='\0')
virtual void emitARMWinCFISaveLR(unsigned Offset)
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
virtual void emitARMWinCFIAllocStack(unsigned Size, bool Wide)
virtual void emitARMWinCFISaveRegMask(unsigned Mask, bool Wide)
virtual void emitRegSave(const SmallVectorImpl< MCRegister > &RegList, bool isVector)
virtual void emitARMWinCFIEpilogEnd()
virtual void emitARMWinCFIPrologEnd(bool Fragment)
virtual void switchVendor(StringRef Vendor)
virtual void emitCode16()
virtual void emitARMWinCFISaveFRegs(unsigned First, unsigned Last)
virtual void emitSyntaxUnified()
virtual void emitARMWinCFIEpilogStart(unsigned Condition)
virtual void emitPad(int64_t Offset)
virtual void emitAttribute(unsigned Attribute, unsigned Value)
virtual void emitARMWinCFINop(bool Wide)
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
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...
MCSymbol * getSymbol(const GlobalValue *GV) const
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
virtual void emitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
TargetMachine & TM
Target machine description.
void emitXRayTable()
Emit a table with all XRay instrumentation points.
virtual void emitGlobalAlias(const Module &M, const GlobalAlias &GA)
Align emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const
Emit an alignment directive to the specified power of two boundary.
MCSymbol * getMBBExceptionSym(const MachineBasicBlock &MBB)
MachineFunction * MF
The current machine function.
virtual void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
void emitFunctionBody()
This method emits the body and trailer for a function.
virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const
This emits linkage information about GVSym based on GV, if this is supported by the target.
unsigned getFunctionNumber() const
Return a unique ID for the current function.
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer, char &ID=AsmPrinter::ID)
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
void emitGlobalConstant(const DataLayout &DL, const Constant *CV, AliasMapTy *AliasList=nullptr)
EmitGlobalConstant - Print a general LLVM constant to the .s file.
MCSymbol * getSymbolPreferLocal(const GlobalValue &GV) const
Similar to getSymbol() but preferred for references.
MCSymbol * CurrentFnSym
The symbol for the current function.
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
MCContext & OutContext
This is the context for the output file that we are streaming.
bool isPositionIndependent() const
void emitVisibility(MCSymbol *Sym, unsigned Visibility, bool IsDefinition=true) const
This emits visibility information about symbol, if this is supported by the target.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
const MCAsmInfo & MAI
Target Asm Printer information.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
const DataLayout & getDataLayout() const
Return information about data layout.
virtual void emitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
MCSymbol * GetExternalSymbolSymbol(const Twine &Sym) const
Return the MCSymbol for the specified ExternalSymbol.
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
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.
The address of a basic block.
This is an important base class in LLVM.
const Constant * stripPointerCasts() const
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
LLVM_ABI const GlobalObject * getAliaseeObject() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
VisibilityTypes getVisibility() const
bool hasInternalLinkage() const
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static const MCBinaryExpr * createDiv(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Base class for the full range of assembler expressions which are needed for parsing.
MCInstBuilder & addReg(MCRegister Reg)
Add a new register operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
MCSection * getThreadLocalPointerSection() const
MCSection * getNonLazySymbolPointerSection() const
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
virtual bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
MCContext & getContext() const
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
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.
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
StringRef getName() const
getName - Get the symbol name.
Target specific streamer interface.
LLVM_ABI MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
This class is a data container for one entry in a MachineConstantPool.
union llvm::MachineConstantPoolEntry::@004270020304201266316354007027341142157160323045 Val
The constant itself.
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MachineConstantPoolValue * MachineCPVal
const Constant * ConstVal
Abstract base class for all machine specific constantpool value subclasses.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
const std::vector< MachineJumpTableEntry > & getJumpTables() const
StubValueTy & getGVStubEntry(MCSymbol *Sym)
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
SymbolListTy GetThreadLocalGVStubList()
StubValueTy & getGVStubEntry(MCSymbol *Sym)
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
const GlobalValue * getGlobal() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
unsigned getTargetFlags() const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Register getReg() const
getReg - Returns the register number.
@ MO_Immediate
Immediate operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_Register
Register operand.
int64_t getOffset() const
Return the offset from the symbol in this operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
Pass(PassKind K, char &pid)
PointerTy getPointer() const
Wrapper class representing virtual and physical registers.
Represents a location in source code.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TypeSize getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
virtual Register getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ SECREL
Thread Pointer Offset.
@ GOT_PREL
Thread Local Storage (General Dynamic Mode)
@ SBREL
Section Relative (Windows TLS)
@ GOTTPOFF
Global Offset Table, PC Relative.
@ TPOFF
Global Offset Table, Thread Pointer Offset.
@ MO_LO16
MO_LO16 - On a symbol operand, this represents a relocation containing lower 16 bit of the address.
@ MO_LO_0_7
MO_LO_0_7 - On a symbol operand, this represents a relocation containing bits 0 through 7 of the addr...
@ MO_LO_8_15
MO_LO_8_15 - On a symbol operand, this represents a relocation containing bits 8 through 15 of the ad...
@ MO_NONLAZY
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which,...
@ MO_HI_8_15
MO_HI_8_15 - On a symbol operand, this represents a relocation containing bits 24 through 31 of the a...
@ MO_HI16
MO_HI16 - On a symbol operand, this represents a relocation containing higher 16 bit of the address.
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
@ MO_HI_0_7
MO_HI_0_7 - On a symbol operand, this represents a relocation containing bits 16 through 23 of the ad...
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
std::string ParseARMTriple(const Triple &TT, StringRef CPU)
const MCSpecifierExpr * createLower16(const MCExpr *Expr, MCContext &Ctx)
const MCSpecifierExpr * createUpper16(const MCExpr *Expr, MCContext &Ctx)
SymbolStorageClass
Storage class tells where and what the symbol represents.
@ IMAGE_SYM_CLASS_EXTERNAL
External symbol.
@ IMAGE_SYM_CLASS_STATIC
Static.
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Target & getTheThumbBETarget()
@ MCDR_DataRegionEnd
.end_data_region
@ MCDR_DataRegion
.data_region
@ MCDR_DataRegionJT8
.data_region jt8
@ MCDR_DataRegionJT32
.data_region jt32
@ MCDR_DataRegionJT16
.data_region jt16
auto dyn_cast_or_null(const Y &Val)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void LowerARMMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, ARMAsmPrinter &AP)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
DWARFExpression::Operation Op
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Target & getTheARMLETarget()
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
Target & getTheARMBETarget()
Target & getTheThumbLETarget()
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Represents the full denormal controls for a function, including the default mode and the f32 specific...
static constexpr DenormalMode getPositiveZero()
static constexpr DenormalMode getPreserveSign()
static constexpr DenormalMode getIEEE()
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...