72 #define DEBUG_TYPE "asmprinter"
84 std::unique_ptr<MCStreamer> Streamer)
85 :
AsmPrinter(TM, std::move(Streamer)), SM(*
this) {}
87 StringRef getPassName()
const override {
return "PowerPC Assembly Printer"; }
91 bool doInitialization(
Module &M)
override {
101 bool PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
102 unsigned AsmVariant,
const char *ExtraCode,
104 bool PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
105 unsigned AsmVariant,
const char *ExtraCode,
108 void EmitEndOfAsmFile(
Module &M)
override;
122 class PPCLinuxAsmPrinter :
public PPCAsmPrinter {
125 std::unique_ptr<MCStreamer> Streamer)
126 : PPCAsmPrinter(TM, std::move(Streamer)) {}
129 return "Linux PPC Assembly Printer";
132 bool doFinalization(
Module &M)
override;
133 void EmitStartOfAsmFile(
Module &M)
override;
135 void EmitFunctionEntryLabel()
override;
137 void EmitFunctionBodyStart()
override;
138 void EmitFunctionBodyEnd()
override;
144 class PPCDarwinAsmPrinter :
public PPCAsmPrinter {
147 std::unique_ptr<MCStreamer> Streamer)
148 : PPCAsmPrinter(TM, std::move(Streamer)) {}
151 return "Darwin PPC Assembly Printer";
154 bool doFinalization(
Module &M)
override;
155 void EmitStartOfAsmFile(
Module &M)
override;
163 switch (RegName[0]) {
168 if (RegName[1] ==
's')
171 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
195 Reg = PPC::VSX32 + (Reg - PPC::V0);
197 Reg = PPC::VSX32 + (Reg - PPC::VF0);
203 if (!Subtarget->isDarwin())
228 if (Subtarget->hasLazyResolverStub(GV)) {
229 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
240 SymToPrint->
print(O, MAI);
254 bool PPCAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
258 if (ExtraCode && ExtraCode[0]) {
259 if (ExtraCode[1] != 0)
return true;
261 switch (ExtraCode[0]) {
292 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) {
343 SM.serializeToStackMapSection();
350 assert(NumNOPBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
356 while (NumNOPBytes > 0) {
357 if (MII == MBB.
end() || MII->isCall() ||
358 MII->getOpcode() == PPC::DBG_VALUE ||
359 MII->getOpcode() == TargetOpcode::PATCHPOINT ||
360 MII->getOpcode() == TargetOpcode::STACKMAP)
367 for (
unsigned i = 0; i < NumNOPBytes; i += 4)
377 unsigned EncodedBytes = 0;
380 if (CalleeMO.
isImm()) {
381 int64_t CallTarget = CalleeMO.
getImm();
383 assert((CallTarget & 0xFFFFFFFFFFFF) == CallTarget &&
384 "High 16 bits of call target should be zero.");
390 .addImm((CallTarget >> 32) & 0xFFFF));
395 .addImm(32).addImm(16));
400 .addImm((CallTarget >> 16) & 0xFFFF));
405 .addImm(CallTarget & 0xFFFF));
408 int TOCSaveOffset = Subtarget->getFrameLowering()->getTOCSaveOffset();
411 .addImm(TOCSaveOffset)
417 if (!Subtarget->isELFv2ABI()) {
424 .addReg(ScratchReg));
429 .addReg(ScratchReg));
434 .addReg(ScratchReg));
442 .addImm(TOCSaveOffset)
460 unsigned NumBytes = Opers.getNumPatchBytes();
461 assert(NumBytes >= EncodedBytes &&
462 "Patchpoint can't request size less than the length of a call.");
463 assert((NumBytes - EncodedBytes) % 4 == 0 &&
464 "Invalid number of NOP bytes requested!");
465 for (
unsigned i = EncodedBytes; i < NumBytes; i += 4)
474 MCSymbol *TlsGetAddr = OutContext.getOrCreateSymbol(Name);
480 "GETtls[ld]ADDR[32] must define GPR3");
484 "GETtls[ld]ADDR[32] must read GPR3");
486 if (!Subtarget->isPPC64() && !Subtarget->isDarwin() &&
487 isPositionIndependent())
495 EmitToStreamer(*OutStreamer,
497 PPC::BL8_NOP_TLS : PPC::BL_TLS)
505 void PPCAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
507 bool isPPC64 = Subtarget->isPPC64();
508 bool isDarwin =
TM.getTargetTriple().isOSDarwin();
515 case TargetOpcode::DBG_VALUE:
517 case TargetOpcode::STACKMAP:
518 return LowerSTACKMAP(SM, *MI);
519 case TargetOpcode::PATCHPOINT:
520 return LowerPATCHPOINT(SM, *MI);
522 case PPC::MoveGOTtoLR: {
530 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
539 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::BL).addExpr(OffsExpr));
542 case PPC::MovePCtoLR:
543 case PPC::MovePCtoLR8: {
548 MCSymbol *PICBase = MF->getPICBaseSymbol();
551 EmitToStreamer(*OutStreamer,
558 OutStreamer->EmitLabel(PICBase);
561 case PPC::UpdateGBR: {
584 EmitToStreamer(*OutStreamer, TmpInst);
590 EmitToStreamer(*OutStreamer, TmpInst);
608 MOSymbol = GetCPISymbol(MO.
getIndex());
610 MOSymbol = GetJTISymbol(MO.
getIndex());
620 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
631 EmitToStreamer(*OutStreamer, TmpInst);
652 MOSymbol = GetCPISymbol(MO.
getIndex());
654 MOSymbol = GetJTISymbol(MO.
getIndex());
658 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
664 EmitToStreamer(*OutStreamer, TmpInst);
668 case PPC::ADDIStocHA: {
680 "Invalid operand for ADDIStocHA!");
682 bool GlobalToc =
false;
687 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
689 }
else if (MO.
isCPI()) {
690 MOSymbol = GetCPISymbol(MO.
getIndex());
691 }
else if (MO.
isJTI()) {
692 MOSymbol = GetJTISymbol(MO.
getIndex());
699 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
712 EmitToStreamer(*OutStreamer, TmpInst);
726 "Invalid operand for LDtocL!");
730 MOSymbol = lookUpOrCreateTOCEntry(GetJTISymbol(MO.
getIndex()));
733 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
735 else if (MO.
isCPI()) {
736 MOSymbol = GetCPISymbol(MO.
getIndex());
738 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
744 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
746 "LDtocL used on symbol that could be accessed directly is "
747 "invalid. Must match ADDIStocHA."));
748 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
755 EmitToStreamer(*OutStreamer, TmpInst);
758 case PPC::ADDItocL: {
773 unsigned char GVFlags = Subtarget->classifyGlobalReference(GV);
776 "Interposable definitions must use indirect access."));
778 }
else if (MO.
isCPI()) {
779 MOSymbol = GetCPISymbol(MO.
getIndex());
786 EmitToStreamer(*OutStreamer, TmpInst);
789 case PPC::ADDISgotTprelHA: {
792 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
796 const MCExpr *SymGotTprel =
802 .addExpr(SymGotTprel));
805 case PPC::LDgotTprelL:
806 case PPC::LDgotTprelL32: {
819 EmitToStreamer(*OutStreamer, TmpInst);
823 case PPC::PPC32PICGOT: {
824 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
825 MCSymbol *GOTRef = OutContext.createTempSymbol();
826 MCSymbol *NextInstr = OutContext.createTempSymbol();
836 OutStreamer->EmitLabel(GOTRef);
837 OutStreamer->EmitValue(OffsExpr, 4);
838 OutStreamer->EmitLabel(NextInstr);
851 case PPC::PPC32GOT: {
853 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
860 .addExpr(SymGotTlsL));
864 .addExpr(SymGotTlsHA));
867 case PPC::ADDIStlsgdHA: {
870 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
874 const MCExpr *SymGotTlsGD =
880 .addExpr(SymGotTlsGD));
883 case PPC::ADDItlsgdL:
886 case PPC::ADDItlsgdL32: {
896 EmitToStreamer(*OutStreamer,
900 .addExpr(SymGotTlsGD));
903 case PPC::GETtlsADDR:
906 case PPC::GETtlsADDR32: {
912 case PPC::ADDIStlsldHA: {
915 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
919 const MCExpr *SymGotTlsLD =
925 .addExpr(SymGotTlsLD));
928 case PPC::ADDItlsldL:
931 case PPC::ADDItlsldL32: {
941 EmitToStreamer(*OutStreamer,
945 .addExpr(SymGotTlsLD));
948 case PPC::GETtlsldADDR:
951 case PPC::GETtlsldADDR32: {
957 case PPC::ADDISdtprelHA:
960 case PPC::ADDISdtprelHA32: {
971 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
974 .addExpr(SymDtprel));
977 case PPC::ADDIdtprelL:
980 case PPC::ADDIdtprelL32: {
989 EmitToStreamer(*OutStreamer,
993 .addExpr(SymDtprel));
998 if (!Subtarget->hasMFOCRF()) {
1001 unsigned NewOpcode =
1012 if (!Subtarget->hasMFOCRF()) {
1015 unsigned NewOpcode =
1016 MI->
getOpcode() == PPC::MTOCRF ? PPC::MTCRF : PPC::MTCRF8;
1017 unsigned Mask = 0x80 >> OutContext.getRegisterInfo()
1037 if (!Subtarget->isDarwin()) {
1038 unsigned OpNum = (MI->
getOpcode() == PPC::STD) ? 2 : 1;
1049 EmitToStreamer(*OutStreamer, TmpInst);
1052 void PPCLinuxAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
1053 if (!Subtarget->isPPC64())
1054 return PPCAsmPrinter::EmitInstruction(MI);
1058 return PPCAsmPrinter::EmitInstruction(MI);
1059 case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
1071 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1072 MCSymbol *EndOfSled = OutContext.createTempSymbol();
1073 OutStreamer->EmitLabel(BeginOfSled);
1074 EmitToStreamer(*OutStreamer,
1080 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1081 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1082 EmitToStreamer(*OutStreamer,
1085 OutContext.getOrCreateSymbol(
"__xray_FunctionEntry"),
1087 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1088 OutStreamer->EmitLabel(EndOfSled);
1089 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_ENTER);
1092 case TargetOpcode::PATCHABLE_FUNCTION_EXIT: {
1113 OutStreamer->EmitCodeAlignment(8);
1114 MCSymbol *BeginOfSled = OutContext.createTempSymbol();
1115 OutStreamer->EmitLabel(BeginOfSled);
1118 EmitToStreamer(*OutStreamer, TmpInst);
1122 MCInstBuilder(PPC::STD).addReg(PPC::X0).addImm(-8).addReg(PPC::X1));
1123 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR8).addReg(PPC::X0));
1124 EmitToStreamer(*OutStreamer,
1127 OutContext.getOrCreateSymbol(
"__xray_FunctionExit"),
1129 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR8).addReg(PPC::X0));
1130 recordSled(BeginOfSled, *MI, SledKind::FUNCTION_EXIT);
1133 case TargetOpcode::PATCHABLE_TAIL_CALL:
1134 case TargetOpcode::PATCHABLE_RET:
1139 "around this assert.");
1143 void PPCLinuxAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1144 if (static_cast<const PPCTargetMachine &>(
TM).isELFv2ABI()) {
1152 if (static_cast<const PPCTargetMachine &>(
TM).isPPC64() ||
1153 !isPositionIndependent())
1159 OutStreamer->SwitchSection(OutContext.getELFSection(
1162 MCSymbol *TOCSym = OutContext.getOrCreateSymbol(
Twine(
".LTOC"));
1163 MCSymbol *CurrentPos = OutContext.createTempSymbol();
1165 OutStreamer->EmitLabel(CurrentPos);
1174 OutStreamer->EmitAssignment(TOCSym, tocExpr);
1176 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1179 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
1181 if (!Subtarget->isPPC64() &&
1182 (!isPositionIndependent() ||
1186 if (!Subtarget->isPPC64()) {
1190 MCSymbol *PICBase = MF->getPICBaseSymbol();
1191 OutStreamer->EmitLabel(RelocSymbol);
1199 OutStreamer->EmitValue(OffsExpr, 4);
1200 OutStreamer->EmitLabel(CurrentFnSym);
1207 if (Subtarget->isELFv2ABI()) {
1213 && !MF->getRegInfo().use_empty(PPC::X2)) {
1218 const MCExpr *TOCDeltaExpr =
1225 OutStreamer->EmitValue(TOCDeltaExpr, 8);
1234 OutStreamer->SwitchSection(Section);
1235 OutStreamer->EmitLabel(CurrentFnSym);
1236 OutStreamer->EmitValueToAlignment(8);
1237 MCSymbol *Symbol1 = CurrentFnSymForSize;
1244 OutStreamer->EmitValue(
1248 OutStreamer->EmitIntValue(0, 8 );
1249 OutStreamer->SwitchSection(Current.first, Current.second);
1252 bool PPCLinuxAsmPrinter::doFinalization(
Module &M) {
1264 Section = OutStreamer->getContext().getELFSection(
1267 Section = OutStreamer->getContext().getELFSection(
1269 OutStreamer->SwitchSection(Section);
1272 E = TOC.end();
I !=
E; ++
I) {
1273 OutStreamer->EmitLabel(
I->second);
1278 OutStreamer->EmitValueToAlignment(4);
1279 OutStreamer->EmitSymbolValue(S, 4);
1288 void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
1320 if (Subtarget->isELFv2ABI()
1322 && !MF->getRegInfo().use_empty(PPC::X2)) {
1329 OutStreamer->EmitLabel(GlobalEntryLabel);
1335 const MCExpr *TOCDeltaExpr =
1337 GlobalEntryLabelExp, OutContext);
1339 const MCExpr *TOCDeltaHi =
1344 .addExpr(TOCDeltaHi));
1346 const MCExpr *TOCDeltaLo =
1351 .addExpr(TOCDeltaLo));
1354 const MCExpr *TOCOffsetDeltaExpr =
1356 GlobalEntryLabelExp, OutContext);
1360 .addExpr(TOCOffsetDeltaExpr)
1369 OutStreamer->EmitLabel(LocalEntryLabel);
1372 const MCExpr *LocalOffsetExp =
1374 GlobalEntryLabelExp, OutContext);
1380 TS->
emitLocalEntry(cast<MCSymbolELF>(CurrentFnSym), LocalOffsetExp);
1387 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
1395 if (Subtarget->isPPC64()) {
1396 OutStreamer->EmitIntValue(0, 4);
1397 OutStreamer->EmitIntValue(0, 8);
1401 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1402 static const char *
const CPUDirectives[] = {
1446 "CPUDirectives[] might not be up-to-date!");
1457 OutStreamer->SwitchSection(
1458 OutContext.getMachOSection(
"__TEXT",
"__picsymbolstub1",
1463 OutStreamer->SwitchSection(
1464 OutContext.getMachOSection(
"__TEXT",
"__symbol_stub1",
1469 OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1472 bool PPCDarwinAsmPrinter::doFinalization(
Module &M) {
1473 bool isPPC64 = getDataLayout().getPointerSizeInBits() == 64;
1482 if (MAI->doesSupportExceptionHandling()) {
1485 for (
const Function *Personality : MMI->getPersonalities()) {
1488 getSymbolWithGlobalValueBase(Personality,
"$non_lazy_ptr");
1501 if (!Stubs.empty()) {
1504 EmitAlignment(isPPC64 ? 3 : 2);
1506 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1508 OutStreamer->EmitLabel(Stubs[i].
first);
1511 OutStreamer->EmitSymbolAttribute(MCSym.
getPointer(),
1516 OutStreamer->EmitIntValue(0, isPPC64 ? 8 : 4 );
1525 OutStreamer->EmitValue(
1531 OutStreamer->AddBlankLine();
1551 std::unique_ptr<MCStreamer> &&Streamer) {
1553 return new PPCDarwinAsmPrinter(tm, std::move(Streamer));
1554 return new PPCLinuxAsmPrinter(tm, std::move(Streamer));
MCSection * getNonLazySymbolPointerSection() 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. ...
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
StringRef getPrivateGlobalPrefix() const
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
const GlobalValue * getGlobal() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
MachineBasicBlock * getMBB() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
bool doFinalization(Module &M) override
Shut down the asmprinter.
static MCOperand createExpr(const MCExpr *Val)
Target & getThePPC32Target()
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
This class implements a map that also provides access to all stored values in a deterministic order...
MachineBasicBlock reference.
MCSymbol * getGlobalEPSymbol() const
const Triple & getTargetTriple() const
static bool isVRRegister(unsigned Reg)
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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...
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool hasInternalLinkage() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
MCSymbol * getTOCOffsetSymbol() const
Represent a reference to a symbol from inside an expression.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
static std::string getRegisterName(const TargetRegisterInfo *TRI, unsigned Reg)
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)
PointerTy getPointer() const
R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset)=0
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.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
Address of a global value.
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
PointerIntPair - This class implements a pair of a pointer and small integer.
MO_NLP_FLAG - If this bit is set, the symbol reference is actually to the non_lazy_ptr for the global...
void LLVMInitializePowerPCAsmPrinter()
const MachineOperand & getOperand(unsigned i) 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...
This class is intended to be used as a driving class for all asm writers.
static const char * getRegisterName(unsigned RegNo)
Address of a basic block.
.subsections_via_symbols (MachO)
int64_t getOffset() const
Return the offset from the symbol in this operand.
MI-level patchpoint operands.
static const PPCMCExpr * createLo(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
MCSection * getTextCoalSection() const
MCSymbol * getLocalEPSymbol() const
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
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...
void setOpcode(unsigned Op)
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
PICLevel::Level getPICLevel() const
Returns the PIC level (small or large model)
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
typename VectorType::iterator iterator
static bool isVFRegister(unsigned Reg)
std::vector< std::pair< MCSymbol *, StubValueTy >> SymbolListTy
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)
llvm_unreachable("Unknown RegBank!")
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
This represents a section on linux, lots of unix variants and some bare metal systems.
virtual void EmitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
bool isPPC64() const
isPPC64 - Return true if we are generating code for 64-bit pointer mode.
unsigned getReg() const
getReg - Returns the register number.
unsigned getAlignment() 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
The VSX instruction that uses VSX register (vs0-vs63), instead of VMX register (v0-v31).
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)
unsigned getDarwinDirective() const
getDarwinDirective - Returns the -m directive specified for the cpu.
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)
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn)
RegisterAsmPrinter - Register an AsmPrinter implementation for the given target.
StringRef - Represent a constant reference to a string, i.e.
const BlockAddress * getBlockAddress() const
Address of indexed Constant in Constant Pool.
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
virtual void emitMachine(StringRef CPU)=0
Instances of this class represent operands of the MCInst class.
MCSymbol * getPICOffsetSymbol() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
const MCOperand & getOperand(unsigned i) 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 SectionKind getText()