73 #define DEBUG_TYPE "asmprinter" 85 std::unique_ptr<MCStreamer> Streamer)
86 :
AsmPrinter(TM, std::move(Streamer)), SM(*
this) {}
88 StringRef getPassName()
const override {
return "PowerPC Assembly Printer"; }
92 bool doInitialization(
Module &M)
override {
102 bool PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
103 unsigned AsmVariant,
const char *ExtraCode,
105 bool PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
106 unsigned AsmVariant,
const char *ExtraCode,
109 void EmitEndOfAsmFile(
Module &M)
override;
123 class PPCLinuxAsmPrinter :
public PPCAsmPrinter {
126 std::unique_ptr<MCStreamer> Streamer)
127 : PPCAsmPrinter(TM, std::move(Streamer)) {}
130 return "Linux PPC Assembly Printer";
133 bool doFinalization(
Module &M)
override;
134 void EmitStartOfAsmFile(
Module &M)
override;
136 void EmitFunctionEntryLabel()
override;
138 void EmitFunctionBodyStart()
override;
139 void EmitFunctionBodyEnd()
override;
145 class PPCDarwinAsmPrinter :
public PPCAsmPrinter {
148 std::unique_ptr<MCStreamer> Streamer)
149 : PPCAsmPrinter(TM, std::move(Streamer)) {}
152 return "Darwin PPC Assembly Printer";
155 bool doFinalization(
Module &M)
override;
156 void EmitStartOfAsmFile(
Module &M)
override;
164 switch (RegName[0]) {
169 if (RegName[1] ==
's')
172 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
196 Reg = PPC::VSX32 + (Reg - PPC::V0);
198 Reg = PPC::VSX32 + (Reg - PPC::VF0);
204 if (!Subtarget->isDarwin())
229 if (Subtarget->hasLazyResolverStub(GV)) {
230 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
241 SymToPrint->
print(O, MAI);
255 bool PPCAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
259 if (ExtraCode && ExtraCode[0]) {
260 if (ExtraCode[1] != 0)
return true;
262 switch (ExtraCode[0]) {
293 bool PPCAsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
295 const char *ExtraCode,
297 if (ExtraCode && ExtraCode[0]) {
298 if (ExtraCode[1] != 0)
return true;
300 switch (ExtraCode[0]) {
301 default:
return true;
304 const char *RegName =
"r0";
305 if (!Subtarget->isDarwin())
307 O << RegName <<
", ";
339 TOCEntry = createTempSymbol(
"C");
343 void PPCAsmPrinter::EmitEndOfAsmFile(
Module &M) {
344 SM.serializeToStackMapSection();
351 assert(NumNOPBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
357 while (NumNOPBytes > 0) {
358 if (MII == MBB.
end() || MII->isCall() ||
359 MII->getOpcode() == PPC::DBG_VALUE ||
360 MII->getOpcode() == TargetOpcode::PATCHPOINT ||
361 MII->getOpcode() == TargetOpcode::STACKMAP)
368 for (
unsigned i = 0; i < NumNOPBytes; i += 4)
378 unsigned EncodedBytes = 0;
381 if (CalleeMO.
isImm()) {
382 int64_t CallTarget = CalleeMO.
getImm();
384 assert((CallTarget & 0xFFFFFFFFFFFF) == CallTarget &&
385 "High 16 bits of call target should be zero.");
391 .addImm((CallTarget >> 32) & 0xFFFF));
396 .addImm(32).addImm(16));
401 .addImm((CallTarget >> 16) & 0xFFFF));
406 .addImm(CallTarget & 0xFFFF));
409 int TOCSaveOffset = Subtarget->getFrameLowering()->getTOCSaveOffset();
412 .addImm(TOCSaveOffset)
418 if (!Subtarget->isELFv2ABI()) {
425 .addReg(ScratchReg));
430 .addReg(ScratchReg));
435 .addReg(ScratchReg));
443 .addImm(TOCSaveOffset)
462 assert(NumBytes >= EncodedBytes &&
463 "Patchpoint can't request size less than the length of a call.");
464 assert((NumBytes - EncodedBytes) % 4 == 0 &&
465 "Invalid number of NOP bytes requested!");
466 for (
unsigned i = EncodedBytes; i < NumBytes; i += 4)
475 MCSymbol *TlsGetAddr = OutContext.getOrCreateSymbol(Name);
481 "GETtls[ld]ADDR[32] must define GPR3");
485 "GETtls[ld]ADDR[32] must read GPR3");
487 if (!Subtarget->isPPC64() && !Subtarget->isDarwin() &&
488 isPositionIndependent())
496 EmitToStreamer(*OutStreamer,
498 PPC::BL8_NOP_TLS : PPC::BL_TLS)
506 void PPCAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
508 bool isPPC64 = Subtarget->isPPC64();
509 bool isDarwin =
TM.getTargetTriple().isOSDarwin();
518 unsigned Reg = MO.getReg();
519 if (Subtarget->hasSPE()) {
520 if (PPC::F4RCRegClass.
contains(Reg) ||
521 PPC::F8RCRegClass.contains(Reg) ||
522 PPC::QBRCRegClass.contains(Reg) ||
523 PPC::QFRCRegClass.contains(Reg) ||
524 PPC::QSRCRegClass.contains(Reg) ||
525 PPC::VFRCRegClass.contains(Reg) ||
526 PPC::VRRCRegClass.contains(Reg) ||
527 PPC::VSFRCRegClass.contains(Reg) ||
528 PPC::VSSRCRegClass.contains(Reg)
532 if (PPC::SPERCRegClass.
contains(Reg))
542 case TargetOpcode::DBG_VALUE:
544 case TargetOpcode::STACKMAP:
545 return LowerSTACKMAP(SM, *MI);
546 case TargetOpcode::PATCHPOINT:
547 return LowerPATCHPOINT(SM, *MI);
549 case PPC::MoveGOTtoLR: {
557 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
569 case PPC::MovePCtoLR:
570 case PPC::MovePCtoLR8: {
575 MCSymbol *PICBase = MF->getPICBaseSymbol();
578 EmitToStreamer(*OutStreamer,
585 OutStreamer->EmitLabel(PICBase);
588 case PPC::UpdateGBR: {
597 if (Subtarget->isSecurePlt() && isPositionIndependent() ) {
604 const MCExpr *LTOCDeltaExpr =
608 const MCExpr *LTOCDeltaHi =
613 .addExpr(LTOCDeltaHi));
615 const MCExpr *LTOCDeltaLo =
620 .addExpr(LTOCDeltaLo));
640 EmitToStreamer(*OutStreamer, TmpInst);
646 EmitToStreamer(*OutStreamer, TmpInst);
665 MOSymbol = GetCPISymbol(MO.
getIndex());
667 MOSymbol = GetJTISymbol(MO.
getIndex());
677 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
688 EmitToStreamer(*OutStreamer, TmpInst);
709 MOSymbol = GetCPISymbol(MO.
getIndex());
711 MOSymbol = GetJTISymbol(MO.
getIndex());
715 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
721 EmitToStreamer(*OutStreamer, TmpInst);
725 case PPC::ADDIStocHA: {
737 "Invalid operand for ADDIStocHA!");
739 bool GlobalToc =
false;
744 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
746 }
else if (MO.
isCPI()) {
747 MOSymbol = GetCPISymbol(MO.
getIndex());
748 }
else if (MO.
isJTI()) {
749 MOSymbol = GetJTISymbol(MO.
getIndex());
756 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
769 EmitToStreamer(*OutStreamer, TmpInst);
783 "Invalid operand for LDtocL!");
787 MOSymbol = lookUpOrCreateTOCEntry(GetJTISymbol(MO.
getIndex()));
790 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
792 else if (MO.
isCPI()) {
793 MOSymbol = GetCPISymbol(MO.
getIndex());
795 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
801 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
803 "LDtocL used on symbol that could be accessed directly is " 804 "invalid. Must match ADDIStocHA."));
805 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
812 EmitToStreamer(*OutStreamer, TmpInst);
815 case PPC::ADDItocL: {
829 LLVM_DEBUG(
unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
831 "Interposable definitions must use indirect access."));
833 }
else if (MO.
isCPI()) {
834 MOSymbol = GetCPISymbol(MO.
getIndex());
841 EmitToStreamer(*OutStreamer, TmpInst);
844 case PPC::ADDISgotTprelHA: {
847 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
851 const MCExpr *SymGotTprel =
857 .addExpr(SymGotTprel));
860 case PPC::LDgotTprelL:
861 case PPC::LDgotTprelL32: {
874 EmitToStreamer(*OutStreamer, TmpInst);
878 case PPC::PPC32PICGOT: {
879 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
880 MCSymbol *GOTRef = OutContext.createTempSymbol();
881 MCSymbol *NextInstr = OutContext.createTempSymbol();
891 OutStreamer->EmitLabel(GOTRef);
892 OutStreamer->EmitValue(OffsExpr, 4);
893 OutStreamer->EmitLabel(NextInstr);
906 case PPC::PPC32GOT: {
908 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
915 .addExpr(SymGotTlsL));
919 .addExpr(SymGotTlsHA));
922 case PPC::ADDIStlsgdHA: {
925 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
929 const MCExpr *SymGotTlsGD =
935 .addExpr(SymGotTlsGD));
938 case PPC::ADDItlsgdL:
941 case PPC::ADDItlsgdL32: {
951 EmitToStreamer(*OutStreamer,
955 .addExpr(SymGotTlsGD));
958 case PPC::GETtlsADDR:
961 case PPC::GETtlsADDR32: {
967 case PPC::ADDIStlsldHA: {
970 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
974 const MCExpr *SymGotTlsLD =
980 .addExpr(SymGotTlsLD));
983 case PPC::ADDItlsldL:
986 case PPC::ADDItlsldL32: {
996 EmitToStreamer(*OutStreamer,
1000 .addExpr(SymGotTlsLD));
1003 case PPC::GETtlsldADDR:
1006 case PPC::GETtlsldADDR32: {
1012 case PPC::ADDISdtprelHA:
1015 case PPC::ADDISdtprelHA32: {
1021 const MCExpr *SymDtprel =
1026 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
1029 .addExpr(SymDtprel));
1032 case PPC::ADDIdtprelL:
1035 case PPC::ADDIdtprelL32: {
1041 const MCExpr *SymDtprel =
1044 EmitToStreamer(*OutStreamer,
1045 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
1048 .addExpr(SymDtprel));
1053 if (!Subtarget->hasMFOCRF()) {
1056 unsigned NewOpcode =
1067 if (!Subtarget->hasMFOCRF()) {
1070 unsigned NewOpcode =
1071 MI->
getOpcode() == PPC::MTOCRF ? PPC::MTCRF : PPC::MTCRF8;
1072 unsigned Mask = 0x80 >> OutContext.getRegisterInfo()
1092 if (!Subtarget->isDarwin()) {
1093 unsigned OpNum = (MI->
getOpcode() == PPC::STD) ? 2 : 1;
1104 EmitToStreamer(*OutStreamer, TmpInst);
1107 void PPCLinuxAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
1108 if (!Subtarget->isPPC64())
1109 return PPCAsmPrinter::EmitInstruction(MI);
1113 return PPCAsmPrinter::EmitInstruction(MI);
1114 case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
1126 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1127 MCSymbol *EndOfSled = OutContext.createTempSymbol();
1128 OutStreamer->EmitLabel(BeginOfSled);
1129 EmitToStreamer(*OutStreamer,
1135 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1136 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1137 EmitToStreamer(*OutStreamer,
1140 OutContext.getOrCreateSymbol(
"__xray_FunctionEntry"),
1142 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1143 OutStreamer->EmitLabel(EndOfSled);
1144 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_ENTER);
1147 case TargetOpcode::PATCHABLE_RET: {
1151 for (
const auto &MO :
1159 if (RetOpcode == PPC::BCCLR) {
1160 IsConditional =
true;
1161 }
else if (RetOpcode == PPC::TCRETURNdi8 || RetOpcode == PPC::TCRETURNri8 ||
1162 RetOpcode == PPC::TCRETURNai8) {
1164 }
else if (RetOpcode == PPC::BLR8 || RetOpcode == PPC::TAILB8) {
1165 IsConditional =
false;
1167 EmitToStreamer(*OutStreamer, RetInst);
1172 if (IsConditional) {
1191 FallthroughLabel = OutContext.createTempSymbol();
1214 OutStreamer->EmitCodeAlignment(8);
1215 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1216 OutStreamer->EmitLabel(BeginOfSled);
1217 EmitToStreamer(*OutStreamer, RetInst);
1221 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1222 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1223 EmitToStreamer(*OutStreamer,
1226 OutContext.getOrCreateSymbol(
"__xray_FunctionExit"),
1228 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1229 EmitToStreamer(*OutStreamer, RetInst);
1231 OutStreamer->EmitLabel(FallthroughLabel);
1232 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_EXIT);
1235 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
1237 case TargetOpcode::PATCHABLE_TAIL_CALL:
1241 "around this assert.");
1245 void PPCLinuxAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1246 if (static_cast<const PPCTargetMachine &>(
TM).isELFv2ABI()) {
1254 if (static_cast<const PPCTargetMachine &>(
TM).isPPC64() ||
1255 !isPositionIndependent())
1261 OutStreamer->SwitchSection(OutContext.getELFSection(
1264 MCSymbol *TOCSym = OutContext.getOrCreateSymbol(
Twine(
".LTOC"));
1265 MCSymbol *CurrentPos = OutContext.createTempSymbol();
1267 OutStreamer->EmitLabel(CurrentPos);
1276 OutStreamer->EmitAssignment(TOCSym, tocExpr);
1278 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1281 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
1283 if (!Subtarget->isPPC64() &&
1284 (!isPositionIndependent() ||
1288 if (!Subtarget->isPPC64()) {
1290 if (PPCFI->
usesPICBase() && !Subtarget->isSecurePlt()) {
1292 MCSymbol *PICBase = MF->getPICBaseSymbol();
1293 OutStreamer->EmitLabel(RelocSymbol);
1301 OutStreamer->EmitValue(OffsExpr, 4);
1302 OutStreamer->EmitLabel(CurrentFnSym);
1309 if (Subtarget->isELFv2ABI()) {
1315 && !MF->getRegInfo().use_empty(PPC::X2)) {
1320 const MCExpr *TOCDeltaExpr =
1327 OutStreamer->EmitValue(TOCDeltaExpr, 8);
1336 OutStreamer->SwitchSection(Section);
1337 OutStreamer->EmitLabel(CurrentFnSym);
1338 OutStreamer->EmitValueToAlignment(8);
1339 MCSymbol *Symbol1 = CurrentFnSymForSize;
1346 OutStreamer->EmitValue(
1350 OutStreamer->EmitIntValue(0, 8 );
1351 OutStreamer->SwitchSection(Current.first, Current.second);
1354 bool PPCLinuxAsmPrinter::doFinalization(
Module &M) {
1366 Section = OutStreamer->getContext().getELFSection(
1369 Section = OutStreamer->getContext().getELFSection(
1371 OutStreamer->SwitchSection(Section);
1374 E = TOC.end();
I !=
E; ++
I) {
1375 OutStreamer->EmitLabel(
I->second);
1380 OutStreamer->EmitValueToAlignment(4);
1381 OutStreamer->EmitSymbolValue(S, 4);
1390 void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
1422 if (Subtarget->isELFv2ABI()
1424 && !MF->getRegInfo().use_empty(PPC::X2)) {
1431 OutStreamer->EmitLabel(GlobalEntryLabel);
1437 const MCExpr *TOCDeltaExpr =
1439 GlobalEntryLabelExp, OutContext);
1441 const MCExpr *TOCDeltaHi =
1446 .addExpr(TOCDeltaHi));
1448 const MCExpr *TOCDeltaLo =
1453 .addExpr(TOCDeltaLo));
1456 const MCExpr *TOCOffsetDeltaExpr =
1458 GlobalEntryLabelExp, OutContext);
1462 .addExpr(TOCOffsetDeltaExpr)
1471 OutStreamer->EmitLabel(LocalEntryLabel);
1474 const MCExpr *LocalOffsetExp =
1476 GlobalEntryLabelExp, OutContext);
1482 TS->
emitLocalEntry(cast<MCSymbolELF>(CurrentFnSym), LocalOffsetExp);
1489 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
1497 if (Subtarget->isPPC64()) {
1498 OutStreamer->EmitIntValue(0, 4);
1499 OutStreamer->EmitIntValue(0, 8);
1503 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1504 static const char *
const CPUDirectives[] = {
1549 "CPUDirectives[] might not be up-to-date!");
1560 OutStreamer->SwitchSection(
1561 OutContext.getMachOSection(
"__TEXT",
"__picsymbolstub1",
1566 OutStreamer->SwitchSection(
1567 OutContext.getMachOSection(
"__TEXT",
"__symbol_stub1",
1572 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1575 bool PPCDarwinAsmPrinter::doFinalization(
Module &M) {
1576 bool isPPC64 = getDataLayout().getPointerSizeInBits() == 64;
1585 if (MAI->doesSupportExceptionHandling()) {
1588 for (
const Function *Personality : MMI->getPersonalities()) {
1591 getSymbolWithGlobalValueBase(Personality,
"$non_lazy_ptr");
1604 if (!Stubs.empty()) {
1607 EmitAlignment(isPPC64 ? 3 : 2);
1609 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1611 OutStreamer->EmitLabel(Stubs[i].
first);
1614 OutStreamer->EmitSymbolAttribute(MCSym.
getPointer(),
1619 OutStreamer->EmitIntValue(0, isPPC64 ? 8 : 4 );
1628 OutStreamer->EmitValue(
1634 OutStreamer->AddBlankLine();
1654 std::unique_ptr<MCStreamer> &&Streamer) {
1656 return new PPCDarwinAsmPrinter(tm, std::move(Streamer));
1657 return new PPCLinuxAsmPrinter(tm, std::move(Streamer));
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. ...
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
mop_iterator operands_end()
MCSymbol * getGlobalEPSymbol() const
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
The VSX instruction that uses VSX register (vs0-vs63), instead of VMX register (v0-v31).
MachineBasicBlock * getMBB() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Compute iterated dominance frontiers using a linear time algorithm.
PointerTy getPointer() const
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
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 isPPC64() const
isPPC64 - Return true if we are generating code for 64-bit pointer mode.
bool doFinalization(Module &M) override
Shut down the asmprinter.
static MCOperand createExpr(const MCExpr *Val)
unsigned getReg() const
getReg - Returns the register number.
Target & getThePPC32Target()
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
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.
return AArch64::GPR64RegClass contains(Reg)
static bool isVRRegister(unsigned Reg)
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
Access to explicit operands of the instruction.
Base class for the full range of assembler expressions which are needed for parsing.
Represent a reference to a symbol from inside an expression.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getReg() const
Returns the register number.
static std::string getRegisterName(const TargetRegisterInfo *TRI, unsigned Reg)
MCSymbol * getTOCOffsetSymbol() const
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
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
unsigned getAlignment() const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Target & getThePPC64Target()
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Instances of this class represent a single low-level machine instruction.
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
MO_NLP_FLAG - If this bit is set, the symbol reference is actually to the non_lazy_ptr for the global...
void LLVMInitializePowerPCAsmPrinter()
const GlobalValue * getGlobal() const
virtual void emitAbiVersion(int AbiVersion)=0
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...
MCSection * getNonLazySymbolPointerSection() const
This class is intended to be used as a driving class for all asm writers.
static const char * getRegisterName(unsigned RegNo)
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
bool hasInternalLinkage() const
Address of a basic block.
.subsections_via_symbols (MachO)
const Triple & getTargetTriple() const
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
MI-level patchpoint operands.
static const PPCMCExpr * createLo(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
unsigned getDarwinDirective() const
getDarwinDirective - Returns the -m directive specified for the cpu.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void recordPatchPoint(const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
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...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
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.
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
const MCOperand & getOperand(unsigned i) const
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
typename VectorType::iterator iterator
static bool isVFRegister(unsigned Reg)
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
MCSymbol * getPICOffsetSymbol() const
Target & getThePPC64LETarget()
void recordStackMap(const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO, MCOperand &OutMO, AsmPrinter &AP, bool isDarwin)
const MachineBasicBlock * getParent() const
Representation of each machine instruction.
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.
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.
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.
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
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()
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.
static const PPCMCExpr * createHa(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
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.
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP, bool isDarwin)
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.
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.
virtual void emitMachine(StringRef CPU)=0
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 const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
MCSection * getTextCoalSection() const
static const char * stripRegisterPrefix(const char *RegName)
stripRegisterPrefix - This method strips the character prefix from a register name so that only the n...
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
static SectionKind getText()