57 #define DEBUG_TYPE "asm-printer"
61 static const char *
const EHTimerName =
"DWARF Exception Writer";
64 STATISTIC(EmittedInsts,
"Number of machine instrs printed");
66 char AsmPrinter::ID = 0;
80 unsigned InBits = 0) {
104 OutContext(Streamer->getContext()), OutStreamer(std::move(Streamer)),
105 LastMI(nullptr), LastFn(0), Counter(~0U) {
111 CurrentFnBegin =
nullptr;
112 CurrentFnEnd =
nullptr;
113 GCMetadataPrinters =
nullptr;
118 assert(!DD && Handlers.
empty() &&
"Debug/EH info didn't get finalized");
120 if (GCMetadataPrinters) {
124 GCMetadataPrinters =
nullptr;
144 assert(
MF &&
"getSubtargetInfo requires a valid MachineFunction!");
173 MMI = getAnalysisIfAvailable<MachineModuleInfo>();
193 unsigned Major, Minor, Update;
199 Major, Minor, Update);
213 assert(MI &&
"AsmPrinter didn't require GCModuleInfo?");
216 MP->beginAssembly(M, *MI, *
this);
225 OutStreamer->AddComment(
"Start of file scope inline assembly");
228 OutStreamer->AddComment(
"End of file scope inline assembly");
233 bool skip_dwarf =
false;
371 "' is already defined");
386 for (
const HandlerInfo &
HI : Handlers) {
388 HI.Handler->setSymbolSize(GVSym, Size);
393 if (Size == 0) Size = 1;
394 unsigned Align = 1 << AlignLog;
411 OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
423 OutStreamer->EmitLocalCommonSymbol(GVSym, Size, Align);
443 if (Size == 0) Size = 1;
448 OutStreamer->EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
469 OutStreamer->EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
486 EmitLinkage(GV, GVSym);
505 EmitLinkage(GV, GVSym);
522 void AsmPrinter::EmitFunctionHeader() {
557 std::vector<MCSymbol*> DeadBlockSyms;
559 for (
unsigned i = 0, e = DeadBlockSyms.size(); i != e; ++i) {
560 OutStreamer->AddComment(
"Address taken block that was later removed");
564 if (CurrentFnBegin) {
576 for (
const HandlerInfo &
HI : Handlers) {
578 HI.Handler->beginFunction(
MF);
595 "' is a protected alias");
598 "' label emitted multiple times to assembly file");
619 CommentOS << MMO->
getSize() <<
"-byte Reload\n";
623 CommentOS << MMO->
getSize() <<
"-byte Folded Reload\n";
627 CommentOS << MMO->
getSize() <<
"-byte Spill\n";
631 CommentOS << MMO->
getSize() <<
"-byte Folded Spill\n";
636 CommentOS <<
" Reload Reuse\n";
649 std::string Str =
"kill:";
652 assert(Op.
isReg() &&
"KILL instruction must have only register operands");
655 Str += (Op.
isDef() ?
"<def>" :
"<kill>");
671 OS <<
"DEBUG_VALUE: ";
674 if (
auto *
SP = dyn_cast<DISubprogram>(V->
getScope())) {
734 OS <<
'+' << Offset <<
']';
785 EmitFunctionHeader();
793 bool HasAnyRealCode =
false;
794 for (
auto &MBB : *
MF) {
797 for (
auto &
MI : MBB) {
800 if (!
MI.isPosition() && !
MI.isImplicitDef() && !
MI.isKill() &&
801 !
MI.isDebugValue()) {
802 HasAnyRealCode =
true;
806 if (ShouldPrintDebugScopes) {
807 for (
const HandlerInfo &
HI : Handlers) {
810 HI.Handler->beginInstruction(&
MI);
817 switch (
MI.getOpcode()) {
850 if (ShouldPrintDebugScopes) {
851 for (
const HandlerInfo &
HI : Handlers) {
854 HI.Handler->endInstruction();
867 MF->getSubtarget().getInstrInfo()->getNoopForMachoTarget(Noop);
868 OutStreamer->AddComment(
"avoids zero-length function");
876 const Function *F = MF->getFunction();
877 for (
const auto &BB : *F) {
878 if (!BB.hasAddressTaken())
883 OutStreamer->AddComment(
"Address of block that was removed by CodeGen");
909 for (
const HandlerInfo &
HI : Handlers) {
911 HI.Handler->markFunctionEnd();
918 for (
const HandlerInfo &
HI : Handlers) {
920 HI.Handler->endFunction(MF);
932 if (isa<GlobalVariable>(C))
935 unsigned NumUses = 0;
936 for (
auto *CU : C->
users())
948 unsigned &NumGOTEquivUsers) {
958 for (
auto *U : GV->
users())
961 return NumGOTEquivUsers > 0;
976 unsigned NumGOTEquivUsers = 0;
995 unsigned Cnt =
I.second.second;
999 GlobalGOTEquivs.clear();
1001 for (
auto *GV : FailedCandidates)
1033 EmitVisibility(Name, V,
false);
1040 M.getModuleFlagsMetadata(ModuleFlags);
1041 if (!ModuleFlags.
empty())
1049 if (!Stubs.empty()) {
1053 for (
const auto &Stub : Stubs) {
1055 OutStreamer->EmitSymbolValue(Stub.second.getPointer(),
1065 for (
const HandlerInfo &
HI : Handlers) {
1068 HI.Handler->endModule();
1082 for (
const auto &
G : M.globals()) {
1083 if (!
G.hasExternalWeakLinkage())
1088 for (
const auto &F : M) {
1096 for (
const auto &Alias : M.aliases()) {
1101 else if (Alias.hasWeakLinkage() || Alias.hasLinkOnceLinkage())
1104 assert(Alias.hasLocalLinkage() &&
"Invalid alias linkage");
1106 EmitVisibility(Name, Alias.getVisibility());
1113 assert(MI &&
"AsmPrinter didn't require GCModuleInfo?");
1116 MP->finishAssembly(M, *MI, *
this);
1119 EmitModuleIdents(M);
1139 Function *InitTrampolineIntrinsic = M.getFunction(
"llvm.init.trampoline");
1140 if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->
use_empty())
1158 if (!CurExceptionSym)
1160 return CurExceptionSym;
1168 CurrentFnBegin =
nullptr;
1169 CurExceptionSym =
nullptr;
1172 NeedsLocalForSize) {
1174 if (NeedsLocalForSize)
1175 CurrentFnSymForSize = CurrentFnBegin;
1179 LI = &getAnalysis<MachineLoopInfo>();
1188 SectionCPs(
MCSection *s,
unsigned a) : S(s), Alignment(a) {}
1199 const std::vector<MachineConstantPoolEntry> &
CP = MCP->
getConstants();
1200 if (CP.empty())
return;
1205 for (
unsigned i = 0, e = CP.size(); i != e; ++i) {
1221 unsigned SecIdx = CPSections.
size();
1222 while (SecIdx != 0) {
1223 if (CPSections[--SecIdx].S == S) {
1229 SecIdx = CPSections.
size();
1230 CPSections.
push_back(SectionCPs(S, Align));
1233 if (Align > CPSections[SecIdx].Alignment)
1234 CPSections[SecIdx].Alignment =
Align;
1240 unsigned Offset = 0;
1241 for (
unsigned i = 0, e = CPSections.
size(); i != e; ++i) {
1242 for (
unsigned j = 0, ee = CPSections[i].CPEs.
size(); j != ee; ++j) {
1243 unsigned CPI = CPSections[i].CPEs[j];
1248 if (CurSection != CPSections[i].S) {
1251 CurSection = CPSections[i].S;
1259 unsigned NewOffset = (Offset + AlignMask) & ~AlignMask;
1263 Offset = NewOffset +
1284 if (JT.empty())
return;
1293 if (JTInDiffSection) {
1304 if (!JTInDiffSection)
1307 for (
unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
1308 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1311 if (JTBBs.empty())
continue;
1320 for (
unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
1322 if (!EmittedSets.
insert(MBB).second)
1345 for (
unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
1346 EmitJumpTableEntry(MJTI, JTBBs[ii], JTI);
1348 if (!JTInDiffSection)
1356 unsigned UID)
const {
1357 assert(MBB && MBB->
getNumber() >= 0 &&
"Invalid basic block");
1410 assert(Value &&
"Unknown entry kind!");
1412 unsigned EntrySize =
1422 if (GV->
getName() ==
"llvm.used") {
1437 if (GV->
getName() ==
"llvm.global_ctors") {
1449 if (GV->
getName() ==
"llvm.global_dtors") {
1467 void AsmPrinter::EmitLLVMUsedList(
const ConstantArray *InitList) {
1469 for (
unsigned i = 0, e = InitList->
getNumOperands(); i != e; ++i) {
1479 Structor() : Priority(0),
Func(nullptr), ComdatKey(nullptr) {}
1488 void AsmPrinter::EmitXXStructorList(
const Constant *
List,
bool isCtor) {
1491 if (!isa<ConstantArray>(List))
return;
1495 if (!InitList)
return;
1507 for (Value *O : InitList->
operands()) {
1513 if (!Priority)
continue;
1515 Structor &S = Structors.
back();
1525 std::stable_sort(Structors.
begin(), Structors.
end(),
1526 [](
const Structor &L,
1527 const Structor &R) {
return L.Priority < R.Priority; });
1528 for (Structor &S : Structors) {
1549 void AsmPrinter::EmitModuleIdents(
Module &M) {
1554 for (
unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
1555 const MDNode *
N = NMD->getOperand(i);
1557 "llvm.ident metadata entry can have only one operand");
1590 unsigned Size)
const {
1591 OutStreamer->emitAbsoluteSymbolDiff(Hi, Lo, Size);
1599 bool IsSectionRelative)
const {
1627 if (NumBits == 0)
return;
1630 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
1631 "undefined behavior");
1648 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
1651 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
1654 if (
const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
1662 if (
const MCExpr *RelocExpr
1679 OS <<
"Unsupported expression in static initializer: ";
1684 case Instruction::GetElementPtr: {
1689 cast<GEPOperator>(CE)->accumulateConstantOffset(DL, OffsetAI);
1700 case Instruction::Trunc:
1706 case Instruction::BitCast:
1709 case Instruction::IntToPtr: {
1720 case Instruction::PtrToInt: {
1745 case Instruction::Add:
1746 case Instruction::Sub:
1747 case Instruction::Mul:
1748 case Instruction::SDiv:
1749 case Instruction::SRem:
1750 case Instruction::Shl:
1774 uint64_t Offset = 0);
1781 assert(!Data.
empty() &&
"Empty aggregates should be CAZ node");
1783 for (
unsigned i = 1, e = Data.
size(); i != e; ++i)
1784 if (Data[i] != C)
return -1;
1785 return static_cast<uint8_t
>(C);
1793 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
1795 assert(Size % 8 == 0);
1807 assert(CA->getNumOperands() != 0 &&
"Should be a CAZ");
1814 for (
unsigned i = 1, e = CA->getNumOperands(); i != e; ++i)
1815 if (CA->getOperand(i) != Op0)
1854 }
else if (ElementByteSize == 4) {
1866 AP.
OutStreamer->GetCommentOS() <<
"float " << F <<
'\n';
1879 AP.
OutStreamer->GetCommentOS() <<
"double " << F <<
'\n';
1888 if (
unsigned Padding = Size - EmittedSize)
1894 const Constant *BaseCV, uint64_t Offset) {
1920 if (
unsigned Padding = Size - EmittedSize)
1925 const Constant *BaseCV, uint64_t Offset) {
1930 uint64_t SizeSoFar = 0;
1941 SizeSoFar += FieldSize + PadSize;
1949 "Layout of constant struct may be incorrect!");
1964 AP.
OutStreamer->GetCommentOS() <<
"Printing <null> Type";
1965 AP.
OutStreamer->GetCommentOS() <<
' ' << StrVal <<
'\n';
1972 unsigned TrailingBytes = NumBytes %
sizeof(uint64_t);
1982 AP.
OutStreamer->EmitIntValue(p[Chunk--], TrailingBytes);
1984 for (; Chunk >= 0; --Chunk)
1985 AP.
OutStreamer->EmitIntValue(p[Chunk],
sizeof(uint64_t));
1988 for (Chunk = 0; Chunk < NumBytes /
sizeof(uint64_t); ++Chunk)
1989 AP.
OutStreamer->EmitIntValue(p[Chunk],
sizeof(uint64_t));
1992 AP.
OutStreamer->EmitIntValue(p[Chunk], TrailingBytes);
2008 uint64_t ExtraBits = 0;
2009 unsigned ExtraBitsSize = BitWidth & 63;
2011 if (ExtraBitsSize) {
2028 ExtraBits = Realigned.getRawData()[0] &
2029 (((uint64_t)-1) >> (64 - ExtraBitsSize));
2030 Realigned = Realigned.lshr(ExtraBitsSize);
2032 ExtraBits = Realigned.getRawData()[BitWidth / 64];
2038 const uint64_t *RawData = Realigned.getRawData();
2039 for (
unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
2040 uint64_t Val = DL->
isBigEndian() ? RawData[e - i - 1] : RawData[i];
2044 if (ExtraBitsSize) {
2050 Size -= (BitWidth / 64) * 8;
2051 assert(Size && Size * 8 >= ExtraBitsSize &&
2052 (ExtraBits & (((uint64_t)-1) >> (64 - ExtraBitsSize)))
2053 == ExtraBits &&
"Directive too small for extra bits.");
2086 if (!(*ME)->evaluateAsRelocatable(MV,
nullptr,
nullptr) || MV.
isAbsolute())
2105 if (!SymB || BaseSym != &SymB->
getSymbol())
2117 if (GOTPCRelCst < 0)
2140 int NumUses = (
int)Result.second;
2153 const Constant *BaseCV, uint64_t Offset) {
2161 BaseCV = dyn_cast<Constant>(CV->
user_back());
2163 if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
2166 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
2174 CI->getZExtValue());
2175 AP.
OutStreamer->EmitIntValue(CI->getZExtValue(), Size);
2183 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
2186 if (isa<ConstantPointerNull>(CV)) {
2200 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
2203 if (CE->getOpcode() == Instruction::BitCast)
2211 if (New && New != CE)
2252 OS <<
'+' << Offset;
2253 else if (Offset < 0)
2278 +
"_" +
Twine(CPID));
2316 <<
"Parent Loop BB" << FunctionNumber <<
"_"
2329 <<
"Child Loop BB" << FunctionNumber <<
"_"
2330 <<
CL->getHeader()->getNumber() <<
" Depth " <<
CL->getLoopDepth()
2345 assert(Header &&
"No header for loop");
2349 if (Header != &MBB) {
2350 AP.
OutStreamer->AddComment(
" in Loop: Header=BB" +
2416 bool IsDefinition)
const {
2419 switch (Visibility) {
2462 if (!
MI.isBranch() ||
MI.isIndirectBranch())
2471 if (
OP->isMBB() &&
OP->getMBB() == MBB)
2485 assert(!S.
useStatepoints() &&
"statepoints do not currently support custom"
2486 " stackmap formats, please see the documentation for a description of"
2487 " the default format. If you really need a custom serialized format,"
2488 " please file a bug");
2492 if (GCPI != GCMap.end())
2493 return GCPI->second.get();
2500 if (strcmp(Name,
I->getName()) == 0) {
2501 std::unique_ptr<GCMetadataPrinter> GMP =
I->instantiate();
2503 auto IterBool = GCMap.insert(std::make_pair(&S, std::move(GMP)));
2504 return IterBool.first->second.get();
virtual void EmitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
MachineConstantPoolValue * MachineCPVal
Instances of this class represent a uniqued identifier for a section in the current translation unit...
bool usesMetadata() const
If set, appropriate metadata tables must be emitted by the back-end (assembler, JIT, or otherwise).
void push_back(const T &Elt)
const MachineFunction * getParent() const
getParent - Return the MachineFunction containing this basic block.
virtual void EmitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
bool doesSupportDebugInformation() const
A parsed version of the target data layout string in and methods for querying it. ...
bool useAssignmentForEHBegin() const
static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP)
LinkageTypes getLinkage() const
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
unsigned getAlignment() const
getAlignment - Return the alignment (log2, not bytes) of the function.
virtual void emitModuleFlags(MCStreamer &Streamer, ArrayRef< Module::ModuleFlagEntry > Flags, Mangler &Mang, const TargetMachine &TM) const
Emit the module flags that the platform cares about.
static SectionKind getKindForGlobal(const GlobalValue *GV, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
SectionKind getSectionKind(const DataLayout *DL) const
StringRef getTargetCPU() const
Special purpose, only applies to global arrays.
VisibilityTypes getVisibility() const
virtual MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const
Constant * getPrologueData() const
static void emitBasicBlockLoopComments(const MachineBasicBlock &MBB, const MachineLoopInfo *LI, const AsmPrinter &AP)
emitBasicBlockLoopComments - Pretty-print comments for basic blocks.
uint64_t getZExtValue() const
Get zero extended value.
bool hasIdentDirective() const
bool needsLocalForSize() const
virtual bool hasStoreToStackSlot(const MachineInstr *MI, const MachineMemOperand *&MMO, int &FrameIndex) const
If the specified machine instruction has a store to a stack slot, return true along with the FrameInd...
const MCSymbol & getSymbol() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol * getSymbol(const GlobalValue *GV) const
MCTargetOptions MCOptions
Machine level options.
STATISTIC(NumFunctions,"Total number of functions")
size_t size() const
size - Get the string size.
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
.type _foo, STT_OBJECT # aka
This represents an "assembler immediate".
static bool isGOTEquivalentCandidate(const GlobalVariable *GV, unsigned &NumGOTEquivUsers)
Only consider global GOT equivalents if at least one user is a cstexpr inside an initializer of anoth...
WinEH::EncodingType getWinEHEncodingType() const
static const fltSemantics IEEEdouble
const ConstantFP * getFPImm() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
int getNumber() const
getNumber - MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a M...
A Module instance is used to store all the information related to an LLVM module. ...
void redefineIfPossible()
Prepare this symbol to be redefined.
const DataLayout & getDataLayout() const
Return information about data layout.
bool doFinalization(Module &M) override
Shut down the asmprinter.
void EmitInt8(int Value) const
Emit a byte directive and value.
Same, but only replaced by something equivalent.
MCContext & OutContext
This is the context for the output file that we are streaming.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
bool canBeOmittedFromSymbolTable(const GlobalValue *GV)
void print(raw_ostream &OS, bool isSigned) const
DILocalScope * getScope() const
Get the local scope for this variable.
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
virtual bool hasLoadFromStackSlot(const MachineInstr *MI, const MachineMemOperand *&MMO, int &FrameIndex) const
If the specified machine instruction has a load from a stack slot, return true along with the FrameIn...
unsigned getNumOperands() const
Available for inspection, not emission.
unsigned getNumOperands() const
Return number of MDNode operands.
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
DWARF-like instruction based exceptions.
void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Siz...
void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const
Emit something like ".long Hi-Lo" where the size in bytes of the directive is specified by Size and H...
void EmitJumpTableInfo()
Print assembly representations of the jump tables used by the current function to the current output ...
static int isRepeatedByteSequence(const ConstantDataSequential *V)
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of iden...
Collects and handles dwarf debug information.
bool hasAppendingLinkage() const
EK_Inline - Jump table entries are emitted inline at their point of use.
unsigned getPointerPrefAlignment(unsigned AS=0) const
Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of...
const MachineFunction * MF
The current machine function.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
const char * getPrivateGlobalPrefix() const
Like Internal, but omit from symbol table.
Externally visible function.
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
bool hasAvailableExternallyLinkage() const
static const char *const DWARFGroupName
A raw_ostream that writes to an SmallVector or SmallString.
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
virtual void EmitConstantPool()
Print to the current output stream assembly representations of the constants in the constant pool MCP...
LoopT * getParentLoop() const
unsigned getFunctionNumber() const
Return a unique ID for the current function.
const std::string & str() const
bool hasPrologueData() const
static const MCBinaryExpr * createAnd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
void EmitInt32(int Value) const
Emit a long directive and value.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
setjmp/longjmp based exceptions
const char * getWeakRefDirective() const
ELFYAML::ELF_STV Visibility
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
bool supportGOTPCRelWithOffset() const
Target GOT "PC"-relative relocation supports encoding an additional binary expression with an offset...
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
static const MCBinaryExpr * createMul(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
static void emitKill(const MachineInstr *MI, AsmPrinter &AP)
bool hasLinkOnceDirective() const
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
Constant * ConstantFoldConstantExpression(const ConstantExpr *CE, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)
ConstantFoldConstantExpression - Attempt to fold the constant expression using the specified DataLayo...
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
BlockT * getHeader() const
virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI, int &FrameIndex) const
Check for post-frame ptr elimination stack locations as well.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
static void emitGlobalConstantImpl(const Constant *C, AsmPrinter &AP, const Constant *BaseCV=nullptr, uint64_t Offset=0)
uint64_t getTypeAllocSizeInBits(Type *Ty) const
Returns the offset in bits between successive objects of the specified type, including alignment padd...
StringRef getName() const
Return a constant reference to the value's name.
bool hasMachoTBSSDirective() const
const Triple & getTargetTriple() const
void print(raw_ostream &O) const
unsigned getPointerTypeSize(Type *Ty) const
MCSymbolAttr getHiddenVisibilityAttr() const
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
MCSubtargetInfo * createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, StringRef Features) const
createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
const std::vector< MachineJumpTableEntry > & getJumpTables() const
BlockAddress - The address of a basic block.
static const MCBinaryExpr * createXor(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
AnalysisUsage & addRequired()
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
static void emitGlobalConstantFP(const ConstantFP *CFP, AsmPrinter &AP)
MachineMemOperand - A description of a memory reference used in the backend.
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
bool getAsmPrinterFlag(CommentFlag Flag) const
Return whether an AsmPrinter flag is set.
Emits exception handling directives.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool hasWeakDefDirective() const
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
void takeDeletedSymbolsForFunction(const Function *F, std::vector< MCSymbol * > &Result)
takeDeletedSymbolsForFunction - If the specified function has had any references to address-taken blo...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
virtual void EmitEndOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the end of their file...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const HexagonInstrInfo * TII
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
unsigned getCFIIndex() const
const APInt & getValue() const
Return the constant as an APInt value reference.
StructType - Class to represent struct types.
virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI, int &FrameIndex) const
Check for post-frame ptr elimination stack locations as well.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
NamedRegionTimer - This class is basically a combination of TimeRegion and Timer. ...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static const MCBinaryExpr * createDiv(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
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.
virtual TargetLoweringObjectFile * getObjFileLowering() const
Reg
All possible values of the reg field in the ModR/M byte.
iterator_range< iterator > terminators()
double getElementAsDouble(unsigned i) const
getElementAsDouble - If this is an sequential container of doubles, return the specified element as a...
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
Return the symbol for the specified jump table entry.
Represent a reference to a symbol from inside an expression.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool hasMachoZeroFillDirective() const
bool doesSetDirectiveSuppressesReloc() const
An analysis pass which caches information about the entire Module.
bool hasDebugInfo() const
hasDebugInfo - Returns true if valid debug info is present.
static void emitGlobalConstantVector(const ConstantVector *CV, AsmPrinter &AP)
StringRef getName() const
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isSplat(unsigned SplatSizeInBits) const
Check if the APInt consists of a repeated bit pattern.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
static const char *const CodeViewLineTablesGroupName
Context object for machine code objects.
static const MCBinaryExpr * createShl(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
ConstantExpr - a constant value that is initialized with an expression using other constant values...
void EmitFunctionBody()
This method emits the body and trailer for a function.
static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS)
emitComments - Pretty-print comments for instructions.
Mangler * Mang
Name-mangler for global names.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrSelf(unsigned width) const
Zero extend or truncate to width.
bool useStatepoints() const
Returns true if this strategy is expecting the use of gc.statepoints, and false otherwise.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table...
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
const std::string & getName() const
Return the name of the GC strategy.
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
const MCSection * getCurrentSection() const
Return the current section we are emitting to.
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
void EmitInt16(int Value) const
Emit a short directive and value.
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
EK_BlockAddress - Each entry is a plain address of block, e.g.
double convertToDouble() const
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the current function's prologue.
SequentialType * getType() const
getType - Specialize the getType() method to always return a SequentialType, which reduces the amount...
This class is a data container for one entry in a MachineConstantPool.
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(const BasicBlock *BB)
getAddrLabelSymbolToEmit - Return the symbol to be used for the specified basic block when its addres...
virtual void emitImplicitDef(const MachineInstr *MI) const
Targets can override this to customize the output of IMPLICIT_DEF instructions in verbose mode...
static void emitGlobalConstantArray(const ConstantArray *CA, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset)
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
unsigned getNumElements() const
Return the number of elements in the Vector type.
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, Mangler &Mang, const TargetMachine &TM) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
StringRef getTargetTriple() const
Return the target triple string.
bool isPPC_FP128Ty() const
isPPC_FP128Ty - Return true if this is powerpc long double.
Type * getElementType() const
virtual int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
void emitGlobalGOTEquivs()
Constant expressions using GOT equivalent globals may not be eligible for PC relative GOT entry conve...
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
Instances of this class represent a single low-level machine instruction.
static void handleIndirectSymViaGOTPCRel(AsmPrinter &AP, const MCExpr **ME, const Constant *BaseCst, uint64_t Offset)
Transform a not absolute MCExpr containing a reference to a GOT equivalent global, by a target specific GOT pc relative access to the final symbol.
const BasicBlock * getBasicBlock() const
getBasicBlock - Return the LLVM basic block that this instance corresponded to originally.
static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI)
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
bool getCommDirectiveSupportsAlignment() const
const MachineBasicBlock * getParent() const
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
TargetInstrInfo - Interface to description of machine instruction set.
uint64_t getElementOffset(unsigned Idx) const
const Constant * ConstVal
This class is intended to be used as a base class for asm properties and features specific to the tar...
DBG_VALUE - a mapping of the llvm.dbg.value intrinsic.
ExternalWeak linkage description.
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP)
emitDebugValueComment - This method handles the target-independent form of DBG_VALUE, returning true if it was able to do so.
MachineLoop * getLoopFor(const MachineBasicBlock *BB) const
getLoopFor - Return the inner most loop that BB lives in.
bool needsDwarfSectionOffsetDirective() const
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
Same, but only replaced by something equivalent.
Instruction that records the offset of a local stack allocation passed to llvm.localescape.
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
std::pair< const GlobalVariable *, unsigned > GOTEquivUsePair
Map global GOT equivalent MCSymbols to GlobalVariables and keep track of its number of uses by other ...
Streaming machine code generation interface.
virtual void EmitFunctionBodyEnd()
Targets can override this to emit stuff after the last basic block in the function.
virtual MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
iterator_range< iterator > functions()
.weak_def_can_be_hidden (MachO)
MCSymbol * CurrentFnSym
The symbol for the current function.
MCSymbolAttr getProtectedVisibilityAttr() const
virtual const MCExpr * getIndirectSymViaGOTPCRel(const MCSymbol *Sym, const MCValue &MV, int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const
Get the target specific PC relative GOT entry relocation.
LLVM Basic Block Representation.
const MCAsmInfo * MAI
Target Asm Printer information.
The instances of the Type class are immutable: once they are created, they are never changed...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MCSection * SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
This is an important base class in LLVM.
uint64_t getElementByteSize() const
getElementByteSize - Return the size (in bytes) of each element in the array/vector.
int64_t getSExtValue() const
Get sign extended value.
StringRef getAsString() const
getAsString - If this array is isString(), then this method returns the array as a StringRef...
bool isThreadData() const
const MachineOperand & getOperand(unsigned i) const
StringRef getRawDataValues() const
getRawDataValues - Return the raw, underlying, bytes of this data.
MCSymbol * getAddrLabelSymbol(const BasicBlock *BB)
getAddrLabelSymbol - Return the symbol to be used for the specified basic block when its address is t...
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
MCSymbol * GetJTSetSymbol(unsigned UID, unsigned MBBID) const
Return the symbol for the specified jump table .set FIXME: privatize to AsmPrinter.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
static const MCBinaryExpr * createOr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
TargetMachine & TM
Target machine description.
bool isCImm() const
isCImm - Test if this is a MO_CImmediate operand.
bool hasFunctionAlignment() const
This class is intended to be used as a driving class for all asm writers.
Represent the analysis usage information of a pass.
virtual MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const
Type * getTypeAtIndex(const Value *V)
getTypeAtIndex - Given an index value into the type, return the type of the element.
unsigned getBitWidth() const
Return the number of bits in the APInt.
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
opStatus convert(const fltSemantics &, roundingMode, bool *)
APFloat::convert - convert a value of one floating point type to another.
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit...
SectionKind - This is a simple POD value that classifies the properties of a section.
ExceptionHandling getExceptionHandlingType() const
Value * getOperand(unsigned i) const
static void PrintChildLoopComment(raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber)
PrintChildLoopComment - Print comments about child loops within the loop for this basic block...
DenseMap< GCStrategy *, std::unique_ptr< GCMetadataPrinter > > gcp_map_type
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
Ty & getObjFileInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
ConstantVector - Constant Vector Declarations.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
void emitFrameAlloc(const MachineInstr &MI)
virtual MCSection * getSectionForConstant(SectionKind Kind, const Constant *C) const
Given a constant with the SectionKind, return a section that it should be placed in.
void computeGlobalGOTEquivs(Module &M)
Unnamed constant global variables solely contaning a pointer to another globals variable act like a g...
static const char *const EHTimerName
bool supportIndirectSymViaGOTPCRel() const
Target supports replacing a data "PC"-relative access to a symbol through another symbol...
uint64_t getElementAsInteger(unsigned i) const
getElementAsInteger - If this is a sequential container of integers (of any size), return the specified element in the low bits of a uint64_t.
const MCSymbolRefExpr * getSymB() const
pred_iterator pred_begin()
Abstract base class for all machine specific constantpool value subclasses.
MCSymbol * getSymbol() const
getSymbol - Return the MCSymbol for this basic block.
MCSymbol * getSymbol(const GlobalValue *GV, Mangler &Mang) const
virtual void markFunctionEnd()
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
bool isThreadLocal() const
Windows x64, Windows Itanium (IA-64)
static void PrintParentLoopComment(raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber)
PrintParentLoopComment - Print comments about parent loops of this one.
Triple - Helper class for working with autoconf configuration names.
void EmitAlignment(unsigned NumBits, const GlobalObject *GO=nullptr) const
Emit an alignment directive to the specified power of two boundary.
unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global, returned in log form.
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
const char * getSection() const
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
virtual const TargetFrameLowering * getFrameLowering() const
bool hasExternalWeakLinkage() const
const MDOperand & getOperand(unsigned I) const
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
void emitCFIInstruction(const MachineInstr &MI)
ArrayType * getType() const
getType - Specialize the getType() method to always return an ArrayType, which reduces the amount of ...
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
StringRef getTargetFeatureString() const
MapVector< const MCSymbol *, GOTEquivUsePair > GlobalGOTEquivs
const MCSymbolRefExpr * getSymA() const
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
const MCContext & getContext() const
void EmitGlobalConstant(const Constant *CV)
Print a general LLVM constant to the .s file.
const DataLayout * getDataLayout() const
Deprecated in 3.7, will be removed in 3.8.
const MCExpr * lowerConstant(const Constant *CV)
Lower the specified LLVM Constant to an MCExpr.
virtual void EmitInstruction(const MachineInstr *)
Targets should implement this to emit instructions.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Keep one copy of function when linking (inline)
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
virtual const TargetLowering * getTargetLowering() const
virtual void EmitXXStructor(const Constant *CV)
Targets can override this to change how global constants that are part of a C++ static/global constru...
bool usesMorestackAddr() const
MCSection * getTLSExtraDataSection() const
Information about stack frame layout on the target.
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV)
Check to see if the specified global is a special global used by LLVM.
uint64_t getSizeInBytes() const
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
BasicBlock * getBasicBlock() const
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase, but as an MCExpr.
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MCSymbol * createTempSymbol(const Twine &Name) const
bool isNullValue() const
isNullValue - Return true if this is the value that would be returned by getNullValue.
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
const ConstantInt * getCImm() const
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
unsigned getOpcode() const
virtual void EmitBasicBlockStart(const MachineBasicBlock &MBB) const
Targets can override this to emit stuff at the start of a basic block.
Class for arbitrary precision integers.
ConstantArray - Constant Array Declarations.
bool hasInitializer() const
Definitions have initializers, declarations don't.
virtual void EmitFunctionBodyStart()
Targets can override this to emit stuff before the first basic block in the function.
MCSymbol * getCurExceptionSym()
LinkageTypes
An enumeration for the kinds of linkage for global values.
bool hasSingleParameterDotFile() const
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
void setPreservesAll()
Set by analyses that do not transform their input at all.
StructType * getType() const
getType() specialization - Reduce amount of casting...
iterator_range< user_iterator > users()
APInt bitcastToAPInt() const
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
KILL - This instruction is a noop that is used only to adjust the liveness of registers.
FunctionNumber(functionNumber)
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
bool hasStaticCtorDtorReferenceInStaticMode() const
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
const MCRegisterInfo * getRegisterInfo() const
Iterators for registry entries.
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV)
StringRef str()
Flushes the stream contents to the target vector and return a StringRef for the vector contents...
Representation of each machine instruction.
iterator begin() const
begin/end - Iterators for used strategies.
bool hasAddressTaken() const
hasAddressTaken - Test whether this block is potentially the target of an indirect branch...
PointerType * getType() const
Global values are always pointers.
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3) const
Converts this value into a decimal string.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
bool isLandingPad() const
isLandingPad - Returns true if the block is a landing pad.
bool hasNoDeadStrip() const
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
GCStrategy describes a garbage collector algorithm's code generation requirements, and provides overridable hooks for those needs which cannot be abstractly described.
void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
StringRef getName() const
getName - Get the symbol name.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool hasLinkerPrivateGlobalPrefix() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
float getElementAsFloat(unsigned i) const
getElementAsFloat - If this is an sequential container of floats, return the specified element as a f...
const std::vector< LandingPadInfo > & getLandingPads() const
getLandingPads - Return a reference to the landing pad info for the current function.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
.type _foo, STT_FUNC # aka
virtual ~AsmPrinterHandler()
Pin vtable to this file.
static unsigned getNumGlobalVariableUses(const Constant *C)
Compute the number of Global Variables that uses a Constant.
static void emitGlobalConstantStruct(const ConstantStruct *CS, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset)
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
bool hasOneUse() const
Return true if there is exactly one user of this value.
virtual void EmitBasicBlockEnd(const MachineBasicBlock &MBB)
Targets can override this to emit stuff at the end of a basic block.
unsigned getNumElements() const
getNumElements - Return the number of elements in the array or vector.
MCSymbol * getMCSymbol() const
MCSubtargetInfo - Generic base class for all target subtargets.
float convertToFloat() const
Collects and handles line tables information in a CodeView format.
static gcp_map_type & getGCMap(void *&P)
static const MCBinaryExpr * createMod(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
union llvm::MachineConstantPoolEntry::@30 Val
The constant itself.
bool isString() const
isString - This method returns true if this is an array of i8.
bool hasPrefixData() const
Keep one copy of named function when linking (weak)
virtual const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *, const MachineBasicBlock *, unsigned, MCContext &) const
Rename collisions when linking (static functions).
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
Constant * getPrefixData() const
static unsigned getGVAlignmentLog2(const GlobalValue *GV, const DataLayout &DL, unsigned InBits=0)
getGVAlignmentLog2 - Return the alignment to use for the specified global value in log2 form...
virtual void EmitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
bool isBitPiece() const
Return whether this is a piece of an aggregate variable.
JTEntryKind getEntryKind() const
bool isVariable() const
isVariable - Check if this is a variable symbol.
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
const APFloat & getValueAPF() const
CFIMoveType needsCFIMoves()
VectorType * getType() const
getType - Specialize the getType() method to always return a VectorType, which reduces the amount of ...
Type * getElementType() const
getElementType - Return the element type of the array/vector.
unsigned getReg() const
getReg - Returns the register number.
virtual MCSection * getNonexecutableStackSection(MCContext &Ctx) const
Targets can implement this method to specify a section to switch to if the translation unit doesn't h...
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
unsigned getAlignment() const
int64_t getConstant() const
A raw_ostream that writes to an std::string.
virtual const TargetInstrInfo * getInstrInfo() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
bool hasUnnamedAddr() const
bool isKnownWindowsMSVCEnvironment() const
bool hasSubsectionsViaSymbols() const
Windows CE ARM, PowerPC, SH3, SH4.
static const char *const DbgTimerName
bool hasWeakDefCanBeHiddenDirective() const
uint64_t getBitPieceSize() const
Return the size of this piece in bits.
MCSection * getDataRelSection() const
uint64_t getBitPieceOffset() const
Return the offset of this piece in bits.
uint64_t getSize() const
getSize - Return the size in bytes of the memory reference.
This class implements an extremely fast bulk output stream that can only output to a stream...
const Target & getTarget() const
Primary interface to the complete machine description for the target machine.
MCSymbol * CurrentFnSymForSize
The symbol used to represent the start of the current function for the purpose of calculating its siz...
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
const std::vector< MachineConstantPoolEntry > & getConstants() const
iterator_range< global_iterator > globals()
StringRef - Represent a constant reference to a string, i.e.
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MachineModuleInfo & getMMI() const
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
MCSection * getTLSBSSSection() const
unsigned getNumElements() const
Random access to the elements.
bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
isLayoutSuccessor - Return true if the specified MBB will be emitted immediately after this block...
bool hasDotTypeDotSizeDirective() const
bool isVerbose() const
Return true if assembly output should contain comments.
unsigned getLoopDepth() const
getLoopDepth - Return the nesting level of this loop.
static SectionKind getReadOnly()
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
void EndFunction()
EndFunction - Discard function meta information.
bool isDeclarationForLinker() const
unsigned pred_size() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
MachineModuleInfo - This class contains meta information specific to a module.
This file describes how to lower LLVM code to machine code.
bool empty() const
empty - Check if the string is empty.
unsigned getAlignment() const
getAlignment - Return alignment of the basic block.
static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS, AsmPrinter &AP)
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
unsigned getNumWords() const
Get the number of words.
bool usesWindowsCFI() const