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;
175 if (!Subtarget->isDarwin())
200 if (Subtarget->hasLazyResolverStub(GV)) {
201 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
212 SymToPrint->
print(O, MAI);
226 bool PPCAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
230 if (ExtraCode && ExtraCode[0]) {
231 if (ExtraCode[1] != 0)
return true;
233 switch (ExtraCode[0]) {
260 Reg = PPC::VSX32 + (Reg - PPC::V0);
262 Reg = PPC::VSX32 + (Reg - PPC::VF0);
279 bool PPCAsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
281 const char *ExtraCode,
283 if (ExtraCode && ExtraCode[0]) {
284 if (ExtraCode[1] != 0)
return true;
286 switch (ExtraCode[0]) {
287 default:
return true;
290 const char *RegName =
"r0";
291 if (!Subtarget->isDarwin())
293 O << RegName <<
", ";
325 TOCEntry = createTempSymbol(
"C");
329 void PPCAsmPrinter::EmitEndOfAsmFile(
Module &M) {
337 assert(NumNOPBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
343 while (NumNOPBytes > 0) {
344 if (MII == MBB.
end() || MII->isCall() ||
345 MII->getOpcode() == PPC::DBG_VALUE ||
346 MII->getOpcode() == TargetOpcode::PATCHPOINT ||
347 MII->getOpcode() == TargetOpcode::STACKMAP)
354 for (
unsigned i = 0; i < NumNOPBytes; i += 4)
364 unsigned EncodedBytes = 0;
367 if (CalleeMO.
isImm()) {
368 int64_t CallTarget = CalleeMO.
getImm();
370 assert((CallTarget & 0xFFFFFFFFFFFF) == CallTarget &&
371 "High 16 bits of call target should be zero.");
377 .addImm((CallTarget >> 32) & 0xFFFF));
382 .addImm(32).addImm(16));
387 .addImm((CallTarget >> 16) & 0xFFFF));
392 .addImm(CallTarget & 0xFFFF));
395 int TOCSaveOffset = Subtarget->getFrameLowering()->getTOCSaveOffset();
398 .addImm(TOCSaveOffset)
404 if (!Subtarget->isELFv2ABI()) {
411 .addReg(ScratchReg));
416 .addReg(ScratchReg));
421 .addReg(ScratchReg));
429 .addImm(TOCSaveOffset)
448 assert(NumBytes >= EncodedBytes &&
449 "Patchpoint can't request size less than the length of a call.");
450 assert((NumBytes - EncodedBytes) % 4 == 0 &&
451 "Invalid number of NOP bytes requested!");
452 for (
unsigned i = EncodedBytes; i < NumBytes; i += 4)
461 MCSymbol *TlsGetAddr = OutContext.getOrCreateSymbol(Name);
467 "GETtls[ld]ADDR[32] must define GPR3");
471 "GETtls[ld]ADDR[32] must read GPR3");
473 if (!Subtarget->isPPC64() && !Subtarget->isDarwin() &&
474 isPositionIndependent())
482 EmitToStreamer(*OutStreamer,
484 PPC::BL8_NOP_TLS : PPC::BL_TLS)
492 void PPCAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
494 bool isPPC64 = Subtarget->isPPC64();
495 bool isDarwin =
TM.getTargetTriple().isOSDarwin();
504 unsigned Reg = MO.getReg();
505 if (Subtarget->hasSPE()) {
506 if (PPC::F4RCRegClass.
contains(Reg) ||
507 PPC::F8RCRegClass.contains(Reg) ||
508 PPC::QBRCRegClass.contains(Reg) ||
509 PPC::QFRCRegClass.contains(Reg) ||
510 PPC::QSRCRegClass.contains(Reg) ||
511 PPC::VFRCRegClass.contains(Reg) ||
512 PPC::VRRCRegClass.contains(Reg) ||
513 PPC::VSFRCRegClass.contains(Reg) ||
514 PPC::VSSRCRegClass.contains(Reg)
518 if (PPC::SPERCRegClass.
contains(Reg))
528 case TargetOpcode::DBG_VALUE:
530 case TargetOpcode::STACKMAP:
531 return LowerSTACKMAP(SM, *MI);
532 case TargetOpcode::PATCHPOINT:
533 return LowerPATCHPOINT(SM, *MI);
535 case PPC::MoveGOTtoLR: {
543 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
555 case PPC::MovePCtoLR:
556 case PPC::MovePCtoLR8: {
561 MCSymbol *PICBase = MF->getPICBaseSymbol();
564 EmitToStreamer(*OutStreamer,
571 OutStreamer->EmitLabel(PICBase);
574 case PPC::UpdateGBR: {
583 if (Subtarget->isSecurePlt() && isPositionIndependent() ) {
590 const MCExpr *LTOCDeltaExpr =
594 const MCExpr *LTOCDeltaHi =
599 .addExpr(LTOCDeltaHi));
601 const MCExpr *LTOCDeltaLo =
606 .addExpr(LTOCDeltaLo));
626 EmitToStreamer(*OutStreamer, TmpInst);
632 EmitToStreamer(*OutStreamer, TmpInst);
651 MOSymbol = GetCPISymbol(MO.
getIndex());
653 MOSymbol = GetJTISymbol(MO.
getIndex());
663 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
674 EmitToStreamer(*OutStreamer, TmpInst);
695 MOSymbol = GetCPISymbol(MO.
getIndex());
697 MOSymbol = GetJTISymbol(MO.
getIndex());
701 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
707 EmitToStreamer(*OutStreamer, TmpInst);
711 case PPC::ADDIStocHA: {
723 "Invalid operand for ADDIStocHA!");
725 bool GlobalToc =
false;
730 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
732 }
else if (MO.
isCPI()) {
733 MOSymbol = GetCPISymbol(MO.
getIndex());
734 }
else if (MO.
isJTI()) {
735 MOSymbol = GetJTISymbol(MO.
getIndex());
742 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
755 EmitToStreamer(*OutStreamer, TmpInst);
769 "Invalid operand for LDtocL!");
773 MOSymbol = lookUpOrCreateTOCEntry(GetJTISymbol(MO.
getIndex()));
776 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
778 else if (MO.
isCPI()) {
779 MOSymbol = GetCPISymbol(MO.
getIndex());
781 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
787 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
789 "LDtocL used on symbol that could be accessed directly is " 790 "invalid. Must match ADDIStocHA."));
791 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
798 EmitToStreamer(*OutStreamer, TmpInst);
801 case PPC::ADDItocL: {
815 LLVM_DEBUG(
unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
817 "Interposable definitions must use indirect access."));
819 }
else if (MO.
isCPI()) {
820 MOSymbol = GetCPISymbol(MO.
getIndex());
827 EmitToStreamer(*OutStreamer, TmpInst);
830 case PPC::ADDISgotTprelHA: {
833 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
837 const MCExpr *SymGotTprel =
843 .addExpr(SymGotTprel));
846 case PPC::LDgotTprelL:
847 case PPC::LDgotTprelL32: {
860 EmitToStreamer(*OutStreamer, TmpInst);
864 case PPC::PPC32PICGOT: {
865 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
866 MCSymbol *GOTRef = OutContext.createTempSymbol();
867 MCSymbol *NextInstr = OutContext.createTempSymbol();
877 OutStreamer->EmitLabel(GOTRef);
878 OutStreamer->EmitValue(OffsExpr, 4);
879 OutStreamer->EmitLabel(NextInstr);
892 case PPC::PPC32GOT: {
894 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
901 .addExpr(SymGotTlsL));
905 .addExpr(SymGotTlsHA));
908 case PPC::ADDIStlsgdHA: {
911 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
915 const MCExpr *SymGotTlsGD =
921 .addExpr(SymGotTlsGD));
924 case PPC::ADDItlsgdL:
927 case PPC::ADDItlsgdL32: {
937 EmitToStreamer(*OutStreamer,
941 .addExpr(SymGotTlsGD));
944 case PPC::GETtlsADDR:
947 case PPC::GETtlsADDR32: {
953 case PPC::ADDIStlsldHA: {
956 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
960 const MCExpr *SymGotTlsLD =
966 .addExpr(SymGotTlsLD));
969 case PPC::ADDItlsldL:
972 case PPC::ADDItlsldL32: {
982 EmitToStreamer(*OutStreamer,
986 .addExpr(SymGotTlsLD));
989 case PPC::GETtlsldADDR:
992 case PPC::GETtlsldADDR32: {
998 case PPC::ADDISdtprelHA:
1001 case PPC::ADDISdtprelHA32: {
1007 const MCExpr *SymDtprel =
1012 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
1015 .addExpr(SymDtprel));
1018 case PPC::ADDIdtprelL:
1021 case PPC::ADDIdtprelL32: {
1027 const MCExpr *SymDtprel =
1030 EmitToStreamer(*OutStreamer,
1031 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
1034 .addExpr(SymDtprel));
1039 if (!Subtarget->hasMFOCRF()) {
1042 unsigned NewOpcode =
1053 if (!Subtarget->hasMFOCRF()) {
1056 unsigned NewOpcode =
1057 MI->
getOpcode() == PPC::MTOCRF ? PPC::MTCRF : PPC::MTCRF8;
1058 unsigned Mask = 0x80 >> OutContext.getRegisterInfo()
1078 if (!Subtarget->isDarwin()) {
1079 unsigned OpNum = (MI->
getOpcode() == PPC::STD) ? 2 : 1;
1090 EmitToStreamer(*OutStreamer, TmpInst);
1093 void PPCLinuxAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
1094 if (!Subtarget->isPPC64())
1095 return PPCAsmPrinter::EmitInstruction(MI);
1099 return PPCAsmPrinter::EmitInstruction(MI);
1100 case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
1112 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1113 MCSymbol *EndOfSled = OutContext.createTempSymbol();
1114 OutStreamer->EmitLabel(BeginOfSled);
1115 EmitToStreamer(*OutStreamer,
1121 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1122 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1123 EmitToStreamer(*OutStreamer,
1126 OutContext.getOrCreateSymbol(
"__xray_FunctionEntry"),
1128 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1129 OutStreamer->EmitLabel(EndOfSled);
1130 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_ENTER);
1133 case TargetOpcode::PATCHABLE_RET: {
1137 for (
const auto &MO :
1145 if (RetOpcode == PPC::BCCLR) {
1146 IsConditional =
true;
1147 }
else if (RetOpcode == PPC::TCRETURNdi8 || RetOpcode == PPC::TCRETURNri8 ||
1148 RetOpcode == PPC::TCRETURNai8) {
1150 }
else if (RetOpcode == PPC::BLR8 || RetOpcode == PPC::TAILB8) {
1151 IsConditional =
false;
1153 EmitToStreamer(*OutStreamer, RetInst);
1158 if (IsConditional) {
1177 FallthroughLabel = OutContext.createTempSymbol();
1200 OutStreamer->EmitCodeAlignment(8);
1201 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1202 OutStreamer->EmitLabel(BeginOfSled);
1203 EmitToStreamer(*OutStreamer, RetInst);
1207 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1208 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1209 EmitToStreamer(*OutStreamer,
1212 OutContext.getOrCreateSymbol(
"__xray_FunctionExit"),
1214 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1215 EmitToStreamer(*OutStreamer, RetInst);
1217 OutStreamer->EmitLabel(FallthroughLabel);
1218 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_EXIT);
1221 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
1223 case TargetOpcode::PATCHABLE_TAIL_CALL:
1227 "around this assert.");
1231 void PPCLinuxAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1232 if (static_cast<const PPCTargetMachine &>(
TM).isELFv2ABI()) {
1240 if (static_cast<const PPCTargetMachine &>(
TM).isPPC64() ||
1241 !isPositionIndependent())
1247 OutStreamer->SwitchSection(OutContext.getELFSection(
1250 MCSymbol *TOCSym = OutContext.getOrCreateSymbol(
Twine(
".LTOC"));
1251 MCSymbol *CurrentPos = OutContext.createTempSymbol();
1253 OutStreamer->EmitLabel(CurrentPos);
1262 OutStreamer->EmitAssignment(TOCSym, tocExpr);
1264 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1267 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
1269 if (!Subtarget->isPPC64() &&
1270 (!isPositionIndependent() ||
1274 if (!Subtarget->isPPC64()) {
1276 if (PPCFI->
usesPICBase() && !Subtarget->isSecurePlt()) {
1278 MCSymbol *PICBase = MF->getPICBaseSymbol();
1279 OutStreamer->EmitLabel(RelocSymbol);
1287 OutStreamer->EmitValue(OffsExpr, 4);
1288 OutStreamer->EmitLabel(CurrentFnSym);
1295 if (Subtarget->isELFv2ABI()) {
1301 && !MF->getRegInfo().use_empty(PPC::X2)) {
1306 const MCExpr *TOCDeltaExpr =
1313 OutStreamer->EmitValue(TOCDeltaExpr, 8);
1322 OutStreamer->SwitchSection(Section);
1323 OutStreamer->EmitLabel(CurrentFnSym);
1324 OutStreamer->EmitValueToAlignment(8);
1325 MCSymbol *Symbol1 = CurrentFnSymForSize;
1332 OutStreamer->EmitValue(
1336 OutStreamer->EmitIntValue(0, 8 );
1337 OutStreamer->SwitchSection(Current.first, Current.second);
1340 bool PPCLinuxAsmPrinter::doFinalization(
Module &M) {
1352 Section = OutStreamer->getContext().getELFSection(
1355 Section = OutStreamer->getContext().getELFSection(
1357 OutStreamer->SwitchSection(Section);
1360 E = TOC.end();
I !=
E; ++
I) {
1361 OutStreamer->EmitLabel(
I->second);
1366 OutStreamer->EmitValueToAlignment(4);
1367 OutStreamer->EmitSymbolValue(S, 4);
1376 void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
1408 if (Subtarget->isELFv2ABI()
1410 && !MF->getRegInfo().use_empty(PPC::X2)) {
1417 OutStreamer->EmitLabel(GlobalEntryLabel);
1423 const MCExpr *TOCDeltaExpr =
1425 GlobalEntryLabelExp, OutContext);
1427 const MCExpr *TOCDeltaHi =
1432 .addExpr(TOCDeltaHi));
1434 const MCExpr *TOCDeltaLo =
1439 .addExpr(TOCDeltaLo));
1442 const MCExpr *TOCOffsetDeltaExpr =
1444 GlobalEntryLabelExp, OutContext);
1448 .addExpr(TOCOffsetDeltaExpr)
1457 OutStreamer->EmitLabel(LocalEntryLabel);
1460 const MCExpr *LocalOffsetExp =
1462 GlobalEntryLabelExp, OutContext);
1468 TS->
emitLocalEntry(cast<MCSymbolELF>(CurrentFnSym), LocalOffsetExp);
1475 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
1483 if (Subtarget->isPPC64()) {
1484 OutStreamer->EmitIntValue(0, 4);
1485 OutStreamer->EmitIntValue(0, 8);
1489 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1490 static const char *
const CPUDirectives[] = {
1535 "CPUDirectives[] might not be up-to-date!");
1546 OutStreamer->SwitchSection(
1547 OutContext.getMachOSection(
"__TEXT",
"__picsymbolstub1",
1552 OutStreamer->SwitchSection(
1553 OutContext.getMachOSection(
"__TEXT",
"__symbol_stub1",
1558 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1561 bool PPCDarwinAsmPrinter::doFinalization(
Module &M) {
1562 bool isPPC64 = getDataLayout().getPointerSizeInBits() == 64;
1571 if (MAI->doesSupportExceptionHandling()) {
1574 for (
const Function *Personality : MMI->getPersonalities()) {
1577 getSymbolWithGlobalValueBase(Personality,
"$non_lazy_ptr");
1590 if (!Stubs.empty()) {
1593 EmitAlignment(isPPC64 ? 3 : 2);
1595 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1597 OutStreamer->EmitLabel(Stubs[i].
first);
1600 OutStreamer->EmitSymbolAttribute(MCSym.
getPointer(),
1605 OutStreamer->EmitIntValue(0, isPPC64 ? 8 : 4 );
1614 OutStreamer->EmitValue(
1620 OutStreamer->AddBlankLine();
1640 std::unique_ptr<MCStreamer> &&Streamer) {
1642 return new PPCDarwinAsmPrinter(tm, std::move(Streamer));
1643 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.
MachineBasicBlock * getMBB() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This class represents lattice values for constants.
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)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.
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)
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset)=0
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()
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)
bool hasInternalLinkage() const
Address of a basic block.
static bool isDarwin(object::Archive::Kind Kind)
.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.
static unsigned getRegNumForOperand(const MCInstrDesc &Desc, unsigned Reg, unsigned OpNo)
getRegNumForOperand - some operands use different numbering schemes for the same registers.
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
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
static SectionKind getText()