110 using namespace llvm;
112 #define DEBUG_TYPE "asm-printer"
122 "CodeView Line Tables";
124 STATISTIC(EmittedInsts,
"Number of machine instrs printed");
128 cl::desc(
"Print 'sched: [latency:throughput]' in .s output"));
130 char AsmPrinter::ID = 0;
143 unsigned InBits = 0) {
144 unsigned NumBits = 0;
149 if (InBits > NumBits)
167 OutContext(Streamer->getContext()), OutStreamer(std::move(Streamer)) {
172 assert(!DD && Handlers.
empty() &&
"Debug/EH info didn't get finalized");
174 if (GCMetadataPrinters) {
178 GCMetadataPrinters =
nullptr;
205 assert(
MF &&
"getSubtargetInfo requires a valid MachineFunction!");
229 MMI = getAnalysisIfAvailable<MachineModuleInfo>();
248 unsigned Major, Minor, Update;
265 OutStreamer->EmitVersionMin(VersionType, Major, Minor, Update);
279 assert(MI &&
"AsmPrinter didn't require GCModuleInfo?");
282 MP->beginAssembly(M, *MI, *
this);
291 OutStreamer->AddComment(
"Start of file scope inline assembly");
295 OutStreamer->AddComment(
"End of file scope inline assembly");
320 isCFIMoveForDebugging =
true;
327 if (!
F.isDeclarationForLinker() &&
F.needsUnwindTableEntry()) {
328 isCFIMoveForDebugging =
false;
334 isCFIMoveForDebugging =
false;
428 "No emulated TLS variables in the common section");
468 "' is already defined");
483 for (
const HandlerInfo &
HI : Handlers) {
485 HI.TimerGroupName,
HI.TimerGroupDescription,
487 HI.Handler->setSymbolSize(GVSym, Size);
492 if (Size == 0) Size = 1;
493 unsigned Align = 1 << AlignLog;
511 unsigned Align = 1 << AlignLog;
512 EmitLinkage(GV, GVSym);
514 OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
524 unsigned Align = 1 << AlignLog;
534 OutStreamer->EmitLocalCommonSymbol(GVSym, Size, Align);
565 OutStreamer->EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
583 EmitLinkage(GV, GVSym);
604 EmitLinkage(GV, EmittedInitSym);
624 unsigned Size)
const {
630 void AsmPrinter::EmitFunctionHeader() {
635 <<
"-- Begin function "
684 std::vector<MCSymbol*> DeadBlockSyms;
686 for (
unsigned i = 0, e = DeadBlockSyms.size(); i != e; ++i) {
687 OutStreamer->AddComment(
"Address taken block that was later removed");
691 if (CurrentFnBegin) {
703 for (
const HandlerInfo &
HI : Handlers) {
706 HI.Handler->beginFunction(
MF);
723 "' is a protected alias");
726 "' label emitted multiple times to assembly file");
741 bool Commented =
false;
749 CommentOS << MMO->
getSize() <<
"-byte Reload";
754 CommentOS << MMO->
getSize() <<
"-byte Folded Reload";
760 CommentOS << MMO->
getSize() <<
"-byte Spill";
765 CommentOS << MMO->
getSize() <<
"-byte Folded Spill";
773 CommentOS <<
" Reload Reuse";
791 OS <<
"implicit-def: "
804 assert(Op.
isReg() &&
"KILL instruction must have only register operands");
808 << (Op.
isDef() ?
"<def>" :
"<kill>");
824 OS <<
"DEBUG_VALUE: ";
827 if (
auto *SP = dyn_cast<DISubprogram>(V->
getScope())) {
841 bool NeedSep =
false;
848 for (
unsigned I = 0;
I <
Op.getNumArgs(); ++
I)
849 OS <<
' ' <<
Op.getArg(
I);
897 OS <<
'+' << Offset <<
']';
932 while (
I != MBB->end() &&
I->isTransient())
934 if (
I == MBB->instr_end() &&
935 MBB->getReverseIterator() == MBB->getParent()->rbegin())
970 EmitFunctionHeader();
978 bool HasAnyRealCode =
false;
979 int NumInstsInFunction = 0;
980 for (
auto &MBB : *
MF) {
983 for (
auto &
MI : MBB) {
986 if (!
MI.isPosition() && !
MI.isImplicitDef() && !
MI.isKill() &&
987 !
MI.isDebugValue()) {
988 HasAnyRealCode =
true;
989 ++NumInstsInFunction;
992 if (ShouldPrintDebugScopes) {
993 for (
const HandlerInfo &
HI : Handlers) {
995 HI.TimerGroupName,
HI.TimerGroupDescription,
997 HI.Handler->beginInstruction(&
MI);
1004 switch (
MI.getOpcode()) {
1005 case TargetOpcode::CFI_INSTRUCTION:
1009 case TargetOpcode::LOCAL_ESCAPE:
1014 case TargetOpcode::GC_LABEL:
1020 case TargetOpcode::DBG_VALUE:
1026 case TargetOpcode::IMPLICIT_DEF:
1037 if (ShouldPrintDebugScopes) {
1038 for (
const HandlerInfo &
HI : Handlers) {
1040 HI.TimerGroupName,
HI.TimerGroupDescription,
1042 HI.Handler->endInstruction();
1050 EmittedInsts += NumInstsInFunction;
1052 MF->getFunction()->getSubprogram(),
1054 R <<
ore::NV(
"NumInstructions", NumInstsInFunction)
1055 <<
" instructions in function";
1070 MF->getSubtarget().getInstrInfo()->getNoop(Noop);
1075 OutStreamer->AddComment(
"avoids zero-length function");
1080 const Function *F = MF->getFunction();
1081 for (
const auto &BB : *F) {
1082 if (!BB.hasAddressTaken())
1087 OutStreamer->AddComment(
"Address of block that was removed by CodeGen");
1112 for (
const HandlerInfo &
HI : Handlers) {
1115 HI.Handler->markFunctionEnd();
1122 for (
const HandlerInfo &
HI : Handlers) {
1125 HI.Handler->endFunction(MF);
1129 OutStreamer->GetCommentOS() <<
"-- End function\n";
1139 if (isa<GlobalVariable>(C))
1142 unsigned NumUses = 0;
1143 for (
auto *CU : C->
users())
1155 unsigned &NumGOTEquivUsers) {
1166 for (
auto *U : GV->
users())
1169 return NumGOTEquivUsers > 0;
1183 for (
const auto &
G : M.
globals()) {
1184 unsigned NumGOTEquivUsers = 0;
1203 unsigned Cnt =
I.second.second;
1207 GlobalGOTEquivs.clear();
1209 for (
auto *GV : FailedCandidates)
1213 void AsmPrinter::emitGlobalIndirectSymbol(
Module &M,
1228 if (isa<GlobalIFunc>(GIS))
1236 if (isa<GlobalAlias>(&GIS) &&
MAI->
hasAltEntry() && isa<MCBinaryExpr>(Expr))
1242 if (
auto *GA = dyn_cast<GlobalAlias>(&GIS)) {
1286 EmitVisibility(Name, V,
false);
1298 if (!Stubs.empty()) {
1302 for (
const auto &Stub : Stubs) {
1304 OutStreamer->EmitSymbolValue(Stub.second.getPointer(),
1311 for (
const HandlerInfo &
HI : Handlers) {
1314 HI.Handler->endModule();
1328 for (
const auto &GO : M.global_objects()) {
1329 if (!GO.hasExternalWeakLinkage())
1343 for (
const auto &Alias : M.aliases()) {
1346 if (!AliasVisited.
insert(Cur).second)
1351 emitGlobalIndirectSymbol(M, *AncestorAlias);
1354 for (
const auto &IFunc : M.ifuncs())
1355 emitGlobalIndirectSymbol(M, IFunc);
1358 assert(MI &&
"AsmPrinter didn't require GCModuleInfo?");
1361 MP->finishAssembly(M, *MI, *
this);
1364 EmitModuleIdents(M);
1385 Function *InitTrampolineIntrinsic = M.getFunction(
"llvm.init.trampoline");
1386 if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->
use_empty())
1403 if (!CurExceptionSym)
1405 return CurExceptionSym;
1413 CurrentFnBegin =
nullptr;
1414 CurExceptionSym =
nullptr;
1418 if (NeedsLocalForSize)
1419 CurrentFnSymForSize = CurrentFnBegin;
1422 ORE = &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE();
1424 LI = &getAnalysis<MachineLoopInfo>();
1429 : STI.supportPrintSchedInfo();
1440 SectionCPs(
MCSection *s,
unsigned a) : S(s), Alignment(a) {}
1452 const std::vector<MachineConstantPoolEntry> &
CP = MCP->
getConstants();
1453 if (CP.empty())
return;
1458 for (
unsigned i = 0, e = CP.size(); i != e; ++i) {
1474 unsigned SecIdx = CPSections.
size();
1475 while (SecIdx != 0) {
1476 if (CPSections[--SecIdx].S == S) {
1482 SecIdx = CPSections.
size();
1483 CPSections.
push_back(SectionCPs(S, Align));
1486 if (Align > CPSections[SecIdx].Alignment)
1487 CPSections[SecIdx].Alignment =
Align;
1494 for (
unsigned i = 0, e = CPSections.
size(); i != e; ++i) {
1495 for (
unsigned j = 0, ee = CPSections[i].CPEs.
size(); j != ee; ++j) {
1496 unsigned CPI = CPSections[i].CPEs[j];
1501 if (CurSection != CPSections[i].S) {
1504 CurSection = CPSections[i].S;
1512 unsigned NewOffset = (Offset + AlignMask) & ~AlignMask;
1536 if (JT.empty())
return;
1545 if (JTInDiffSection) {
1555 if (!JTInDiffSection)
1558 for (
unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
1559 const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
1562 if (JTBBs.empty())
continue;
1571 for (
unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
1573 if (!EmittedSets.
insert(MBB).second)
1596 for (
unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
1597 EmitJumpTableEntry(MJTI, JTBBs[ii], JTI);
1599 if (!JTInDiffSection)
1607 unsigned UID)
const {
1661 assert(Value &&
"Unknown entry kind!");
1671 if (GV->
getName() ==
"llvm.used") {
1686 if (GV->
getName() ==
"llvm.global_ctors") {
1693 if (GV->
getName() ==
"llvm.global_dtors") {
1706 void AsmPrinter::EmitLLVMUsedList(
const ConstantArray *InitList) {
1708 for (
unsigned i = 0, e = InitList->
getNumOperands(); i != e; ++i) {
1723 Structor() =
default;
1734 if (!isa<ConstantArray>(List))
return;
1738 if (!InitList)
return;
1750 for (Value *O : InitList->
operands()) {
1756 if (!Priority)
continue;
1758 Structor &S = Structors.
back();
1768 std::stable_sort(Structors.
begin(), Structors.
end(),
1769 [](
const Structor &
L,
1770 const Structor &R) {
return L.Priority < R.Priority; });
1771 for (Structor &S : Structors) {
1795 void AsmPrinter::EmitModuleIdents(
Module &M) {
1800 for (
unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
1801 const MDNode *
N = NMD->getOperand(i);
1803 "llvm.ident metadata entry can have only one operand");
1836 unsigned Size)
const {
1837 OutStreamer->emitAbsoluteSymbolDiff(Hi, Lo, Size);
1845 bool IsSectionRelative)
const {
1874 if (NumBits == 0)
return;
1877 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
1878 "undefined behavior");
1895 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
1898 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
1901 if (
const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
1922 OS <<
"Unsupported expression in static initializer: ";
1927 case Instruction::GetElementPtr: {
1930 cast<GEPOperator>(CE)->accumulateConstantOffset(
getDataLayout(), OffsetAI);
1941 case Instruction::Trunc:
1947 case Instruction::BitCast:
1950 case Instruction::IntToPtr: {
1961 case Instruction::PtrToInt: {
1984 case Instruction::Sub: {
1993 const MCExpr *RelocExpr =
1999 int64_t Addend = (LHSOffset - RHSOffset).getSExtValue();
2012 case Instruction::Mul:
2013 case Instruction::SDiv:
2014 case Instruction::SRem:
2015 case Instruction::Shl:
2016 case Instruction::And:
2017 case Instruction::Or:
2018 case Instruction::Xor: {
2049 assert(!Data.
empty() &&
"Empty aggregates should be CAZ node");
2051 for (
unsigned i = 1, e = Data.
size(); i != e; ++i)
2052 if (Data[i] != C)
return -1;
2053 return static_cast<uint8_t
>(
C);
2060 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
2074 assert(CA->getNumOperands() != 0 &&
"Should be a CAZ");
2081 for (
unsigned i = 1, e = CA->getNumOperands(); i != e; ++i)
2082 if (CA->getOperand(i) != Op0)
2127 if (
unsigned Padding = Size - EmittedSize)
2158 if (
unsigned Padding = Size - EmittedSize)
2168 uint64_t SizeSoFar = 0;
2179 SizeSoFar += FieldSize + PadSize;
2187 "Layout of constant struct may be incorrect!");
2202 AP.
OutStreamer->GetCommentOS() <<
"Printing <null> Type";
2203 AP.
OutStreamer->GetCommentOS() <<
' ' << StrVal <<
'\n';
2210 unsigned TrailingBytes = NumBytes %
sizeof(uint64_t);
2219 AP.
OutStreamer->EmitIntValue(p[Chunk--], TrailingBytes);
2221 for (; Chunk >= 0; --Chunk)
2222 AP.
OutStreamer->EmitIntValue(p[Chunk],
sizeof(uint64_t));
2225 for (Chunk = 0; Chunk < NumBytes /
sizeof(uint64_t); ++Chunk)
2226 AP.
OutStreamer->EmitIntValue(p[Chunk],
sizeof(uint64_t));
2229 AP.
OutStreamer->EmitIntValue(p[Chunk], TrailingBytes);
2245 uint64_t ExtraBits = 0;
2246 unsigned ExtraBitsSize = BitWidth & 63;
2248 if (ExtraBitsSize) {
2265 ExtraBits = Realigned.getRawData()[0] &
2266 (((uint64_t)-1) >> (64 - ExtraBitsSize));
2267 Realigned.lshrInPlace(ExtraBitsSize);
2269 ExtraBits = Realigned.getRawData()[BitWidth / 64];
2275 const uint64_t *RawData = Realigned.getRawData();
2276 for (
unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
2277 uint64_t Val = DL.
isBigEndian() ? RawData[e - i - 1] : RawData[i];
2281 if (ExtraBitsSize) {
2286 Size -= (BitWidth / 64) * 8;
2287 assert(Size && Size * 8 >= ExtraBitsSize &&
2288 (ExtraBits & (((uint64_t)-1) >> (64 - ExtraBitsSize)))
2289 == ExtraBits &&
"Directive too small for extra bits.");
2322 if (!(*ME)->evaluateAsRelocatable(MV,
nullptr,
nullptr) || MV.
isAbsolute())
2333 const GlobalValue *BaseGV = dyn_cast_or_null<GlobalValue>(BaseCst);
2341 if (!SymB || BaseSym != &SymB->
getSymbol())
2353 if (GOTPCRelCst < 0)
2376 int NumUses = (int)Result.second;
2397 BaseCV = dyn_cast<Constant>(CV->
user_back());
2399 if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
2402 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
2410 CI->getZExtValue());
2419 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
2422 if (isa<ConstantPointerNull>(CV)) {
2436 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
2439 if (CE->getOpcode() == Instruction::BitCast)
2447 if (New && New != CE)
2488 else if (Offset < 0)
2548 <<
"Parent Loop BB" << FunctionNumber <<
"_"
2560 OS.
indent(CL->getLoopDepth()*2)
2561 <<
"Child Loop BB" << FunctionNumber <<
"_"
2562 << CL->getHeader()->getNumber() <<
" Depth " << CL->getLoopDepth()
2577 assert(Header &&
"No header for loop");
2581 if (Header != &MBB) {
2582 AP.
OutStreamer->AddComment(
" in Loop: Header=BB" +
2612 for (
const HandlerInfo &
HI : Handlers) {
2613 HI.Handler->endFunclet();
2614 HI.Handler->beginFunclet(MBB);
2641 if (BB->hasName()) {
2643 false, BB->getModule());
2663 bool IsDefinition)
const {
2666 switch (Visibility) {
2709 if (!
MI.isBranch() ||
MI.isIndirectBranch())
2718 if (
OP->isMBB() &&
OP->getMBB() == MBB)
2731 " stackmap formats, please see the documentation for a description of"
2732 " the default format. If you really need a custom serialized format,"
2733 " please file a bug");
2737 if (GCPI != GCMap.end())
2738 return GCPI->second.get();
2745 if (Name ==
I->getName()) {
2746 std::unique_ptr<GCMetadataPrinter> GMP =
I->instantiate();
2748 auto IterBool = GCMap.insert(std::make_pair(&S, std::move(GMP)));
2749 return IterBool.first->second.get();
2764 const MCSymbol *CurrentFnSym)
const {
2767 auto Kind8 =
static_cast<uint8_t
>(
Kind);
2778 auto PrevSection =
OutStreamer->getCurrentSectionOnly();
2783 if (Fn->hasComdat()) {
2786 Fn->getComdat()->getName());
2789 Fn->getComdat()->getName());
2813 OutStreamer->EmitSymbolValue(IdxRef, WordSizeBytes,
false);
2821 for (
const auto &Sled :
Sleds)
2831 OutStreamer->EmitCodeAlignment(2 * WordSizeBytes);
2833 OutStreamer->EmitSymbolValue(SledsStart, WordSizeBytes);
2834 OutStreamer->EmitSymbolValue(SledsEnd, WordSizeBytes);
2843 bool LogArgs = Fn->hasFnAttribute(
"xray-log-args");
2844 bool AlwaysInstrument =
2853 return OutStreamer->getContext().getDwarfVersion();
2857 OutStreamer->getContext().setDwarfVersion(Version);
virtual void EmitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
void setDwarfVersion(uint16_t Version)
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
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 isEHPad() const
Returns true if the block is a landing pad.
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.
SectionKind getSectionKind(const DataLayout *DL) const
StringRef getPrivateGlobalPrefix() const
StringRef getTargetCPU() const
union llvm::MachineConstantPoolEntry::@132 Val
The constant itself.
Special purpose, only applies to global arrays.
VisibilityTypes getVisibility() const
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Constant * getPrologueData() const
Get the prologue data associated with this function.
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.
DiagnosticInfoOptimizationBase::Argument NV
bool hasIdentDirective() const
bool needsLocalForSize() const
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
static const char *const DbgTimerDescription
MCTargetOptions MCOptions
Machine level options.
STATISTIC(NumFunctions,"Total number of functions")
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
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.
.type _foo, STT_OBJECT # aka
This represents an "assembler immediate".
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
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
const ConstantFP * getFPImm() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
A Module instance is used to store all the information related to an LLVM module. ...
void redefineIfPossible()
Prepare this symbol to be redefined.
float convertToFloat() const
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.
SmallVector< std::unique_ptr< GCStrategy >, 1 >::const_iterator iterator
Same, but only replaced by something equivalent.
static void emitGlobalConstantDataSequential(const DataLayout &DL, const ConstantDataSequential *CDS, AsmPrinter &AP)
MCContext & OutContext
This is the context for the output file that we are streaming.
static cl::opt< bool > PrintSchedule("print-schedule", cl::Hidden, cl::init(false), cl::desc("Print 'sched: [latency:throughput]' in .s output"))
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
MCSymbol * getSymbol(const GlobalValue *GV) const
bool canBeOmittedFromSymbolTable(const GlobalValue *GV)
True if GV can be left out of the object symbol table.
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.
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
unsigned getNumOperands() const
Available for inspection, not emission.
unsigned getNumOperands() const
Return number of MDNode operands.
bool EnablePrintSchedInfo
Enable print [latency:throughput] in output.
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...
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
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...
virtual 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...
Constant * getElementAsConstant(unsigned i) const
Return a Constant for a specified index's element.
Collects and handles dwarf debug information.
bool hasAppendingLinkage() const
virtual void EmitXXStructor(const DataLayout &DL, const Constant *CV)
Targets can override this to change how global constants that are part of a C++ static/global constru...
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 std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Like Internal, but omit from symbol table.
Externally visible function.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool hasAvailableExternallyLinkage() const
bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, APInt &Offset, const DataLayout &DL)
If this constant is a constant offset from a global, return the global and the constant.
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...
MCSection * getDataSection() const
LoopT * getParentLoop() const
unsigned getFunctionNumber() const
Return a unique ID for the current function.
const std::string & str() const
bool hasPrologueData() const
Check whether this function has prologue data.
static const MCBinaryExpr * createAnd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
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
iterator_range< expr_op_iterator > expr_ops() const
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)
Type * getElementType() const
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
std::pair< const GlobalVariable *, unsigned > GOTEquivUsePair
Map global GOT equivalent MCSymbols to GlobalVariables and keep track of its number of uses by other ...
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
static void emitKill(const MachineInstr *MI, AsmPrinter &AP)
static const char *const DWARFGroupDescription
bool hasLinkOnceDirective() const
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
BlockT * getHeader() const
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
Type * getPointerElementType() const
uint64_t getTypeAllocSizeInBits(Type *Ty) const
Returns the offset in bits between successive objects of the specified type, including alignment padd...
bool isOSWindows() const
Tests whether the OS is Windows.
StringRef getName() const
Return a constant reference to the value's name.
bool hasMachoTBSSDirective() const
const Triple & getTargetTriple() 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
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)
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.
bool hasCommonLinkage() const
MCSymbol * createLinkerPrivateTempSymbol()
Create and return a new linker temporary symbol with a unique but unspecified name.
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)
If the specified function has had any references to address-taken blocks generated, but the block got deleted, return the symbol now so we can emit it.
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
static void emitGlobalConstantStruct(const DataLayout &DL, const ConstantStruct *CS, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset)
const APInt & getValue() const
Return the constant as an APInt value reference.
MCSection * SectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
Class to represent struct types.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
This class is basically a combination of TimeRegion and Timer.
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
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
const Module * getModule() const
Constant * getPersonalityFn() const
Get the personality function associated with this function.
Reg
All possible values of the reg field in the ModR/M byte.
iterator_range< iterator > terminators()
APInt bitcastToAPInt() const
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
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const
const GlobalObject * getBaseObject() const
SmallVector< XRayFunctionEntry, 4 > Sleds
uint16_t getDwarfVersion() const
An analysis pass which caches information about the entire Module.
bool hasDebugInfo() const
Returns true if valid debug info is present.
StringRef getName() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This file implements a class to represent arbitrary precision integral constant values and operations...
bool hasPrivateLinkage() const
INLINEASM - Represents an inline asm block.
bool isSplat(unsigned SplatSizeInBits) const
Check if the APInt consists of a repeated bit pattern.
LLVM_NODISCARD bool empty() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
static const char *const CodeViewLineTablesGroupName
void emitXRayTable()
Emit a table with all XRay instrumentation points.
Context object for machine code objects.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Constant * ConstantFoldConstant(const Constant *C, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)
ConstantFoldConstant - Attempt to fold the constant using the specified DataLayout.
static bool needFuncLabelsForEHOrDebugInfo(const MachineFunction &MF, MachineModuleInfo *MMI)
static const MCBinaryExpr * createShl(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
unsigned getCodeViewFlag() const
Returns the CodeView Version by checking module flags.
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.
virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const
Check for post-frame ptr elimination stack locations as well.
MCSection * getBSSSection() const
APInt zextOrSelf(unsigned width) const
Zero extend or truncate to width.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
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.
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
Return the MCSection for the specified mach-o section.
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.
.type _foo, STT_GNU_IFUNC
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.
StringRef getSection() const
Get the custom section of this global if it has one.
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.
virtual void EmitDebugThreadLocal(const MCExpr *Value, unsigned Size) const
Emit the directive and value for debug thread local expression.
SequentialType * getType() const
Specialize the getType() method to always return a SequentialType, which reduces the amount of castin...
This class is a data container for one entry in a MachineConstantPool.
static const fltSemantics & IEEEdouble() LLVM_READNONE
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(const BasicBlock *BB)
Return the symbol to be used for the specified basic block when its address is taken.
virtual void emitImplicitDef(const MachineInstr *MI) const
Targets can override this to customize the output of IMPLICIT_DEF instructions in verbose mode...
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isTvOS() const
Is this an Apple tvOS triple.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Printable PrintReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubRegIdx=0)
Prints virtual and physical registers with or without a TRI instance.
bool isPPC_FP128Ty() const
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.
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...
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
Return the LLVM basic block that this instance corresponded to originally.
static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI)
static void emitGlobalConstantArray(const DataLayout &DL, const ConstantArray *CA, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset)
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...
ExternalWeak linkage description.
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
Return the innermost loop that BB lives in.
bool needsDwarfSectionOffsetDirective() const
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
Same, but only replaced by something equivalent.
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
initializer< Ty > init(const Ty &Val)
void EmitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
Streaming machine code generation interface.
virtual void EmitFunctionBodyEnd()
Targets can override this to emit stuff after the last basic block in the function.
static const char *const EHTimerDescription
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.
unsigned getNumElements() const
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
.weak_def_can_be_hidden (MachO)
MCSymbol * CurrentFnSym
The symbol for the current function.
bool isString(unsigned CharSize=8) const
This method returns true if this is an array of CharSize integers.
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...
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
This is an important base class in LLVM.
uint64_t getElementByteSize() const
Return the size (in bytes) of each element in the array/vector.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
int64_t getSExtValue() const
Get sign extended value.
virtual MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const
Given a constant with the SectionKind, return a section that it should be placed in.
StringRef getAsString() const
If this array is isString(), then this method returns the array as a StringRef.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isThreadData() const
const MachineOperand & getOperand(unsigned i) const
void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind)
StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
MCSymbol * getAddrLabelSymbol(const BasicBlock *BB)
Return the symbol to be used for the specified basic block when its address is taken.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MCSymbol * GetJTSetSymbol(unsigned UID, unsigned MBBID) const
Return the symbol for the specified jump table .set FIXME: privatize to AsmPrinter.
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.
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 hasPersonalityFn() const
Check whether this function has a personality function.
bool hasFunctionAlignment() const
This class is intended to be used as a driving class for all asm writers.
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
Represent the analysis usage information of a pass.
virtual MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const
This file declares a class to represent arbitrary precision floating point values and provide a varie...
bool isWatchOS() const
Is this an Apple watchOS triple.
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
bool isPositionIndependent() const
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.
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit...
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
uint64_t getNumElements() const
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...
self_iterator getIterator()
Ty & getObjFileInfo()
Keep track of various per-function pieces of information for backends that would like to do so...
Constant Vector Declarations.
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
void emitFrameAlloc(const MachineInstr &MI)
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
void computeGlobalGOTEquivs(Module &M)
Unnamed constant global variables solely contaning a pointer to another globals variable act like a g...
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
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
If this is a sequential container of integers (of any size), return the specified element in the low ...
const MCSymbolRefExpr * getSymB() const
bool hasWeakLinkage() const
pred_iterator pred_begin()
Abstract base class for all machine specific constantpool value subclasses.
static void emitGlobalConstantVector(const DataLayout &DL, const ConstantVector *CV, AsmPrinter &AP)
unsigned getDwarfVersion() const
Returns the Dwarf Version by checking module flags.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
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)
StringRef OperationEncodingString(unsigned Encoding)
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.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
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.
virtual unsigned isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const
Check for post-frame ptr elimination stack locations as well.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
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...
virtual const TargetFrameLowering * getFrameLowering() const
bool hasExternalLinkage() const
const MDOperand & getOperand(unsigned I) const
bool hasGlobalUnnamedAddr() const
void emitCFIInstruction(const MachineInstr &MI)
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
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...
bool doesSetDirectiveSuppressReloc() const
This is the shared class of boolean and integer constants.
virtual MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const
bool isFunctionTy() const
True if this is an instance of FunctionType.
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...
virtual bool isVirtualSection() const =0
Check whether this section is "virtual", that is has no actual object file contents.
static const char *const CodeViewLineTablesGroupDescription
virtual 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.
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.
void beginModule()
Emit all Dwarf sections that should come prior to the content.
virtual const TargetLowering * getTargetLowering() const
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.
static SectionKind getReadOnlyWithRel()
uint64_t getSizeInBytes() const
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
BasicBlock * getBasicBlock() const
StringRef str()
Return a StringRef for the vector contents.
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.
MCSymbol * createTempSymbol(const Twine &Name) const
bool isDefined(bool SetUsed=true) const
isDefined - Check if this symbol is defined (i.e., it has an address).
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
bool isPositionIndependent() const
Collects and handles line tables information in a CodeView format.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
std::vector< std::pair< MCSymbol *, StubValueTy >> SymbolListTy
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
void emit(int, MCStreamer *, const MCSymbol *) 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.
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1', drop it.
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 hasEHFunclets() const
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
virtual const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library...
void setPreservesAll()
Set by analyses that do not transform their input at all.
StructType * getType() const
Specialization - reduce amount of casting.
iterator_range< user_iterator > users()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
FunctionNumber(functionNumber)
virtual void emitModuleMetadata(MCStreamer &Streamer, Module &M, const TargetMachine &TM) const
Emit the module-level metadata that the platform cares about.
double convertToDouble() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
TargetSubtargetInfo - Generic base class for all target subtargets.
Iterators for registry entries.
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV)
bool hasLinkOnceLinkage() const
Representation of each machine instruction.
iterator begin() const
begin/end - Iterators for used strategies.
static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *C, AsmPrinter &AP, const Constant *BaseCV=nullptr, uint64_t Offset=0)
bool hasAddressTaken() const
Test whether this block is potentially the target of an indirect branch.
PointerType * getType() const
Global values are always pointers.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
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...
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
Represents a single loop in the control flow graph.
.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.
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
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
Return the number of elements in the array or vector.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
MCSymbol * getMCSymbol() const
MCSubtargetInfo - Generic base class for all target subtargets.
unsigned getPointerSize() const
Return the pointer size from the TargetMachine.
static gcp_map_type & getGCMap(void *&P)
static const MCBinaryExpr * createMod(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
bool hasPrefixData() const
Check whether this function has prefix data.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
std::string getSchedInfoStr(const MachineInstr &MI) const override
Returns string representation of scheduler comment.
Keep one copy of named function when linking (weak)
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
virtual const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *, const MachineBasicBlock *, unsigned, MCContext &) const
Rename collisions when linking (static functions).
const std::string & getSourceFileName() const
Get the module's original source file name.
const Triple & getTargetTriple() const
getTargetTriple - Return the target triple string.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
Constant * getPrefixData() const
Get the prefix data associated with this function.
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.
JTEntryKind getEntryKind() const
const Constant * getIndirectSymbol() const
bool hasLocalLinkage() const
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
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
Specialize the getType() method to always return a VectorType, which reduces the amount of casting ne...
Type * getElementType() const
Return the element type of the array/vector.
unsigned getPointerSize() const
Get the pointer size for this target.
unsigned getReg() const
getReg - Returns the register number.
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, const TargetMachine &TM) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getAlignment() const
int64_t getConstant() const
A raw_ostream that writes to an std::string.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
virtual const TargetInstrInfo * getInstrInfo() const
void EmitGlobalConstant(const DataLayout &DL, const Constant *CV)
Print a general LLVM constant to the .s file.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
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...
bool hasSubsectionsViaSymbols() const
Windows CE ARM, PowerPC, SH3, SH4.
static const char *const DbgTimerName
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
bool isWindowsItaniumEnvironment() const
bool hasWeakDefCanBeHiddenDirective() const
uint64_t getSize() const
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 std::vector< MachineConstantPoolEntry > & getConstants() const
iterator_range< global_iterator > globals()
MachineOptimizationRemarkEmitter * ORE
Optimization remark emitter.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS, AsmPrinter *AP)
emitComments - Pretty-print comments for instructions.
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
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
bool hasDotTypeDotSizeDirective() const
bool isVerbose() const
Return true if assembly output should contain comments.
unsigned getLoopDepth() const
Return the nesting level of this loop.
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
static SectionKind getReadOnly()
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
bool isDeclarationForLinker() const
unsigned pred_size() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
This class contains meta information specific to a module.
This file describes how to lower LLVM code to machine code.
unsigned getAlignment() const
Return alignment of the basic block.
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
unsigned getNumWords() const
Get the number of words.
bool usesWindowsCFI() const
MCSubtargetInfo & getSubtargetCopy(const MCSubtargetInfo &STI)