76 #define DEBUG_TYPE "asmprinter" 90 std::unique_ptr<MCStreamer> Streamer)
91 :
AsmPrinter(TM, std::move(Streamer)), SM(*
this) {}
93 StringRef getPassName()
const override {
return "PowerPC Assembly Printer"; }
97 bool doInitialization(
Module &M)
override {
111 bool PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
113 bool PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
116 void EmitEndOfAsmFile(
Module &M)
override;
130 class PPCLinuxAsmPrinter :
public PPCAsmPrinter {
133 std::unique_ptr<MCStreamer> Streamer)
134 : PPCAsmPrinter(TM, std::move(Streamer)) {}
137 return "Linux PPC Assembly Printer";
140 bool doFinalization(
Module &M)
override;
141 void EmitStartOfAsmFile(
Module &M)
override;
143 void EmitFunctionEntryLabel()
override;
145 void EmitFunctionBodyStart()
override;
146 void EmitFunctionBodyEnd()
override;
150 class PPCAIXAsmPrinter :
public PPCAsmPrinter {
157 PPCAIXAsmPrinter(
TargetMachine &
TM, std::unique_ptr<MCStreamer> Streamer)
158 : PPCAsmPrinter(TM, std::move(Streamer)) {}
160 StringRef getPassName()
const override {
return "AIX PPC Assembly Printer"; }
168 void EmitFunctionDescriptor()
override;
170 void EmitEndOfAsmFile(
Module &)
override;
182 if (Subtarget->hasLazyResolverStub(GV)) {
183 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
191 SymToPrint = getSymbol(GV);
194 SymToPrint->
print(O, MAI);
211 if (!Subtarget->isDarwin())
231 PrintSymbolOperand(MO, O);
243 bool PPCAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
246 if (ExtraCode && ExtraCode[0]) {
247 if (ExtraCode[1] != 0)
return true;
249 switch (ExtraCode[0]) {
274 Reg = PPC::VSX32 + (Reg - PPC::V0);
276 Reg = PPC::VSX32 + (Reg - PPC::VF0);
293 bool PPCAsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
294 const char *ExtraCode,
296 if (ExtraCode && ExtraCode[0]) {
297 if (ExtraCode[1] != 0)
return true;
299 switch (ExtraCode[0]) {
300 default:
return true;
303 const char *RegName =
"r0";
304 if (!Subtarget->isDarwin())
306 O << RegName <<
", ";
338 TOCEntry = createTempSymbol(
"C");
342 void PPCAsmPrinter::EmitEndOfAsmFile(
Module &M) {
349 auto &Ctx = OutStreamer->getContext();
350 MCSymbol *MILabel = Ctx.createTempSymbol();
351 OutStreamer->EmitLabel(MILabel);
354 assert(NumNOPBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
360 while (NumNOPBytes > 0) {
361 if (MII == MBB.
end() || MII->isCall() ||
362 MII->getOpcode() == PPC::DBG_VALUE ||
363 MII->getOpcode() == TargetOpcode::PATCHPOINT ||
364 MII->getOpcode() == TargetOpcode::STACKMAP)
371 for (
unsigned i = 0; i < NumNOPBytes; i += 4)
378 auto &Ctx = OutStreamer->getContext();
379 MCSymbol *MILabel = Ctx.createTempSymbol();
380 OutStreamer->EmitLabel(MILabel);
385 unsigned EncodedBytes = 0;
388 if (CalleeMO.
isImm()) {
389 int64_t CallTarget = CalleeMO.
getImm();
391 assert((CallTarget & 0xFFFFFFFFFFFF) == CallTarget &&
392 "High 16 bits of call target should be zero.");
398 .addImm((CallTarget >> 32) & 0xFFFF));
403 .addImm(32).addImm(16));
408 .addImm((CallTarget >> 16) & 0xFFFF));
413 .addImm(CallTarget & 0xFFFF));
416 int TOCSaveOffset = Subtarget->getFrameLowering()->getTOCSaveOffset();
419 .addImm(TOCSaveOffset)
425 if (!Subtarget->isELFv2ABI()) {
432 .addReg(ScratchReg));
437 .addReg(ScratchReg));
442 .addReg(ScratchReg));
450 .addImm(TOCSaveOffset)
456 MCSymbol *MOSymbol = getSymbol(GValue);
469 assert(NumBytes >= EncodedBytes &&
470 "Patchpoint can't request size less than the length of a call.");
471 assert((NumBytes - EncodedBytes) % 4 == 0 &&
472 "Invalid number of NOP bytes requested!");
473 for (
unsigned i = EncodedBytes; i < NumBytes; i += 4)
482 MCSymbol *TlsGetAddr = OutContext.getOrCreateSymbol(Name);
489 "GETtls[ld]ADDR[32] must define GPR3");
493 "GETtls[ld]ADDR[32] must read GPR3");
495 if (Subtarget->is32BitELFABI() && isPositionIndependent())
508 MCSymbol *MOSymbol = getSymbol(GValue);
510 EmitToStreamer(*OutStreamer,
512 PPC::BL8_NOP_TLS : PPC::BL_TLS)
537 void PPCAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
539 const bool IsDarwin =
TM.getTargetTriple().isOSDarwin();
540 const bool IsPPC64 = Subtarget->isPPC64();
541 const bool IsAIX = Subtarget->isAIXABI();
551 if (Subtarget->hasSPE()) {
552 if (PPC::F4RCRegClass.
contains(Reg) ||
553 PPC::F8RCRegClass.contains(Reg) ||
554 PPC::QBRCRegClass.contains(Reg) ||
555 PPC::QFRCRegClass.contains(Reg) ||
556 PPC::QSRCRegClass.contains(Reg) ||
557 PPC::VFRCRegClass.contains(Reg) ||
558 PPC::VRRCRegClass.contains(Reg) ||
559 PPC::VSFRCRegClass.contains(Reg) ||
560 PPC::VSSRCRegClass.contains(Reg)
564 if (PPC::SPERCRegClass.
contains(Reg))
574 case TargetOpcode::DBG_VALUE:
576 case TargetOpcode::STACKMAP:
577 return LowerSTACKMAP(SM, *MI);
578 case TargetOpcode::PATCHPOINT:
579 return LowerPATCHPOINT(SM, *MI);
581 case PPC::MoveGOTtoLR: {
589 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
601 case PPC::MovePCtoLR:
602 case PPC::MovePCtoLR8: {
607 MCSymbol *PICBase = MF->getPICBaseSymbol();
610 EmitToStreamer(*OutStreamer,
617 OutStreamer->EmitLabel(PICBase);
620 case PPC::UpdateGBR: {
629 if (Subtarget->isSecurePlt() && isPositionIndependent() ) {
631 MCSymbol *BaseSymbol = OutContext.getOrCreateSymbol(
643 MCInstBuilder(PPC::ADDIS).addReg(PICR).addReg(PICR).addExpr(DeltaHi));
648 MCInstBuilder(PPC::ADDI).addReg(PICR).addReg(PICR).addExpr(DeltaLo));
668 EmitToStreamer(*OutStreamer, TmpInst);
674 EmitToStreamer(*OutStreamer, TmpInst);
679 assert(!IsDarwin &&
"TOC is an ELF/XCOFF construct.");
689 "Invalid operand for LWZtoc.");
692 const MCSymbol *
const MOSymbol = getMCSymbolForTOCPseudoMO(MO);
701 EmitToStreamer(*OutStreamer, TmpInst);
708 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
718 "This pseudo should only be selected for 32-bit small code model.");
720 EmitToStreamer(*OutStreamer, TmpInst);
727 OutContext.getOrCreateSymbol(
Twine(
".LTOC")), OutContext);
730 EmitToStreamer(*OutStreamer, TmpInst);
737 assert(!IsDarwin &&
"TOC is an ELF/XCOFF construct");
753 lookUpOrCreateTOCEntry(getMCSymbolForTOCPseudoMO(MO));
760 EmitToStreamer(*OutStreamer, TmpInst);
763 case PPC::ADDIStocHA: {
765 "This pseudo should only be selected for 32-bit large code model on" 776 "Invalid operand for ADDIStocHA.");
779 MCSymbol *MOSymbol = getMCSymbolForTOCPseudoMO(MO);
785 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
790 EmitToStreamer(*OutStreamer, TmpInst);
795 "This pseudo should only be selected for 32-bit large code model on" 806 "Invalid operand for LWZtocL.");
809 MCSymbol *MOSymbol = getMCSymbolForTOCPseudoMO(MO);
815 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
820 EmitToStreamer(*OutStreamer, TmpInst);
823 case PPC::ADDIStocHA8: {
824 assert(!IsDarwin &&
"TOC is an ELF/XCOFF construct");
837 "Invalid operand for ADDIStocHA8!");
839 const MCSymbol *MOSymbol = getMCSymbolForTOCPseudoMO(MO);
841 const bool GlobalToc =
845 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
860 EmitToStreamer(*OutStreamer, TmpInst);
864 assert(!IsDarwin &&
"TOC is an ELF/XCOFF construct");
878 "Invalid operand for LDtocL!");
882 "LDtocL used on symbol that could be accessed directly is " 883 "invalid. Must match ADDIStocHA8."));
885 const MCSymbol *MOSymbol = getMCSymbolForTOCPseudoMO(MO);
888 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
895 EmitToStreamer(*OutStreamer, TmpInst);
898 case PPC::ADDItocL: {
912 "Interposable definitions must use indirect access."));
918 EmitToStreamer(*OutStreamer, TmpInst);
921 case PPC::ADDISgotTprelHA: {
924 assert(IsPPC64 &&
"Not supported for 32-bit PowerPC");
927 MCSymbol *MOSymbol = getSymbol(GValue);
928 const MCExpr *SymGotTprel =
934 .addExpr(SymGotTprel));
937 case PPC::LDgotTprelL:
938 case PPC::LDgotTprelL32: {
946 MCSymbol *MOSymbol = getSymbol(GValue);
952 EmitToStreamer(*OutStreamer, TmpInst);
956 case PPC::PPC32PICGOT: {
957 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
958 MCSymbol *GOTRef = OutContext.createTempSymbol();
959 MCSymbol *NextInstr = OutContext.createTempSymbol();
969 OutStreamer->EmitLabel(GOTRef);
970 OutStreamer->EmitValue(OffsExpr, 4);
971 OutStreamer->EmitLabel(NextInstr);
984 case PPC::PPC32GOT: {
986 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
993 .addExpr(SymGotTlsL));
997 .addExpr(SymGotTlsHA));
1000 case PPC::ADDIStlsgdHA: {
1003 assert(IsPPC64 &&
"Not supported for 32-bit PowerPC");
1006 MCSymbol *MOSymbol = getSymbol(GValue);
1007 const MCExpr *SymGotTlsGD =
1013 .addExpr(SymGotTlsGD));
1016 case PPC::ADDItlsgdL:
1019 case PPC::ADDItlsgdL32: {
1024 MCSymbol *MOSymbol = getSymbol(GValue);
1029 EmitToStreamer(*OutStreamer,
1033 .addExpr(SymGotTlsGD));
1036 case PPC::GETtlsADDR:
1039 case PPC::GETtlsADDR32: {
1045 case PPC::ADDIStlsldHA: {
1048 assert(IsPPC64 &&
"Not supported for 32-bit PowerPC");
1051 MCSymbol *MOSymbol = getSymbol(GValue);
1052 const MCExpr *SymGotTlsLD =
1058 .addExpr(SymGotTlsLD));
1061 case PPC::ADDItlsldL:
1064 case PPC::ADDItlsldL32: {
1069 MCSymbol *MOSymbol = getSymbol(GValue);
1074 EmitToStreamer(*OutStreamer,
1078 .addExpr(SymGotTlsLD));
1081 case PPC::GETtlsldADDR:
1084 case PPC::GETtlsldADDR32: {
1090 case PPC::ADDISdtprelHA:
1093 case PPC::ADDISdtprelHA32: {
1098 MCSymbol *MOSymbol = getSymbol(GValue);
1099 const MCExpr *SymDtprel =
1107 .addExpr(SymDtprel));
1110 case PPC::ADDIdtprelL:
1113 case PPC::ADDIdtprelL32: {
1118 MCSymbol *MOSymbol = getSymbol(GValue);
1119 const MCExpr *SymDtprel =
1122 EmitToStreamer(*OutStreamer,
1126 .addExpr(SymDtprel));
1131 if (!Subtarget->hasMFOCRF()) {
1134 unsigned NewOpcode =
1145 if (!Subtarget->hasMFOCRF()) {
1148 unsigned NewOpcode =
1149 MI->
getOpcode() == PPC::MTOCRF ? PPC::MTCRF : PPC::MTCRF8;
1150 unsigned Mask = 0x80 >> OutContext.getRegisterInfo()
1171 unsigned OpNum = (MI->
getOpcode() == PPC::STD) ? 2 : 1;
1182 EmitToStreamer(*OutStreamer, TmpInst);
1185 void PPCLinuxAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
1186 if (!Subtarget->isPPC64())
1187 return PPCAsmPrinter::EmitInstruction(MI);
1191 return PPCAsmPrinter::EmitInstruction(MI);
1192 case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
1204 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1205 MCSymbol *EndOfSled = OutContext.createTempSymbol();
1206 OutStreamer->EmitLabel(BeginOfSled);
1207 EmitToStreamer(*OutStreamer,
1213 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1214 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1215 EmitToStreamer(*OutStreamer,
1218 OutContext.getOrCreateSymbol(
"__xray_FunctionEntry"),
1220 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1221 OutStreamer->EmitLabel(EndOfSled);
1222 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_ENTER);
1225 case TargetOpcode::PATCHABLE_RET: {
1229 for (
const auto &MO :
1237 if (RetOpcode == PPC::BCCLR) {
1238 IsConditional =
true;
1239 }
else if (RetOpcode == PPC::TCRETURNdi8 || RetOpcode == PPC::TCRETURNri8 ||
1240 RetOpcode == PPC::TCRETURNai8) {
1242 }
else if (RetOpcode == PPC::BLR8 || RetOpcode == PPC::TAILB8) {
1243 IsConditional =
false;
1245 EmitToStreamer(*OutStreamer, RetInst);
1250 if (IsConditional) {
1269 FallthroughLabel = OutContext.createTempSymbol();
1292 OutStreamer->EmitCodeAlignment(8);
1293 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1294 OutStreamer->EmitLabel(BeginOfSled);
1295 EmitToStreamer(*OutStreamer, RetInst);
1299 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1300 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1301 EmitToStreamer(*OutStreamer,
1304 OutContext.getOrCreateSymbol(
"__xray_FunctionExit"),
1306 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1307 EmitToStreamer(*OutStreamer, RetInst);
1309 OutStreamer->EmitLabel(FallthroughLabel);
1310 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_EXIT);
1313 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
1315 case TargetOpcode::PATCHABLE_TAIL_CALL:
1319 "around this assert.");
1323 void PPCLinuxAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1324 if (static_cast<const PPCTargetMachine &>(
TM).isELFv2ABI()) {
1332 if (static_cast<const PPCTargetMachine &>(
TM).isPPC64() ||
1333 !isPositionIndependent())
1339 OutStreamer->SwitchSection(OutContext.getELFSection(
1342 MCSymbol *TOCSym = OutContext.getOrCreateSymbol(
Twine(
".LTOC"));
1343 MCSymbol *CurrentPos = OutContext.createTempSymbol();
1345 OutStreamer->EmitLabel(CurrentPos);
1354 OutStreamer->EmitAssignment(TOCSym, tocExpr);
1356 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1359 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
1361 if (!Subtarget->isPPC64() &&
1362 (!isPositionIndependent() ||
1366 if (!Subtarget->isPPC64()) {
1368 if (PPCFI->
usesPICBase() && !Subtarget->isSecurePlt()) {
1370 MCSymbol *PICBase = MF->getPICBaseSymbol();
1371 OutStreamer->EmitLabel(RelocSymbol);
1379 OutStreamer->EmitValue(OffsExpr, 4);
1380 OutStreamer->EmitLabel(CurrentFnSym);
1387 if (Subtarget->isELFv2ABI()) {
1393 && !MF->getRegInfo().use_empty(PPC::X2)) {
1398 const MCExpr *TOCDeltaExpr =
1405 OutStreamer->EmitValue(TOCDeltaExpr, 8);
1414 OutStreamer->SwitchSection(Section);
1415 OutStreamer->EmitLabel(CurrentFnSym);
1416 OutStreamer->EmitValueToAlignment(8);
1417 MCSymbol *Symbol1 = CurrentFnSymForSize;
1424 OutStreamer->EmitValue(
1428 OutStreamer->EmitIntValue(0, 8 );
1429 OutStreamer->SwitchSection(Current.first, Current.second);
1432 bool PPCLinuxAsmPrinter::doFinalization(
Module &M) {
1444 Section = OutStreamer->getContext().getELFSection(
1447 Section = OutStreamer->getContext().getELFSection(
1449 OutStreamer->SwitchSection(Section);
1451 for (
const auto &TOCMapPair : TOC) {
1452 const MCSymbol *
const TOCEntryTarget = TOCMapPair.first;
1453 MCSymbol *
const TOCEntryLabel = TOCMapPair.second;
1455 OutStreamer->EmitLabel(TOCEntryLabel);
1459 OutStreamer->EmitValueToAlignment(4);
1460 OutStreamer->EmitSymbolValue(TOCEntryTarget, 4);
1469 void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
1501 if (Subtarget->isELFv2ABI()
1503 && !MF->getRegInfo().use_empty(PPC::X2)) {
1510 OutStreamer->EmitLabel(GlobalEntryLabel);
1516 const MCExpr *TOCDeltaExpr =
1518 GlobalEntryLabelExp, OutContext);
1520 const MCExpr *TOCDeltaHi =
1525 .addExpr(TOCDeltaHi));
1527 const MCExpr *TOCDeltaLo =
1532 .addExpr(TOCDeltaLo));
1535 const MCExpr *TOCOffsetDeltaExpr =
1537 GlobalEntryLabelExp, OutContext);
1541 .addExpr(TOCOffsetDeltaExpr)
1550 OutStreamer->EmitLabel(LocalEntryLabel);
1553 const MCExpr *LocalOffsetExp =
1555 GlobalEntryLabelExp, OutContext);
1561 TS->
emitLocalEntry(cast<MCSymbolELF>(CurrentFnSym), LocalOffsetExp);
1568 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
1576 if (Subtarget->isPPC64()) {
1577 OutStreamer->EmitIntValue(0, 4);
1578 OutStreamer->EmitIntValue(0, 8);
1586 MCSectionXCOFF *FnDescSec = OutStreamer->getContext().getXCOFFSection(
1589 cast<MCSymbolXCOFF>(CurrentFnDescSym)->setContainingCsect(FnDescSec);
1606 const MCExpr *PPCAIXAsmPrinter::lowerConstant(
const Constant *CV) {
1607 if (
const Function *
F = dyn_cast<Function>(CV)) {
1614 MCSectionXCOFF *Csect = OutStreamer->getContext().getXCOFFSection(
1623 return PPCAsmPrinter::lowerConstant(CV);
1626 void PPCAIXAsmPrinter::EmitGlobalVariable(
const GlobalVariable *GV) {
1638 SectionKind GVKind = getObjFileLowering().getKindForGlobal(GV,
TM);
1642 "not supported yet.");
1646 getObjFileLowering().SectionForGlobal(GV, GVKind,
TM));
1647 OutStreamer->SwitchSection(Csect);
1659 OutStreamer->EmitXCOFFLocalCommonSymbol(
1667 EmitLinkage(GV, EmittedInitSym);
1668 EmitAlignment(getGVAlignment(GV, DL), GV);
1669 OutStreamer->EmitLabel(EmittedInitSym);
1673 void PPCAIXAsmPrinter::EmitFunctionDescriptor() {
1679 OutStreamer->SwitchSection(
1680 cast<MCSymbolXCOFF>(CurrentFnDescSym)->getContainingCsect());
1681 OutStreamer->EmitLabel(CurrentFnDescSym);
1686 const MCSectionXCOFF *TOCBaseSec = OutStreamer->getContext().getXCOFFSection(
1693 OutStreamer->EmitIntValue(0, PointerSize);
1695 OutStreamer->SwitchSection(Current.first, Current.second);
1698 void PPCAIXAsmPrinter::EmitEndOfAsmFile(
Module &M) {
1705 MCSectionXCOFF *TOCBaseSection = OutStreamer->getContext().getXCOFFSection(
1711 OutStreamer->SwitchSection(TOCBaseSection);
1716 for (
auto &
I : TOC) {
1718 MCSectionXCOFF *TCEntry = OutStreamer->getContext().getXCOFFSection(
1719 cast<MCSymbolXCOFF>(
I.first)->getUnqualifiedName(),
XCOFF::XMC_TC,
1721 cast<MCSymbolXCOFF>(
I.second)->setContainingCsect(TCEntry);
1722 OutStreamer->SwitchSection(TCEntry);
1724 OutStreamer->EmitLabel(
I.second);
1730 PPCAIXAsmPrinter::getMCSymbolForTOCPseudoMO(
const MachineOperand &MO) {
1737 return PPCAsmPrinter::getMCSymbolForTOCPseudoMO(MO);
1759 MCSectionXCOFF *Csect = OutStreamer->getContext().getXCOFFSection(
1769 SectionKind GOKind = getObjFileLowering().getKindForGlobal(GO,
TM);
1774 return OutStreamer->getContext()
1777 ->getQualNameSymbol();
1780 return cast<MCSectionXCOFF>(
1781 getObjFileLowering().SectionForGlobal(GO, GOKind,
TM))
1782 ->getQualNameSymbol();
1787 return getSymbol(GV);
1796 std::unique_ptr<MCStreamer> &&Streamer) {
1798 return new PPCAIXAsmPrinter(tm, std::move(Streamer));
1800 return new PPCLinuxAsmPrinter(tm, std::move(Streamer));
unsigned getAlignment() const
virtual void EmitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static SectionKind getData()
mop_iterator operands_end()
MCSymbol * getGlobalEPSymbol() const
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
MachineBasicBlock * getMBB() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
PointerTy getPointer() const
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 doFinalization(Module &M) override
Shut down the asmprinter.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static MCOperand createExpr(const MCExpr *Val)
TOC Anchor for TOC Addressability.
Address of indexed Jump Table for switch.
Target & getThePPC32Target()
This class implements a map that also provides access to all stored values in a deterministic order...
MachineBasicBlock reference.
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
iterator_range< mop_iterator > operands()
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
static const PPCMCExpr * createLo(const MCExpr *Expr, bool IsDarwin, MCContext &Ctx)
return AArch64::GPR64RegClass contains(Reg)
bool isMergeable2ByteCString() const
static bool isVRRegister(unsigned Reg)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
PPCFunctionInfo - This class is derived from MachineFunction private PowerPC target-specific informat...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getNumOperands() const
Retuns the total number of operands.
Base class for the full range of assembler expressions which are needed for parsing.
bool isGlobalWriteableData() const
Represent a reference to a symbol from inside an expression.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
MCSymbolXCOFF * getQualNameSymbol() const
unsigned getReg() const
Returns the register number.
static std::string getRegisterName(const TargetRegisterInfo *TRI, unsigned Reg)
MCSymbol * getTOCOffsetSymbol() const
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset)=0
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP, bool IsDarwin)
unsigned getAlignment() const
static const char * stripRegisterPrefix(const char *RegName)
stripRegisterPrefix - This method strips the character prefix from a register name so that only the n...
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Target & getThePPC64Target()
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Instances of this class represent a single low-level machine instruction.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
Address of a global value.
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
PointerIntPair - This class implements a pair of a pointer and small integer.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This is an important base class in LLVM.
bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO, MCOperand &OutMO, AsmPrinter &AP, bool IsDarwin)
const GlobalValue * getGlobal() const
virtual void emitAbiVersion(int AbiVersion)=0
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
This class is intended to be used as a driving class for all asm writers.
static const char * getRegisterName(unsigned RegNo)
void setAlignment(Align Value)
bool hasInternalLinkage() const
Address of a basic block.
static const PPCMCExpr * createHa(const MCExpr *Expr, bool IsDarwin, MCContext &Ctx)
SectionKind - This is a simple POD value that classifies the properties of a section.
const Triple & getTargetTriple() const
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
MCSectionXCOFF * getContainingCsect() const
MI-level patchpoint operands.
void setStorageClass(XCOFF::StorageClass SC)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static AsmPrinter * createPPCAsmPrinterPass(TargetMachine &tm, std::unique_ptr< MCStreamer > &&Streamer)
createPPCAsmPrinterPass - Returns a pass that prints the PPC assembly code for a MachineFunction to t...
bool isOSAIX() const
Tests whether the OS is AIX.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void recordPatchPoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
void setOpcode(unsigned Op)
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool isMergeable4ByteCString() const
MachineOperand class - Representation of each machine instruction operand.
bool hasSection() const
Check if this global has a custom object file section.
Module.h This file contains the declarations for the Module class.
const MCOperand & getOperand(unsigned i) const
static SectionKind getMetadata()
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...
CHAIN = SC CHAIN, Imm128 - System call.
#define LLVM_EXTERNAL_VISIBILITY
static bool isVFRegister(unsigned Reg)
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
Unclassified - Treated as Read Write.
unsigned getPreferredAlignment(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
MCSymbol * getPICOffsetSymbol() const
Target & getThePPC64LETarget()
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
Csect definition for initialized storage.
const MachineBasicBlock * getParent() const
Representation of each machine instruction.
LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCAsmPrinter()
bool hasContainingCsect() const
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
Predicate InvertPredicate(Predicate Opcode)
Invert the specified predicate. != -> ==, < -> >=.
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
virtual void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
int64_t getOffset() const
Return the offset from the symbol in this operand.
const BlockAddress * getBlockAddress() const
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
This represents a section on linux, lots of unix variants and some bare metal systems.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
virtual void EmitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
StringRef getName() const
getName - Get the symbol name.
MCSymbol * getLocalEPSymbol() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
virtual void emitTCEntry(const MCSymbol &S)=0
mop_iterator operands_begin()
bool hasInitializer() const
Definitions have initializers, declarations don't.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This class implements an extremely fast bulk output stream that can only output to a stream...
void setContainingCsect(MCSectionXCOFF *C)
Primary interface to the complete machine description for the target machine.
PICLevel::Level getPICLevel() const
Returns the PIC level (small or large model)
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn)
RegisterAsmPrinter - Register an AsmPrinter implementation for the given target.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
void recordStackMap(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
Address of indexed Constant in Constant Pool.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
Instances of this class represent operands of the MCInst class.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static XCOFF::StorageClass getStorageClassForGlobal(const GlobalObject *GO)
Type * getElementType() const
PointerType * getType() const
Global values are always pointers.
Wrapper class representing virtual and physical registers.
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.