Go to the documentation of this file.
62 #include "llvm/Config/config.h"
126 using namespace llvm;
128 #define DEBUG_TYPE "asm-printer"
145 STATISTIC(EmittedInsts,
"Number of machine instrs printed");
147 char AsmPrinter::ID = 0;
158 class AddrLabelMapCallbackPtr final :
CallbackVH {
162 AddrLabelMapCallbackPtr() =
default;
171 void deleted()
override;
172 void allUsesReplacedWith(
Value *
V2)
override;
178 struct AddrLabelSymEntry {
190 std::vector<AddrLabelMapCallbackPtr> BBCallbacks;
196 DeletedAddrLabelsNeedingEmission;
203 "Some labels for deleted blocks never got emitted");
209 std::vector<MCSymbol *> &Result);
217 "Shouldn't get label for block without address taken");
218 AddrLabelSymEntry &Entry = AddrLabelSymbols[
BB];
221 if (!Entry.Symbols.empty()) {
222 assert(
BB->getParent() == Entry.Fn &&
"Parent changed");
223 return Entry.Symbols;
228 BBCallbacks.emplace_back(
BB);
229 BBCallbacks.back().setMap(
this);
230 Entry.Index = BBCallbacks.size() - 1;
231 Entry.Fn =
BB->getParent();
234 Entry.Symbols.push_back(Sym);
235 return Entry.Symbols;
240 Function *
F, std::vector<MCSymbol *> &Result) {
242 DeletedAddrLabelsNeedingEmission.find(
F);
245 if (
I == DeletedAddrLabelsNeedingEmission.end())
250 DeletedAddrLabelsNeedingEmission.erase(
I);
258 if (!AddrLabelSymbols)
259 AddrLabelSymbols = std::make_unique<AddrLabelMap>(
OutContext);
260 return AddrLabelSymbols->getAddrLabelSymbolToEmit(
265 const Function *
F, std::vector<MCSymbol *> &Result) {
267 if (!AddrLabelSymbols)
269 return AddrLabelSymbols->takeDeletedSymbolsForFunction(
277 AddrLabelSymEntry Entry =
std::move(AddrLabelSymbols[
BB]);
278 AddrLabelSymbols.erase(
BB);
279 assert(!Entry.Symbols.empty() &&
"Didn't have a symbol, why a callback?");
280 BBCallbacks[Entry.Index] =
nullptr;
282 #if !LLVM_MEMORY_SANITIZER_BUILD
284 assert((
BB->getParent() ==
nullptr ||
BB->getParent() == Entry.Fn) &&
285 "Block/parent mismatch");
288 for (
MCSymbol *Sym : Entry.Symbols) {
296 DeletedAddrLabelsNeedingEmission[Entry.Fn].push_back(Sym);
302 AddrLabelSymEntry OldEntry =
std::move(AddrLabelSymbols[Old]);
303 AddrLabelSymbols.erase(Old);
304 assert(!OldEntry.Symbols.empty() &&
"Didn't have a symbol, why a callback?");
306 AddrLabelSymEntry &NewEntry = AddrLabelSymbols[New];
309 if (NewEntry.Symbols.empty()) {
310 BBCallbacks[OldEntry.Index].setPtr(New);
315 BBCallbacks[OldEntry.Index] =
nullptr;
321 void AddrLabelMapCallbackPtr::deleted() {
322 Map->UpdateForDeletedBlock(cast<BasicBlock>(getValPtr()));
325 void AddrLabelMapCallbackPtr::allUsesReplacedWith(
Value *
V2) {
326 Map->UpdateForRAUWBlock(cast<BasicBlock>(getValPtr()), cast<BasicBlock>(
V2));
335 Alignment =
DL.getPreferredAlign(GVar);
338 if (InAlign > Alignment)
346 assert(GVAlign &&
"GVAlign must be set");
351 Alignment = *GVAlign;
357 OutContext(Streamer->getContext()), OutStreamer(
std::
move(Streamer)) {
363 "Debug/EH info didn't get finalized");
365 if (GCMetadataPrinters) {
369 GCMetadataPrinters =
nullptr;
397 assert(
MF &&
"getSubtargetInfo requires a valid MachineFunction!");
408 "Expected assembly output mode.");
431 auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
432 MMI = MMIWP ? &MMIWP->getMMI() :
nullptr;
433 HasSplitStack =
false;
434 HasNoSplitStack =
false;
436 AddrLabelSymbols =
nullptr;
443 .getModuleMetadata(
M);
456 Triple TVT(
M.getDarwinTargetVariantTriple());
459 M.getDarwinTargetVariantTriple().empty() ?
nullptr : &TVT,
460 M.getDarwinTargetVariantSDKVersion());
474 FileName =
M.getSourceFileName();
476 #ifdef PACKAGE_VENDOR
477 const char VerStr[] =
478 PACKAGE_VENDOR
" " PACKAGE_NAME
" version " PACKAGE_VERSION;
480 const char VerStr[] = PACKAGE_NAME
" version " PACKAGE_VERSION;
483 OutStreamer->emitFileDirective(FileName, VerStr,
"",
"");
490 assert(
MI &&
"AsmPrinter didn't require GCModuleInfo?");
493 MP->beginAssembly(
M, *
MI, *
this);
496 if (!
M.getModuleInlineAsm().empty()) {
497 OutStreamer->AddComment(
"Start of file scope inline assembly");
501 OutStreamer->AddComment(
"End of file scope inline assembly");
506 bool EmitCodeView =
M.getCodeViewFlag();
508 Handlers.emplace_back(std::make_unique<CodeViewDebug>(
this),
513 if (!EmitCodeView ||
M.getDwarfVersion()) {
536 for (
auto &
F :
M.getFunctionList()) {
588 if (mdconst::extract_or_null<ConstantInt>(
M.getModuleFlag(
"cfguard")))
596 HI.Handler->beginModule(&
M);
679 "No emulated TLS variables in the common section");
719 "' is already defined");
736 HI.TimerGroupName,
HI.TimerGroupDescription,
738 HI.Handler->setSymbolSize(GVSym, Size);
743 if (Size == 0) Size = 1;
745 const bool SupportsAlignment =
748 SupportsAlignment ? Alignment.value() : 0);
763 OutStreamer->emitZerofill(TheSection, GVSym, Size, Alignment.value());
782 OutStreamer->emitLocalCommonSymbol(GVSym, Size, Alignment.value());
789 const bool SupportsAlignment =
792 SupportsAlignment ? Alignment.value() : 0);
813 OutStreamer->emitTBSSSymbol(TheSection, MangSym, Size, Alignment.value());
838 unsigned PtrSize =
DL.getPointerTypeSize(GV->
getType());
857 if (LocalAlias != EmittedInitSym)
878 void AsmPrinter::emitFunctionHeaderComment() {}
882 void AsmPrinter::emitFunctionHeader() {
887 <<
"-- Begin function "
920 false,
F.getParent());
921 emitFunctionHeaderComment();
926 if (
F.hasPrefixData()) {
946 unsigned PatchableFunctionPrefix = 0;
947 unsigned PatchableFunctionEntry = 0;
948 (void)
F.getFnAttribute(
"patchable-function-prefix")
950 .getAsInteger(10, PatchableFunctionPrefix);
951 (void)
F.getFnAttribute(
"patchable-function-entry")
953 .getAsInteger(10, PatchableFunctionEntry);
954 if (PatchableFunctionPrefix) {
959 }
else if (PatchableFunctionEntry) {
979 std::vector<MCSymbol*> DeadBlockSyms;
981 for (
MCSymbol *DeadBlockSym : DeadBlockSyms) {
982 OutStreamer->AddComment(
"Address taken block that was later removed");
1001 HI.Handler->beginFunction(
MF);
1005 if (
F.hasPrologueData())
1018 "' is a protected alias");
1039 if ((Size =
MI.getRestoreSize(
TII))) {
1040 CommentOS << *Size <<
"-byte Reload\n";
1041 }
else if ((Size =
MI.getFoldedRestoreSize(
TII))) {
1044 CommentOS <<
"Unknown-size Folded Reload\n";
1046 CommentOS << *Size <<
"-byte Folded Reload\n";
1048 }
else if ((Size =
MI.getSpillSize(
TII))) {
1049 CommentOS << *Size <<
"-byte Spill\n";
1050 }
else if ((Size =
MI.getFoldedSpillSize(
TII))) {
1053 CommentOS <<
"Unknown-size Folded Spill\n";
1055 CommentOS << *Size <<
"-byte Folded Spill\n";
1061 CommentOS <<
" Reload Reuse\n";
1071 OS <<
"implicit-def: "
1083 assert(
Op.isReg() &&
"KILL instruction must have only register operands");
1084 OS <<
' ' << (
Op.isDef() ?
"def " :
"killed ")
1096 if (
MI->isNonListDebugValue() &&
MI->getNumOperands() != 4)
1101 OS <<
"DEBUG_VALUE: ";
1104 if (
auto *SP = dyn_cast<DISubprogram>(V->
getScope())) {
1118 for (
unsigned I = 0;
I <
Op.getNumArgs(); ++
I)
1119 OS <<
' ' <<
Op.getArg(
I);
1126 if (&
Op !=
MI->debug_operands().begin())
1128 switch (
Op.getType()) {
1131 Type *ImmTy =
Op.getFPImm()->getType();
1150 Op.getCImm()->getValue().print(OS,
false );
1154 OS <<
"!target-index(" <<
Op.getIndex() <<
"," <<
Op.getOffset() <<
")";
1176 if (
MI->isIndirectDebugValue())
1182 OS <<
'+' << Offset->getFixed() <<
']';
1199 if (
MI->getNumOperands() != 1)
1204 OS <<
"DEBUG_LABEL: ";
1207 if (
auto *SP = dyn_cast<DISubprogram>(
1223 if (
F.isDeclarationForLinker())
1227 F.needsUnwindTableEntry())
1262 auto *
MBB =
MI.getParent();
1263 auto I = std::next(
MI.getIterator());
1264 while (
I !=
MBB->
end() &&
I->isTransient())
1271 unsigned CFIIndex =
MI.getOperand(0).getCFIIndex();
1278 MCSymbol *FrameAllocSym =
MI.getOperand(0).getMCSymbol();
1279 int FrameOffset =
MI.getOperand(1).getImm();
1306 assert(BBAddrMapSection &&
".llvm_bb_addr_map section is not initialized.");
1331 auto GUID =
MI.getOperand(0).getImm();
1332 auto Index =
MI.getOperand(1).getImm();
1333 auto Type =
MI.getOperand(2).getImm();
1334 auto Attr =
MI.getOperand(3).getImm();
1346 if (!StackSizeSection)
1377 if (StackUsageStream ==
nullptr) {
1382 errs() <<
"Could not open file: " << EC.message();
1389 *StackUsageStream <<
':' << DSP->getLine();
1391 *StackUsageStream <<
':' <<
MF.
getName() <<
'\t' << StackSize <<
'\t';
1393 *StackUsageStream <<
"dynamic\n";
1395 *StackUsageStream <<
"static\n";
1414 emitFunctionHeader();
1421 MDT = getAnalysisIfAvailable<MachineDominatorTree>();
1423 OwnedMDT = std::make_unique<MachineDominatorTree>();
1424 OwnedMDT->getBase().recalculate(*
MF);
1425 MDT = OwnedMDT.get();
1429 MLI = getAnalysisIfAvailable<MachineLoopInfo>();
1431 OwnedMLI = std::make_unique<MachineLoopInfo>();
1433 MLI = OwnedMLI.get();
1438 bool HasAnyRealCode =
false;
1439 int NumInstsInFunction = 0;
1442 for (
auto &
MBB : *
MF) {
1446 for (
auto &
MI :
MBB) {
1448 if (!
MI.isPosition() && !
MI.isImplicitDef() && !
MI.isKill() &&
1449 !
MI.isDebugInstr()) {
1450 HasAnyRealCode =
true;
1451 ++NumInstsInFunction;
1461 HI.Handler->beginInstruction(&
MI);
1467 switch (
MI.getOpcode()) {
1468 case TargetOpcode::CFI_INSTRUCTION:
1471 case TargetOpcode::LOCAL_ESCAPE:
1476 case TargetOpcode::GC_LABEL:
1483 case TargetOpcode::DBG_VALUE:
1484 case TargetOpcode::DBG_VALUE_LIST:
1490 case TargetOpcode::DBG_INSTR_REF:
1495 case TargetOpcode::DBG_PHI:
1499 case TargetOpcode::DBG_LABEL:
1505 case TargetOpcode::IMPLICIT_DEF:
1508 case TargetOpcode::KILL:
1520 if (CanDoExtraAnalysis) {
1537 HI.Handler->endInstruction();
1558 OutStreamer->emitELFSize(CurrentSectionBeginSym, SizeExp);
1566 if (CanDoExtraAnalysis) {
1577 for (
auto &KV : MnemonicCounts)
1580 sort(MnemonicVec, [](
const std::pair<StringRef, unsigned> &A,
1581 const std::pair<StringRef, unsigned> &
B) {
1582 if (A.second >
B.second)
1584 if (A.second ==
B.second)
1589 for (
auto &KV : MnemonicVec) {
1590 auto Name = (
Twine(
"INST_") + getToken(KV.first.trim()).first).str();
1591 R << KV.first <<
": " <<
ore::NV(
Name, KV.second) <<
"\n";
1597 EmittedInsts += NumInstsInFunction;
1601 R <<
ore::NV(
"NumInstructions", NumInstsInFunction)
1602 <<
" instructions in function";
1615 (TT.isOSWindows() && TT.isOSBinFormatCOFF()))) {
1621 OutStreamer->AddComment(
"avoids zero-length function");
1630 for (
const auto &
BB :
F) {
1631 if (!
BB.hasAddressTaken())
1636 OutStreamer->AddComment(
"Address of block that was removed by CodeGen");
1664 HI.Handler->markFunctionEnd();
1677 HI.Handler->endFunction(
MF);
1694 OutStreamer->getCommentOS() <<
"-- End function\n";
1704 if (isa<GlobalVariable>(
C))
1707 unsigned NumUses = 0;
1708 for (
auto *
CU :
C->users())
1720 unsigned &NumGOTEquivUsers) {
1731 for (
auto *U : GV->
users())
1734 return NumGOTEquivUsers > 0;
1748 for (
const auto &
G :
M.globals()) {
1749 unsigned NumGOTEquivUsers = 0;
1768 unsigned Cnt =
I.second.second;
1770 FailedCandidates.push_back(GV);
1774 for (
auto *GV : FailedCandidates)
1792 "Visibility should be handled with emitLinkage() on AIX.");
1834 if (LocalAlias !=
Name)
1853 "IFunc is not supported on AIX.");
1871 if (LocalAlias !=
Name)
1883 Filename = *FilenameRef;
1885 assert(!Filename->empty() &&
"The filename can't be empty.");
1890 std::unique_ptr<remarks::MetaSerializer> MetaSerializer =
1893 MetaSerializer->emit();
1916 for (
const auto &
G :
M.globals())
1926 if (!
F.isDeclarationForLinker())
1941 if (
F.isIntrinsic())
1968 if (!Stubs.empty()) {
1973 for (
const auto &Stub : Stubs) {
1975 OutStreamer->emitSymbolValue(Stub.second.getPointer(),
1976 DL.getPointerSize());
1987 if (!Stubs.empty()) {
1990 for (
const auto &Stub : Stubs) {
2002 OutStreamer->emitSymbolValue(Stub.second.getPointer(),
2003 DL.getPointerSize());
2011 TS->emitConstantPools();
2017 HI.Handler->endModule();
2034 for (
const auto &GO :
M.global_objects()) {
2035 if (!GO.hasExternalWeakLinkage())
2040 auto SymbolName =
"swift_async_extendedFramePointerFlags";
2058 for (
const auto &Alias :
M.aliases()) {
2060 Cur = dyn_cast<GlobalAlias>(Cur->getAliasee())) {
2061 if (!AliasVisited.
insert(Cur).second)
2063 AliasStack.push_back(Cur);
2066 emitGlobalAlias(
M, *AncestorAlias);
2069 for (
const auto &IFunc :
M.ifuncs())
2070 emitGlobalIFunc(
M, IFunc);
2073 assert(
MI &&
"AsmPrinter didn't require GCModuleInfo?");
2076 MP->finishAssembly(
M, *
MI, *
this);
2079 emitModuleIdents(
M);
2082 emitModuleCommandLines(
M);
2089 if (HasNoSplitStack)
2096 Function *InitTrampolineIntrinsic =
M.getFunction(
"llvm.init.trampoline");
2097 if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->
use_empty())
2105 if (!GV.use_empty() && !GV.isTransitiveUsedByMetadataOnly() &&
2106 !GV.isThreadLocal() && !GV.hasDLLImportStorageClass() &&
2107 !GV.getName().startswith(
"llvm.") && !GV.hasAtLeastLocalUnnamedAddr())
2114 unsigned UniqueID = 0;
2116 if (!GV.hasPartition() || GV.isDeclarationForLinker() ||
2122 "",
false, ++UniqueID,
nullptr));
2136 AddrLabelSymbols =
nullptr;
2150 return Res.first->second;
2160 HasSplitStack =
true;
2163 HasNoSplitStack =
true;
2165 HasNoSplitStack =
true;
2172 "Only AIX uses the function descriptor hooks.");
2177 " initalized first.");
2185 CurrentSectionBeginSym =
nullptr;
2187 MBBSectionExceptionSyms.clear();
2189 if (
F.hasFnAttribute(
"patchable-function-entry") ||
2190 F.hasFnAttribute(
"function-instrument") ||
2191 F.hasFnAttribute(
"xray-instruction-threshold") ||
2195 if (NeedsLocalForSize)
2199 ORE = &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE();
2221 const std::vector<MachineConstantPoolEntry> &
CP = MCP->
getConstants();
2222 if (
CP.empty())
return;
2227 for (
unsigned i = 0,
e =
CP.size();
i !=
e; ++
i) {
2243 unsigned SecIdx = CPSections.size();
2244 while (SecIdx != 0) {
2245 if (CPSections[--SecIdx].
S ==
S) {
2251 SecIdx = CPSections.size();
2252 CPSections.push_back(SectionCPs(
S, Alignment));
2255 if (Alignment > CPSections[SecIdx].Alignment)
2256 CPSections[SecIdx].Alignment = Alignment;
2257 CPSections[SecIdx].CPEs.push_back(
i);
2262 unsigned Offset = 0;
2263 for (
unsigned i = 0,
e = CPSections.size();
i !=
e; ++
i) {
2264 for (
unsigned j = 0, ee = CPSections[
i].CPEs.size();
j != ee; ++
j) {
2265 unsigned CPI = CPSections[
i].CPEs[
j];
2270 if (CurSection != CPSections[
i].
S) {
2273 CurSection = CPSections[
i].S;
2302 if (
JT.empty())
return;
2311 if (JTInDiffSection) {
2321 if (!JTInDiffSection)
2324 for (
unsigned JTI = 0,
e =
JT.size(); JTI !=
e; ++JTI) {
2325 const std::vector<MachineBasicBlock*> &JTBBs =
JT[JTI].MBBs;
2328 if (JTBBs.empty())
continue;
2354 if (JTInDiffSection &&
DL.hasLinkerPrivateGlobalPrefix())
2364 emitJumpTableEntry(MJTI,
MBB, JTI);
2366 if (!JTInDiffSection)
2374 unsigned UID)
const {
2438 if (GV->
getName() ==
"llvm.used") {
2453 if (GV->
getName() ==
"llvm.global_ctors") {
2460 if (GV->
getName() ==
"llvm.global_dtors") {
2472 void AsmPrinter::emitLLVMUsedList(
const ConstantArray *InitList) {
2487 if (!isa<ConstantArray>(
List))
2491 for (
Value *
O : cast<ConstantArray>(
List)->operands()) {
2492 auto *CS = cast<ConstantStruct>(
O);
2493 if (CS->getOperand(1)->isNullValue())
2495 ConstantInt *Priority = dyn_cast<ConstantInt>(CS->getOperand(0));
2501 S.Func = CS->getOperand(1);
2502 if (!CS->getOperand(2)->isNullValue()) {
2505 "associated data of XXStructor list is not yet supported on AIX");
2507 dyn_cast<GlobalValue>(CS->getOperand(2)->stripPointerCasts());
2523 if (Structors.empty())
2557 void AsmPrinter::emitModuleIdents(
Module &M) {
2561 if (
const NamedMDNode *NMD =
M.getNamedMetadata(
"llvm.ident")) {
2562 for (
unsigned i = 0,
e = NMD->getNumOperands();
i !=
e; ++
i) {
2563 const MDNode *
N = NMD->getOperand(
i);
2564 assert(
N->getNumOperands() == 1 &&
2565 "llvm.ident metadata entry can have only one operand");
2566 const MDString *
S = cast<MDString>(
N->getOperand(0));
2572 void AsmPrinter::emitModuleCommandLines(
Module &M) {
2577 const NamedMDNode *NMD =
M.getNamedMetadata(
"llvm.commandline");
2586 assert(
N->getNumOperands() == 1 &&
2587 "llvm.commandline metadata entry can have only one operand");
2588 const MDString *
S = cast<MDString>(
N->getOperand(0));
2618 unsigned Size)
const {
2619 OutStreamer->emitAbsoluteSymbolDiff(Hi, Lo, Size);
2627 bool IsSectionRelative)
const {
2651 unsigned MaxBytesToEmit)
const {
2655 if (Alignment ==
Align(1))
2664 OutStreamer->emitCodeAlignment(Alignment.value(), STI, MaxBytesToEmit);
2666 OutStreamer->emitValueToAlignment(Alignment.value(), 0, 1, MaxBytesToEmit);
2679 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
2682 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
2685 if (
const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
2688 if (
const auto *Equiv = dyn_cast<DSOLocalEquivalent>(CV))
2699 switch (CE->getOpcode()) {
2700 case Instruction::AddrSpaceCast: {
2702 unsigned DstAS = CE->getType()->getPointerAddressSpace();
2703 unsigned SrcAS =
Op->getType()->getPointerAddressSpace();
2721 OS <<
"Unsupported expression in static initializer: ";
2722 CE->printAsOperand(OS,
false,
2726 case Instruction::GetElementPtr: {
2729 cast<GEPOperator>(CE)->accumulateConstantOffset(
getDataLayout(), OffsetAI);
2740 case Instruction::Trunc:
2746 case Instruction::BitCast:
2749 case Instruction::IntToPtr: {
2760 case Instruction::PtrToInt: {
2766 Type *Ty = CE->getType();
2775 if (
DL.getTypeAllocSize(Ty).getFixedSize() <=
2776 DL.getTypeAllocSize(
Op->getType()).getFixedSize())
2782 unsigned InBits =
DL.getTypeAllocSizeInBits(
Op->getType());
2787 case Instruction::Sub: {
2797 const MCExpr *RelocExpr =
2809 int64_t Addend = (LHSOffset - RHSOffset).getSExtValue();
2824 case Instruction::SDiv:
2825 case Instruction::SRem:
2826 case Instruction::Shl:
2827 case Instruction::And:
2828 case Instruction::Or:
2829 case Instruction::Xor: {
2832 switch (CE->getOpcode()) {
2861 assert(!
Data.empty() &&
"Empty aggregates should be CAZ node");
2863 for (
unsigned i = 1,
e =
Data.size();
i !=
e; ++
i)
2864 if (
Data[
i] !=
C)
return -1;
2865 return static_cast<uint8_t
>(
C);
2872 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
2878 if (!
Value.isSplat(8))
2881 return Value.zextOrTrunc(8).getZExtValue();
2886 assert(CA->getNumOperands() != 0 &&
"Should be a CAZ");
2893 for (
unsigned i = 1,
e = CA->getNumOperands();
i !=
e; ++
i)
2894 if (CA->getOperand(
i) != Op0)
2937 unsigned Size =
DL.getTypeAllocSize(CDS->
getType());
2938 unsigned EmittedSize =
2940 assert(EmittedSize <= Size &&
"Size cannot be less than EmittedSize!");
2941 if (
unsigned Padding = Size - EmittedSize)
2969 unsigned Size =
DL.getTypeAllocSize(CV->
getType());
2972 if (
unsigned Padding = Size - EmittedSize)
2980 unsigned Size =
DL.getTypeAllocSize(CS->
getType());
2993 SizeSoFar += FieldSize + PadSize;
3001 "Layout of constant struct may be incorrect!");
3005 assert(ET &&
"Unknown float type");
3021 unsigned TrailingBytes = NumBytes %
sizeof(
uint64_t);
3030 AP.
OutStreamer->emitIntValueInHexWithPadding(
p[Chunk--], TrailingBytes);
3032 for (; Chunk >= 0; --Chunk)
3036 for (Chunk = 0; Chunk < NumBytes /
sizeof(
uint64_t); ++Chunk)
3040 AP.
OutStreamer->emitIntValueInHexWithPadding(
p[Chunk], TrailingBytes);
3045 AP.
OutStreamer->emitZeros(
DL.getTypeAllocSize(ET) -
DL.getTypeStoreSize(ET));
3060 unsigned ExtraBitsSize =
BitWidth & 63;
3062 if (ExtraBitsSize) {
3070 if (
DL.isBigEndian()) {
3079 ExtraBitsSize =
alignTo(ExtraBitsSize, 8);
3081 (((
uint64_t)-1) >> (64 - ExtraBitsSize));
3092 uint64_t Val =
DL.isBigEndian() ? RawData[
e -
i - 1] : RawData[
i];
3096 if (ExtraBitsSize) {
3102 assert(Size && Size * 8 >= ExtraBitsSize &&
3103 (ExtraBits & (((
uint64_t)-1) >> (64 - ExtraBitsSize)))
3104 == ExtraBits &&
"Directive too small for extra bits.");
3136 if (!(*ME)->evaluateAsRelocatable(MV,
nullptr,
nullptr) || MV.
isAbsolute())
3147 const GlobalValue *BaseGV = dyn_cast_or_null<GlobalValue>(BaseCst);
3155 if (!SymB || BaseSym != &SymB->
getSymbol())
3166 if (GOTPCRelCst < 0)
3188 int NumUses = (
int)Result.second;
3209 BaseCV = dyn_cast<Constant>(CV->
user_back());
3211 if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
3214 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
3217 if (StoreSize <= 8) {
3220 <<
format(
"0x%" PRIx64
"\n", CI->getZExtValue());
3221 AP.
OutStreamer->emitIntValue(CI->getZExtValue(), StoreSize);
3227 if (Size != StoreSize)
3233 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
3236 if (isa<ConstantPointerNull>(CV)) {
3250 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
3253 if (CE->getOpcode() == Instruction::BitCast)
3301 OS <<
'+' << Offset;
3302 else if (Offset < 0)
3342 if (
MCSymbol *Sym =
S->getCOMDATSymbol()) {
3343 if (Sym->isUndefined())
3385 unsigned FunctionNumber) {
3389 <<
"Parent Loop BB" << FunctionNumber <<
"_"
3397 unsigned FunctionNumber) {
3400 OS.
indent(CL->getLoopDepth()*2)
3401 <<
"Child Loop BB" << FunctionNumber <<
"_"
3402 << CL->getHeader()->getNumber() <<
" Depth " << CL->getLoopDepth()
3417 assert(Header &&
"No header for loop");
3421 if (Header != &
MBB) {
3422 AP.
OutStreamer->AddComment(
" in Loop: Header=BB" +
3453 HI.Handler->endFunclet();
3454 HI.Handler->beginFunclet(
MBB);
3460 if (Alignment !=
Align(1))
3484 if (
BB &&
BB->hasAddressTaken())
3492 if (
BB->hasName()) {
3494 false,
BB->getModule());
3499 assert(
MLI !=
nullptr &&
"MachineLoopInfo should has been computed");
3504 if (shouldEmitLabelForBasicBlock(
MBB)) {
3506 OutStreamer->AddComment(
"Label of block must be emitted");
3526 HI.Handler->beginBasicBlock(
MBB);
3534 HI.Handler->endBasicBlock(
MBB);
3538 bool IsDefinition)
const {
3541 switch (Visibility) {
3558 bool AsmPrinter::shouldEmitLabelForBasicBlock(
3599 if (!
MI.isBranch() ||
MI.isIndirectBranch())
3608 if (
OP->isMBB() &&
OP->getMBB() ==
MBB)
3617 if (!
S.usesMetadata())
3622 if (GCPI != GCMap.
end())
3623 return GCPI->second.get();
3625 auto Name =
S.getName();
3629 if (
Name == GCMetaPrinter.getName()) {
3630 std::unique_ptr<GCMetadataPrinter> GMP = GCMetaPrinter.instantiate();
3633 return IterBool.first->second.get();
3641 assert(
MI &&
"AsmPrinter didn't require GCModuleInfo?");
3642 bool NeedsDefault =
false;
3643 if (
MI->begin() ==
MI->end())
3645 NeedsDefault =
true;
3647 for (
auto &
I : *
MI) {
3649 if (MP->emitStackMaps(SM, *
this))
3653 NeedsDefault =
true;
3669 auto Kind8 =
static_cast<uint8_t
>(
Kind);
3674 auto Padding = (4 * Bytes) - ((2 * Bytes) + 3);
3675 assert(Padding >= 0 &&
"Instrumentation map entry > 4 * Word Size");
3683 auto PrevSection =
OutStreamer->getCurrentSectionOnly();
3689 if (TT.isOSBinFormatELF()) {
3693 if (
F.hasComdat()) {
3695 GroupName =
F.getComdat()->getName();
3698 Flags, 0, GroupName,
F.hasComdat(),
3724 for (
const auto &Sled :
Sleds) {
3725 MCSymbol *Dot = Ctx.createTempSymbol();
3751 OutStreamer->emitSymbolValue(SledsStart, WordSizeBytes,
false);
3752 OutStreamer->emitSymbolValue(SledsEnd, WordSizeBytes,
false);
3761 auto Attr =
F.getFnAttribute(
"function-instrument");
3762 bool LogArgs =
F.hasFnAttribute(
"xray-log-args");
3763 bool AlwaysInstrument =
3764 Attr.isStringAttribute() && Attr.getValueAsString() ==
"xray-always";
3773 unsigned PatchableFunctionPrefix = 0, PatchableFunctionEntry = 0;
3774 (void)
F.getFnAttribute(
"patchable-function-prefix")
3776 .getAsInteger(10, PatchableFunctionPrefix);
3777 (void)
F.getFnAttribute(
"patchable-function-entry")
3779 .getAsInteger(10, PatchableFunctionEntry);
3780 if (!PatchableFunctionPrefix && !PatchableFunctionEntry)
3792 if (
F.hasComdat()) {
3794 GroupName =
F.getComdat()->getName();
3807 return OutStreamer->getContext().getDwarfVersion();
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...
bool isTailCall(const MachineInstr &MI) const override
bool hasSingleParameterDotFile() const
unsigned EmitStackSizeSection
Emit section containing metadata on function stack sizes.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
std::string StackUsageOutput
Name of the stack usage file (i.e., .su file) if user passes -fstack-usage.
virtual MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
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...
const char DWARFGroupName[]
const MCObjectFileInfo * getObjectFileInfo() const
bool isPositionIndependent() const
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
static const MCBinaryExpr * createDiv(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
void emitLabelDifferenceAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) const
Emit something like ".uleb128 Hi-Lo".
bool isThreadLocal() const
static SectionKind getReadOnlyWithRel()
pred_iterator pred_begin()
@ MO_Immediate
Immediate operand.
MapVector< const MCSymbol *, GOTEquivUsePair > GlobalGOTEquivs
This is an optimization pass for GlobalISel generic memory operations.
uint64_t getElementByteSize() const
Return the size (in bytes) of each element in the array/vector.
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
bool doesSetDirectiveSuppressReloc() const
bool hasCommonLinkage() const
A parsed version of the target data layout string in and methods for querying it.
MachineLoop * getLoopFor(const MachineBasicBlock *BB) const
Return the innermost loop that BB lives in.
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...
virtual void emitBasicBlockEnd(const MachineBasicBlock &MBB)
Targets can override this to emit stuff at the end of a basic block.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
Information about stack frame layout on the target.
bool hasOneUse() const
Return true if there is exactly one use of this value.
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
bool getCommDirectiveSupportsAlignment() const
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
unsigned getNumOperands() const
virtual const MCExpr * lowerConstant(const Constant *CV)
Lower the specified LLVM Constant to an MCExpr.
GCStrategy describes a garbage collector algorithm's code generation requirements,...
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
bool hasExternalLinkage() const
void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind, uint8_t Version=0)
static void emitGlobalConstantFP(const ConstantFP *CFP, AsmPrinter &AP)
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
@ IMAGE_SYM_CLASS_STATIC
Static.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
MCSymbol * CurrentFnSymForSize
The symbol used to represent the start of the current function for the purpose of calculating its siz...
@ SjLj
setjmp/longjmp based exceptions
LinkageTypes getLinkage() const
MCSymbol * createTempSymbol(const Twine &Name) const
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
@ HiddenVisibility
The GV is hidden.
unsigned getNumWords() const
Get the number of words.
Context object for machine code objects.
Emits exception handling directives.
static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP)
Represents a single loop in the control flow graph.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
virtual const TargetInstrInfo * getInstrInfo() const
Map a basic block section ID to the begin and end symbols of that section which determine the section...
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
MachineConstantPoolValue * MachineCPVal
@ MCSA_Invalid
Not a valid directive.
A raw_ostream that writes to an std::string.
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...
StringRef getSection() const
Get the custom section of this global if it has one.
const MCAsmInfo * MAI
Target Asm Printer information.
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Target - Wrapper for Target specific information.
bool hasWeakLinkage() const
const APInt & getValue() const
Return the constant as an APInt value reference.
void emitGlobalConstant(const DataLayout &DL, const Constant *CV)
Print a general LLVM constant to the .s file.
const char DbgTimerDescription[]
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MaybeAlign getAlign() const
Returns the alignment of the given variable or function.
static void emitKill(const MachineInstr *MI, AsmPrinter &AP)
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(const BasicBlock *BB)
Return the symbol to be used for the specified basic block when its address is taken.
@ Debug
Emit .debug_frame.
void emitPatchableFunctionEntries()
int64_t getSExtValue() const
Get sign extended value.
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type.
DISubprogram * getSubprogram() const
Get the attached subprogram.
uint64_t getElementAsInteger(unsigned i) const
If this is a sequential container of integers (of any size), return the specified element in the low ...
@ IMAGE_SYM_CLASS_EXTERNAL
External symbol.
Reg
All possible values of the reg field in the ModR/M byte.
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...
@ EH_LABEL
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
bool isEntryBlock() const
Returns true if this is the entry block of the function.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
BasicBlock * getBasicBlock() const
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
static const MCBinaryExpr * createAnd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
virtual const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
MCSymbol * getEHCatchretSymbol() const
Return the EHCatchret Symbol for this basic block.
Triple - Helper class for working with autoconf configuration names.
bool doFinalization(Module &M) override
Shut down the asmprinter.
bool isReturnBlock() const
Convenience function that returns true if the block ends in a return instruction.
void emitStackMaps(StackMaps &SM)
Emit the stack maps.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
bool hasDebugInfo() const
Returns true if valid debug info is present.
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
@ X86
Windows x64, Windows Itanium (IA-64)
Abstract base class for all machine specific constantpool value subclasses.
ScalarTy getFixed() const
StringRef getName() const
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
The instances of the Type class are immutable: once they are created, they are never changed.
union llvm::MachineConstantPoolEntry::@189 Val
The constant itself.
void emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const
Emit an alignment directive to the specified power of two boundary.
const char CodeViewLineTablesGroupDescription[]
Wrapper for a value that won't be replaced with a CFI jump table pointer in LowerTypeTestsModule.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
CFISection getFunctionCFISectionType(const Function &F) const
Get the CFISection type for a function.
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
reverse_self_iterator getReverseIterator()
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
void setDwarfVersion(uint16_t Version)
static int isRepeatedByteSequence(const ConstantDataSequential *V)
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of iden...
virtual MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
@ Itanium
Windows CE ARM, PowerPC, SH3, SH4.
const APFloat & getValueAPF() const
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
virtual MCInst getNop() const
Return the noop instruction to use for a noop.
llvm.global_ctors and llvm.global_dtors are arrays of Structor structs.
@ DefaultVisibility
The GV is visible.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
DiagnosticInfoOptimizationBase::Argument NV
Type * getElementType() const
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Instances of this class represent a single low-level machine instruction.
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
LinkageTypes
An enumeration for the kinds of linkage for global values.
MCSymbol * createNamedTempSymbol()
Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
iterator_range< iterator > terminators()
bool hasFunctionAlignment() const
MachineOptimizationRemarkEmitter * ORE
Optimization remark emitter.
WinEH::EncodingType getWinEHEncodingType() const
static iterator_range< iterator > entries()
MCSymbol * CurrentFnDescSym
The symbol for the current function descriptor on AIX.
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
bool isString(unsigned CharSize=8) const
This method returns true if this is an array of CharSize integers.
the resulting code requires compare and branches when and if * p
static void emitGlobalConstantDataSequential(const DataLayout &DL, const ConstantDataSequential *CDS, AsmPrinter &AP)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void emitBBAddrMapSection(const MachineFunction &MF)
virtual void emitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
@ MO_Register
Register operand.
bool hasInitializer() const
Definitions have initializers, declarations don't.
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
@ ARITH_FENCE
ARITH_FENCE - This corresponds to a arithmetic fence intrinsic.
LLVM Basic Block Representation.
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.
@ INLINEASM
INLINEASM - Represents an inline asm block.
@ AIX
AIX Exception Handling.
=0.0 ? 0.0 :(a > 0.0 ? 1.0 :-1.0) a
@ PSEUDO_PROBE
Pseudo probe for AutoFDO, as a place holder in a basic block to improve the sample counts quality.
bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, APInt &Offset, const DataLayout &DL, DSOLocalEquivalent **DSOEquiv=nullptr)
If this constant is a constant offset from a global, return the global and the constant.
bool isBeginSection() const
Returns true if this block begins any section.
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
void setOpcode(unsigned Op)
JTEntryKind getEntryKind() const
@ MCSA_NoDeadStrip
.no_dead_strip (MachO)
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
APFloat getElementAsAPFloat(unsigned i) const
If this is a sequential container of floating point type, return the specified element as an APFloat.
std::pair< const GlobalVariable *, unsigned > GOTEquivUsePair
Map global GOT equivalent MCSymbols to GlobalVariables and keep track of its number of uses by other ...
static SectionKind getReadOnly()
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
unsigned getNumElements() const
Streaming machine code generation interface.
unsigned pred_size() const
virtual const MCExpr * lowerDSOLocalEquivalent(const DSOLocalEquivalent *Equiv, const TargetMachine &TM) const
This is the shared class of boolean and integer constants.
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
const MachineBasicBlock & front() const
@ IMAGE_SCN_CNT_INITIALIZED_DATA
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
SmallVector< std::unique_ptr< GCStrategy >, 1 >::const_iterator iterator
bool hasFourStringsDotFile() const
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
virtual MCSection * getSectionForCommandLines() const
If supported, return the section to use for the llvm.commandline metadata.
void setSection(MCSection *S)
Indicates the Section this function belongs to.
TargetInstrInfo - Interface to description of machine instruction set.
MCSection * getDataSection() const
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
unsigned getProgramPointerSize() const
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const
This emits linkage information about GVSym based on GV, if this is supported by the target.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Represents a location in source code.
bool hasAppendingLinkage() const
MCSection * getTLSExtraDataSection() const
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
DILocalScope * getNonLexicalBlockFileScope() const
Get the first non DILexicalBlockFile scope of this scope.
static void emitGlobalConstantStruct(const DataLayout &DL, const ConstantStruct *CS, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
static const MCBinaryExpr * createMul(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const char EHTimerDescription[]
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
(vector float) vec_cmpeq(*A, *B) C
unsigned ForceDwarfFrameSection
Emit DWARF debug frame section.
@ MCSA_AltEntry
.alt_entry (MachO)
static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI)
unsigned getMaxBytesForAlignment() const
Return the maximum amount of padding allowed for aligning the basic block.
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
const Triple & getTargetTriple() const
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(BasicBlock *BB)
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
@ MO_FrameIndex
Abstract Stack Frame Index.
SimpleRegistryEntry< T > entry
Represent the analysis usage information of a pass.
virtual void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
virtual void emitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
DenseMap< GCStrategy *, std::unique_ptr< GCMetadataPrinter > > gcp_map_type
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
bool hasPrivateLinkage() const
bool hasBBLabels() const
Returns true if basic block labels are to be generated for this function.
virtual void emitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
const char CFGuardDescription[]
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
constexpr const char * PseudoProbeDescMetadataName
static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP)
emitDebugValueComment - This method handles the target-independent form of DBG_VALUE,...
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
MCTargetOptions MCOptions
Machine level options.
virtual void markFunctionEnd()
const HexagonInstrInfo * TII
SectionKind getSectionKind(const DataLayout *DL) const
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MachineOperand class - Representation of each machine instruction operand.
@ MCSA_ELF_TypeIndFunction
.type _foo, STT_GNU_IFUNC
reverse_iterator rbegin()
ConstantArray - Constant Array Declarations.
double convertToDouble() const
Converts this APFloat to host double value.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
MCSection * getStackSizesSection(const MCSection &TextSec) const
This class contains meta information specific to a module.
bool needsDwarfSectionOffsetDirective() const
virtual void emitInstruction(const MachineInstr *)
Targets should implement this to emit instructions.
MachineLoopInfo * MLI
This is a pointer to the current MachineLoopInfo.
bool useAssignmentForEHBegin() const
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
MCSymbol * CurrentFnSym
The symbol for the current function.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
STATISTIC(NumFunctions, "Total number of functions")
@ Wasm
WebAssembly Exception Handling.
bool isEHCatchretTarget() const
Returns true if this is a target block of a catchret.
This class implements an extremely fast bulk output stream that can only output to a stream.
ConstantFP - Floating Point Values [float, double].
virtual void emitEndOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the end of their file...
const char DWARFGroupDescription[]
bool hasPersonalityFn() const
Check whether this function has a personality function.
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
const MCSymbol & getSymbol() const
int64_t getConstant() const
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
virtual void emitFunctionBodyStart()
Targets can override this to emit stuff before the first basic block in the function.
StringRef getName() const
getName - Get the symbol name.
const MCSymbolRefExpr * getSymA() const
MCSymbol * getSymbol(const GlobalValue *GV) const
bool hasGlobalUnnamedAddr() const
MCSymbol * CurrentPatchableFunctionEntrySym
The symbol for the entry in __patchable_function_entires.
StructType * getType() const
Specialization - reduce amount of casting.
APInt bitcastToAPInt() const
void emitInt8(int Value) const
Emit a byte directive and value.
bool doesUseCFIForDebug() const
@ InternalLinkage
Rename collisions when linking (static functions).
bool hasNoDeadStrip() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
bool isOSAIX() const
Tests whether the OS is AIX.
virtual bool shouldEmitWeakSwiftAsyncExtendedFramePointerFlags() const
bool isFunctionTy() const
True if this is an instance of FunctionType.
virtual MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
MCSymbol * getFunctionBegin() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
virtual void emitBasicBlockStart(const MachineBasicBlock &MBB)
Targets can override this to emit stuff at the start of a basic block.
MCSymbolAttr getProtectedVisibilityAttr() const
unsigned getPointerSize() const
Return the pointer size from the TargetMachine.
virtual MCSymbol * getFunctionEntryPointSymbol(const GlobalValue *Func, const TargetMachine &TM) const
If supported, return the function entry point symbol.
static const MCBinaryExpr * createShl(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
@ EK_LabelDifference32
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table.
bool isPositionIndependent() const
bool hasWeakDefCanBeHiddenDirective() const
virtual void emitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
unsigned getSectionIDNum() const
Returns the unique section ID number of this basic block.
@ MCDR_DataRegionJT32
.data_region jt32
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
DILocalScope * getScope() const
Get the local scope for this variable.
std::vector< HandlerInfo > Handlers
A vector of all debug/EH info emitters we should use.
@ None
Do not emit either .eh_frame or .debug_frame.
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
MachineModuleInfo & getMMI() const
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,...
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
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,...
virtual void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
@ MCSA_WeakDefAutoPrivate
.weak_def_can_be_hidden (MachO)
void emitFrameAlloc(const MachineInstr &MI)
MCSymbol * GetJTSetSymbol(unsigned UID, unsigned MBBID) const
Return the symbol for the specified jump table .set FIXME: privatize to AsmPrinter.
StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
bool hasSection() const
Check if this global has a custom object file section.
bool hasAvailableExternallyLinkage() const
virtual ~AsmPrinterHandler()
Pin vtable to this file.
static bool needFuncLabelsForEHOrDebugInfo(const MachineFunction &MF)
FixedVectorType * getType() const
Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...