65 #define DEBUG_TYPE "asmprinter"
75 std::unique_ptr<MCStreamer> Streamer)
76 :
AsmPrinter(TM, std::move(Streamer)), SM(*
this) {}
78 const char *getPassName()
const override {
79 return "PowerPC Assembly Printer";
88 bool PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
89 unsigned AsmVariant,
const char *ExtraCode,
91 bool PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
92 unsigned AsmVariant,
const char *ExtraCode,
95 void EmitEndOfAsmFile(
Module &M)
override;
109 class PPCLinuxAsmPrinter :
public PPCAsmPrinter {
112 std::unique_ptr<MCStreamer> Streamer)
113 : PPCAsmPrinter(TM, std::move(Streamer)) {}
115 const char *getPassName()
const override {
116 return "Linux PPC Assembly Printer";
119 bool doFinalization(
Module &M)
override;
120 void EmitStartOfAsmFile(
Module &M)
override;
122 void EmitFunctionEntryLabel()
override;
124 void EmitFunctionBodyStart()
override;
125 void EmitFunctionBodyEnd()
override;
130 class PPCDarwinAsmPrinter :
public PPCAsmPrinter {
133 std::unique_ptr<MCStreamer> Streamer)
134 : PPCAsmPrinter(TM, std::move(Streamer)) {}
136 const char *getPassName()
const override {
137 return "Darwin PPC Assembly Printer";
140 bool doFinalization(
Module &M)
override;
141 void EmitStartOfAsmFile(
Module &M)
override;
150 switch (RegName[0]) {
155 if (RegName[1] ==
's')
158 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
174 if (!Subtarget->isDarwin())
202 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
205 .getGVStubEntry(SymToPrint);
211 SymToPrint = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr");
215 getHiddenGVStubEntry(SymToPrint);
220 SymToPrint = getSymbol(GV);
223 SymToPrint = getSymbol(GV);
226 SymToPrint->
print(O, MAI);
240 bool PPCAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
244 if (ExtraCode && ExtraCode[0]) {
245 if (ExtraCode[1] != 0)
return true;
247 switch (ExtraCode[0]) {
278 bool PPCAsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNo,
280 const char *ExtraCode,
282 if (ExtraCode && ExtraCode[0]) {
283 if (ExtraCode[1] != 0)
return true;
285 switch (ExtraCode[0]) {
286 default:
return true;
289 const char *RegName =
"r0";
290 if (!Subtarget->isDarwin())
292 O << RegName <<
", ";
325 TOCEntry = createTempSymbol(
"C");
329 void PPCAsmPrinter::EmitEndOfAsmFile(
Module &M) {
330 SM.serializeToStackMapSection();
338 assert(NumNOPBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
344 while (NumNOPBytes > 0) {
345 if (MII == MBB.
end() || MII->isCall() ||
355 for (
unsigned i = 0; i < NumNOPBytes; i += 4)
366 unsigned EncodedBytes = 0;
370 if (CalleeMO.
isImm()) {
373 assert((CallTarget & 0xFFFFFFFFFFFF) == CallTarget &&
374 "High 16 bits of call target should be zero.");
380 .addImm((CallTarget >> 32) & 0xFFFF));
385 .addImm(32).addImm(16));
390 .addImm((CallTarget >> 16) & 0xFFFF));
395 .addImm(CallTarget & 0xFFFF));
398 int TOCSaveOffset = Subtarget->isELFv2ABI() ? 24 : 40;
401 .addImm(TOCSaveOffset)
408 if (!Subtarget->isELFv2ABI()) {
415 .addReg(ScratchReg));
420 .addReg(ScratchReg));
425 .addReg(ScratchReg));
433 .addImm(TOCSaveOffset)
439 MCSymbol *MOSymbol = getSymbol(GValue);
452 assert(NumBytes >= EncodedBytes &&
453 "Patchpoint can't request size less than the length of a call.");
454 assert((NumBytes - EncodedBytes) % 4 == 0 &&
455 "Invalid number of NOP bytes requested!");
456 for (
unsigned i = EncodedBytes; i < NumBytes; i += 4)
465 MCSymbol *TlsGetAddr = OutContext.getOrCreateSymbol(Name);
471 "GETtls[ld]ADDR[32] must define GPR3");
475 "GETtls[ld]ADDR[32] must read GPR3");
477 if (!Subtarget->isPPC64() && !Subtarget->isDarwin() &&
484 MCSymbol *MOSymbol = getSymbol(GValue);
486 EmitToStreamer(*OutStreamer,
488 PPC::BL8_NOP_TLS : PPC::BL_TLS)
496 void PPCAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
498 bool isPPC64 = Subtarget->isPPC64();
499 bool isDarwin =
TM.getTargetTriple().isOSDarwin();
509 return LowerSTACKMAP(*OutStreamer, SM, *MI);
511 return LowerPATCHPOINT(*OutStreamer, SM, *MI);
513 case PPC::MoveGOTtoLR: {
521 OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
530 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::BL).addExpr(OffsExpr));
533 case PPC::MovePCtoLR:
534 case PPC::MovePCtoLR8: {
539 MCSymbol *PICBase = MF->getPICBaseSymbol();
551 case PPC::UpdateGBR: {
574 EmitToStreamer(*OutStreamer, TmpInst);
580 EmitToStreamer(*OutStreamer, TmpInst);
598 MOSymbol = GetCPISymbol(MO.
getIndex());
600 MOSymbol = GetJTISymbol(MO.
getIndex());
610 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
621 EmitToStreamer(*OutStreamer, TmpInst);
642 MOSymbol = GetCPISymbol(MO.
getIndex());
644 MOSymbol = GetJTISymbol(MO.
getIndex());
648 MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
654 EmitToStreamer(*OutStreamer, TmpInst);
658 case PPC::ADDIStocHA: {
670 "Invalid operand for ADDIStocHA!");
672 bool IsExternal =
false;
673 bool IsNonLocalFunction =
false;
674 bool IsCommon =
false;
675 bool IsAvailExt =
false;
679 MOSymbol = getSymbol(GV);
685 }
else if (MO.
isCPI())
686 MOSymbol = GetCPISymbol(MO.
getIndex());
688 MOSymbol = GetJTISymbol(MO.
getIndex());
692 if (IsExternal || IsNonLocalFunction || IsCommon || IsAvailExt ||
695 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
701 EmitToStreamer(*OutStreamer, TmpInst);
715 "Invalid operand for LDtocL!");
719 MOSymbol = lookUpOrCreateTOCEntry(GetJTISymbol(MO.
getIndex()));
722 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
724 else if (MO.
isCPI()) {
725 MOSymbol = GetCPISymbol(MO.
getIndex());
727 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
731 MOSymbol = getSymbol(GValue);
736 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
743 EmitToStreamer(*OutStreamer, TmpInst);
746 case PPC::ADDItocL: {
755 assert((MO.
isGlobal() || MO.
isCPI()) &&
"Invalid operand for ADDItocL");
757 bool IsExternal =
false;
758 bool IsNonLocalFunction =
false;
762 MOSymbol = getSymbol(GV);
766 }
else if (MO.
isCPI())
767 MOSymbol = GetCPISymbol(MO.
getIndex());
769 if (IsNonLocalFunction || IsExternal ||
771 MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
777 EmitToStreamer(*OutStreamer, TmpInst);
780 case PPC::ADDISgotTprelHA: {
783 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
786 MCSymbol *MOSymbol = getSymbol(GValue);
787 const MCExpr *SymGotTprel =
793 .addExpr(SymGotTprel));
796 case PPC::LDgotTprelL:
797 case PPC::LDgotTprelL32: {
805 MCSymbol *MOSymbol = getSymbol(GValue);
810 EmitToStreamer(*OutStreamer, TmpInst);
814 case PPC::PPC32PICGOT: {
815 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
816 MCSymbol *GOTRef = OutContext.createTempSymbol();
817 MCSymbol *NextInstr = OutContext.createTempSymbol();
842 case PPC::PPC32GOT: {
843 MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(
StringRef(
"_GLOBAL_OFFSET_TABLE_"));
844 const MCExpr *SymGotTlsL =
847 const MCExpr *SymGotTlsHA =
852 .addExpr(SymGotTlsL));
856 .addExpr(SymGotTlsHA));
859 case PPC::ADDIStlsgdHA: {
862 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
865 MCSymbol *MOSymbol = getSymbol(GValue);
866 const MCExpr *SymGotTlsGD =
872 .addExpr(SymGotTlsGD));
875 case PPC::ADDItlsgdL:
878 case PPC::ADDItlsgdL32: {
883 MCSymbol *MOSymbol = getSymbol(GValue);
888 EmitToStreamer(*OutStreamer,
892 .addExpr(SymGotTlsGD));
895 case PPC::GETtlsADDR:
898 case PPC::GETtlsADDR32: {
904 case PPC::ADDIStlsldHA: {
907 assert(Subtarget->isPPC64() &&
"Not supported for 32-bit PowerPC");
910 MCSymbol *MOSymbol = getSymbol(GValue);
911 const MCExpr *SymGotTlsLD =
917 .addExpr(SymGotTlsLD));
920 case PPC::ADDItlsldL:
923 case PPC::ADDItlsldL32: {
928 MCSymbol *MOSymbol = getSymbol(GValue);
933 EmitToStreamer(*OutStreamer,
937 .addExpr(SymGotTlsLD));
940 case PPC::GETtlsldADDR:
943 case PPC::GETtlsldADDR32: {
949 case PPC::ADDISdtprelHA:
952 case PPC::ADDISdtprelHA32: {
957 MCSymbol *MOSymbol = getSymbol(GValue);
963 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
965 .addReg(Subtarget->isPPC64() ? PPC::X3 : PPC::R3)
966 .addExpr(SymDtprel));
969 case PPC::ADDIdtprelL:
972 case PPC::ADDIdtprelL32: {
977 MCSymbol *MOSymbol = getSymbol(GValue);
981 EmitToStreamer(*OutStreamer,
985 .addExpr(SymDtprel));
990 if (!Subtarget->hasMFOCRF()) {
1004 if (!Subtarget->hasMFOCRF()) {
1007 unsigned NewOpcode =
1008 MI->
getOpcode() == PPC::MTOCRF ? PPC::MTCRF : PPC::MTCRF8;
1009 unsigned Mask = 0x80 >> OutContext.getRegisterInfo()
1029 if (!Subtarget->isDarwin()) {
1030 unsigned OpNum = (MI->
getOpcode() == PPC::STD) ? 2 : 1;
1041 EmitToStreamer(*OutStreamer, TmpInst);
1044 void PPCLinuxAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1045 if (static_cast<const PPCTargetMachine &>(
TM).isELFv2ABI()) {
1053 if (static_cast<const PPCTargetMachine &>(
TM).isPPC64() ||
1063 MCSymbol *TOCSym = OutContext.getOrCreateSymbol(
Twine(
".LTOC"));
1064 MCSymbol *CurrentPos = OutContext.createTempSymbol();
1077 OutStreamer->
SwitchSection(getObjFileLowering().getTextSection());
1080 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
1082 if (!Subtarget->isPPC64() &&
1087 if (!Subtarget->isPPC64()) {
1091 MCSymbol *PICBase = MF->getPICBaseSymbol();
1108 if (Subtarget->isELFv2ABI())
1118 MCSymbol *Symbol1 = CurrentFnSymForSize;
1134 bool PPCLinuxAsmPrinter::doFinalization(
Module &M) {
1154 E = TOC.end();
I != E; ++
I) {
1168 void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
1185 if (Subtarget->isELFv2ABI()
1187 && !MF->getRegInfo().use_empty(PPC::X2)) {
1189 MCSymbol *GlobalEntryLabel = OutContext.createTempSymbol();
1190 OutStreamer->
EmitLabel(GlobalEntryLabel);
1195 const MCExpr *TOCDeltaExpr =
1197 GlobalEntryLabelExp, OutContext);
1199 const MCExpr *TOCDeltaHi =
1204 .addExpr(TOCDeltaHi));
1206 const MCExpr *TOCDeltaLo =
1211 .addExpr(TOCDeltaLo));
1213 MCSymbol *LocalEntryLabel = OutContext.createTempSymbol();
1214 OutStreamer->
EmitLabel(LocalEntryLabel);
1217 const MCExpr *LocalOffsetExp =
1219 GlobalEntryLabelExp, OutContext);
1225 TS->
emitLocalEntry(cast<MCSymbolELF>(CurrentFnSym), LocalOffsetExp);
1232 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
1240 if (Subtarget->isPPC64()) {
1246 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(
Module &M) {
1247 static const char *
const CPUDirectives[] = {
1286 assert(Directive <=
PPC::DIR_64 &&
"Directive out of range.");
1289 "CPUDirectives[] might not be up-to-date!");
1301 OutContext.getMachOSection(
"__TEXT",
"__picsymbolstub1",
1307 OutContext.getMachOSection(
"__TEXT",
"__symbol_stub1",
1312 OutStreamer->
SwitchSection(getObjFileLowering().getTextSection());
1326 void PPCDarwinAsmPrinter::
1328 bool isPPC64 =
TM.getDataLayout()->getPointerSizeInBits() == 64;
1334 std::unique_ptr<MCSubtargetInfo> STI(
TM.getTarget().createMCSubtargetInfo(
1335 TM.getTargetTriple().str(),
TM.getTargetCPU(),
1336 TM.getTargetFeatureString()));
1349 MCSection *StubSection = OutContext.getMachOSection(
1350 "__TEXT",
"__picsymbolstub1",
1353 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1358 MCSymbol *RawSym = Stubs[i].second.getPointer();
1371 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR).addReg(PPC::R0));
1373 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::BCLalways).addExpr(Anon));
1376 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MFLR).addReg(PPC::R11));
1384 EmitToStreamer(*OutStreamer,
MCInstBuilder(PPC::MTLR).addReg(PPC::R0));
1389 EmitToStreamer(*OutStreamer,
MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
1391 .addExpr(SubLo16).addExpr(SubLo16)
1403 OutContext.getOrCreateSymbol(
StringRef(
"dyld_stub_binding_helper"));
1416 MCSection *StubSection = OutContext.getMachOSection(
1417 "__TEXT",
"__symbol_stub1",
1420 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1422 MCSymbol *RawSym = Stubs[i].second.getPointer();
1432 const MCExpr *LazyPtrHa16 =
1436 .addExpr(LazyPtrHa16));
1440 const MCExpr *LazyPtrLo16 =
1442 EmitToStreamer(*OutStreamer,
MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
1444 .addExpr(LazyPtrLo16).addExpr(LazyPtrLo16)
1457 OutContext.getOrCreateSymbol(
StringRef(
"dyld_stub_binding_helper"));
1471 bool PPCDarwinAsmPrinter::doFinalization(
Module &M) {
1472 bool isPPC64 =
TM.getDataLayout()->getPointerSizeInBits() == 64;
1482 EmitFunctionStubs(Stubs);
1484 if (MAI->doesSupportExceptionHandling() && MMI) {
1487 const std::vector<const Function*> &Personalities = MMI->getPersonalities();
1488 for (std::vector<const Function*>::const_iterator
I = Personalities.begin(),
1489 E = Personalities.end();
I != E; ++
I) {
1491 MCSymbol *NLPSym = getSymbolWithGlobalValueBase(*
I,
"$non_lazy_ptr");
1503 if (!Stubs.empty()) {
1506 EmitAlignment(isPPC64 ? 3 : 2);
1508 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1535 if (!Stubs.empty()) {
1536 OutStreamer->
SwitchSection(getObjFileLowering().getDataSection());
1537 EmitAlignment(isPPC64 ? 3 : 2);
1539 for (
unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1544 create(Stubs[i].second.getPointer(),
1569 std::unique_ptr<MCStreamer> &&Streamer) {
1571 return new PPCDarwinAsmPrinter(tm, std::move(Streamer));
1572 return new PPCLinuxAsmPrinter(tm, std::move(Streamer));
MCSection * getNonLazySymbolPointerSection() const
VectorType::iterator iterator
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag)
Note in the output the specified Flag.
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
Instances of this class represent a uniqued identifier for a section in the current translation unit...
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()
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
virtual void AddComment(const Twine &T)
Add a textual command.
const GlobalValue * getGlobal() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
size_t size() const
size - Get the string size.
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
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. ...
virtual void AddBlankLine()
AddBlankLine - Emit a blank line to a .s file to pretty it up.
bool doFinalization(Module &M) override
Shut down the asmprinter.
MCSection * getLazySymbolPointerSection() const
static MCOperand createExpr(const MCExpr *Val)
MCSectionELF * getELFSection(StringRef Section, unsigned Type, unsigned Flags)
A Stackmap instruction captures the location of live variables at its position in the instruction str...
const char * getPrivateGlobalPrefix() const
StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static MCSymbol * GetAnonSym(MCSymbol *Sym, MCContext &Ctx)
bool hasAvailableExternallyLinkage() const
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
This class implements a map that also provides access to all stored values in a deterministic order...
MachineBasicBlock reference.
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
const Triple & getTargetTriple() const
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
bool hasCommonLinkage() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static MCSymbol * GetLazyPtr(MCSymbol *Sym, MCContext &Ctx)
bool hasInternalLinkage() const
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
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.
Represent a reference to a symbol from inside an expression.
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
MCContext & getContext() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
static void printOperand(raw_ostream &OS, uint8_t Opcode, unsigned OperandIdx, uint64_t Operand, uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor)
Print Opcode's operand number OperandIdx which has value Operand.
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
Context object for machine code objects.
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)
R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
virtual void emitLocalEntry(MCSymbolELF *S, const MCExpr *LocalOffset)=0
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
Type * getElementType() const
SymbolListTy GetFnStubList()
Accessor methods to return the set of stubs in sorted order.
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.
LLVM_CONSTEXPR size_t array_lengthof(T(&)[N])
Find the length of an array.
DBG_VALUE - a mapping of the llvm.dbg.value intrinsic.
Address of a global value.
Streaming machine code generation interface.
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
Patchable call instruction - this instruction represents a call to a constant address, followed by a series of NOPs.
MCTargetStreamer * getTargetStreamer()
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
PointerIntPair - This class implements a pair of a pointer and small integer.
void LLVMInitializePowerPCAsmPrinter()
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
bool hasHiddenVisibility() const
CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a MTCTR instruction.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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)
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
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 * getSymbol() const
getSymbol - 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...
PointerTy getPointer() const
void setOpcode(unsigned Op)
PICLevel::Level getPICLevel() const
Returns the PIC level (small or large model)
bool isFunctionTy() const
isFunctionTy - True if this is an instance of FunctionType.
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
SymbolListTy GetHiddenGVStubList()
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
void recordStackMap(const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
bundle_iterator< const MachineInstr, const_instr_iterator > const_iterator
PointerType * getType() const
Global values are always pointers.
StringRef getName() const
getName - Get the symbol name.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
MCSectionELF - 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...
void EmitValue(const MCExpr *Value, unsigned Size, const SMLoc &Loc=SMLoc())
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
const ARM::ArchExtKind Kind
Module * getParent()
Get the module that this global value is contained inside of...
virtual void emitTCEntry(const MCSymbol &S)=0
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.
virtual void emitMachine(StringRef CPU)=0
Instances of this class represent operands of the MCInst class.
MCSymbol * getPICOffsetSymbol() const
MachineModuleInfoImpl - This class can be derived from and used by targets to hold private target-spe...
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()