33#include "llvm/Config/llvm-config.h"
111 return VAM->getValue();
124 for (
const Value *
Op :
C->operands())
131 unsigned ID = OM.size() + 1;
138 auto OrderConstantValue = [&OM](
const Value *
V) {
143 auto OrderConstantFromMetadata = [&](
Metadata *MD) {
145 OrderConstantValue(VAM->getValue());
147 for (
const auto *VAM : AL->getArgs())
148 OrderConstantValue(VAM->getValue());
153 if (
G.hasInitializer())
169 for (
const Use &U :
F.operands())
175 if (
F.isDeclaration())
188 OrderConstantFromMetadata(DVR.getRawLocation());
189 if (DVR.isDbgAssign())
190 OrderConstantFromMetadata(DVR.getRawAddress());
193 for (
const Value *
Op :
I.operands()) {
206static std::vector<unsigned>
209 using Entry = std::pair<const Use *, unsigned>;
211 for (
const Use &U :
V->uses())
213 if (OM.lookup(U.getUser()))
214 List.
push_back(std::make_pair(&U, List.size()));
225 ID = OM.lookup(BA->getBasicBlock());
226 llvm::sort(List, [&](
const Entry &L,
const Entry &R) {
227 const Use *LU = L.first;
228 const Use *RU = R.first;
232 auto LID = OM.lookup(LU->getUser());
233 auto RID = OM.lookup(RU->getUser());
253 return LU->getOperandNo() < RU->getOperandNo();
254 return LU->getOperandNo() > RU->getOperandNo();
262 std::vector<unsigned> Shuffle(List.size());
263 for (
size_t I = 0,
E = List.size();
I !=
E; ++
I)
264 Shuffle[
I] = List[
I].second;
271 for (
const auto &Pair : OM) {
272 const Value *
V = Pair.first;
273 if (
V->use_empty() || std::next(
V->use_begin()) ==
V->use_end())
276 std::vector<unsigned> Shuffle =
283 F =
I->getFunction();
288 ULOM[
F][
V] = std::move(Shuffle);
295 return MA->getParent() ? MA->getParent()->getParent() :
nullptr;
298 return BB->getParent() ? BB->getParent()->getParent() :
nullptr;
301 const Function *M =
I->getParent() ?
I->getParent()->getParent() :
nullptr;
302 return M ? M->getParent() :
nullptr;
306 return GV->getParent();
331 default: Out <<
"cc" << cc;
break;
354 Out <<
"aarch64_sve_vector_pcs";
357 Out <<
"aarch64_sme_preservemost_from_x0";
360 Out <<
"aarch64_sme_preservemost_from_x1";
363 Out <<
"aarch64_sme_preservemost_from_x2";
370 Out <<
"avr_signalcc";
373 Out <<
"avr_builtincc";
398 Out <<
"amdgpu_cs_chain";
401 Out <<
"amdgpu_cs_chain_preserve";
406 Out <<
"amdgpu_gfx_whole_wave";
410 Out <<
"wasm_emscripten_invokecc";
413 Out <<
"riscv_vector_cc";
415#define CC_VLS_CASE(ABI_VLEN) \
416 case CallingConv::RISCV_VLSCall_##ABI_VLEN: \
417 Out << "riscv_vls_cc(" #ABI_VLEN ")"; \
433 Out <<
"cheriot_compartmentcallcc";
436 Out <<
"cheriot_compartmentcalleecc";
439 Out <<
"cheriot_librarycallcc";
453 assert(!Name.empty() &&
"Cannot get empty name!");
456 bool NeedsQuotes = isdigit(
static_cast<unsigned char>(Name[0]));
458 for (
unsigned char C : Name) {
463 if (!isalnum(
C) &&
C !=
'-' &&
C !=
'.' &&
C !=
'_') {
517 Out << Mask.size() <<
" x i32> ";
519 Out <<
"zeroinitializer";
525 for (
int Elt : Mask) {
540 TypePrinting(
const Module *M =
nullptr)
541 : M(M), TypesIncorporated(M == nullptr) {}
543 TypePrinting(
const TypePrinting &) =
delete;
544 TypePrinting &operator=(
const TypePrinting &) =
delete;
547 TypeFinder &getNamedTypes();
550 std::vector<StructType *> &getNumberedTypes();
556 void printStructBody(StructType *Ty, raw_ostream &OS);
559 void incorporateTypes();
563 bool TypesIncorporated;
565 TypeFinder NamedTypes;
568 DenseMap<StructType *, unsigned> Type2Number;
570 std::vector<StructType *> NumberedTypes;
580std::vector<StructType *> &TypePrinting::getNumberedTypes() {
586 if (NumberedTypes.size() == Type2Number.size())
587 return NumberedTypes;
589 NumberedTypes.resize(Type2Number.size());
590 for (
const auto &
P : Type2Number) {
591 assert(
P.second < NumberedTypes.size() &&
"Didn't get a dense numbering?");
592 assert(!NumberedTypes[
P.second] &&
"Didn't get a unique numbering?");
593 NumberedTypes[
P.second] =
P.first;
595 return NumberedTypes;
598bool TypePrinting::empty() {
600 return NamedTypes.
empty() && Type2Number.empty();
603void TypePrinting::incorporateTypes() {
604 if (TypesIncorporated)
607 NamedTypes.
run(*M,
false);
608 TypesIncorporated =
true;
612 unsigned NextNumber = 0;
614 std::vector<StructType *>::iterator NextToUse = NamedTypes.
begin();
615 for (StructType *STy : NamedTypes) {
617 if (STy->isLiteral())
620 if (STy->getName().empty())
621 Type2Number[STy] = NextNumber++;
626 NamedTypes.erase(NextToUse, NamedTypes.end());
631 bool ForcePrint =
false) {
632 if (AS == 0 && !ForcePrint)
634 OS << Prefix <<
"addrspace(";
636 ? M->getDataLayout().getAddressSpaceName(AS)
639 OS <<
"\"" << ASName <<
"\"";
647void TypePrinting::print(
Type *Ty, raw_ostream &OS) {
649 case Type::VoidTyID: OS <<
"void";
return;
650 case Type::HalfTyID: OS <<
"half";
return;
651 case Type::BFloatTyID: OS <<
"bfloat";
return;
652 case Type::FloatTyID: OS <<
"float";
return;
653 case Type::DoubleTyID: OS <<
"double";
return;
654 case Type::X86_FP80TyID: OS <<
"x86_fp80";
return;
655 case Type::FP128TyID: OS <<
"fp128";
return;
656 case Type::PPC_FP128TyID: OS <<
"ppc_fp128";
return;
657 case Type::LabelTyID: OS <<
"label";
return;
658 case Type::MetadataTyID:
661 case Type::X86_AMXTyID: OS <<
"x86_amx";
return;
662 case Type::TokenTyID: OS <<
"token";
return;
666 case Type::IntegerTyID:
667 OS << 'i' << cast<IntegerType>(Ty)->getBitWidth();
670 case Type::FunctionTyID: {
672 print(FTy->getReturnType(), OS);
675 for (
Type *Ty : FTy->params()) {
684 case Type::StructTyID: {
688 return printStructBody(STy, OS);
694 const auto I = Type2Number.find(STy);
695 if (
I != Type2Number.end())
696 OS <<
'%' <<
I->second;
698 OS <<
"%\"type " << STy <<
'\"';
701 case Type::PointerTyID: {
707 case Type::ArrayTyID: {
709 OS <<
'[' << ATy->getNumElements() <<
" x ";
710 print(ATy->getElementType(), OS);
714 case Type::FixedVectorTyID:
715 case Type::ScalableVectorTyID: {
717 ElementCount
EC = PTy->getElementCount();
721 OS <<
EC.getKnownMinValue() <<
" x ";
722 print(PTy->getElementType(), OS);
726 case Type::TypedPointerTyID: {
732 case Type::TargetExtTyID:
739 Inner->print(OS,
false,
true);
742 OS <<
", " << IntParam;
749void TypePrinting::printStructBody(StructType *STy, raw_ostream &OS) {
791 const Function* TheFunction =
nullptr;
792 bool FunctionProcessed =
false;
793 bool ShouldTrackMetadataDefinitions;
798 ProcessFunctionHookFn;
819 unsigned ModulePathNext = 0;
823 unsigned GUIDNext = 0;
827 unsigned TypeIdNext = 0;
832 unsigned TypeIdCompatibleVtableNext = 0;
838 bool ShouldTrackMetadataDefinitions =
false);
874 FunctionProcessed =
false;
882 void purgeFunction();
889 unsigned mdn_size()
const {
return mdnMap.size(); }
897 unsigned as_size()
const {
return asMap.size(); }
913 void CreateMetadataSlot(
const MDNode *
N);
916 void CreateFunctionSlot(
const Value *V);
921 inline void CreateModulePathSlot(
StringRef Path);
924 void CreateTypeIdCompatibleVtableSlot(
StringRef Id);
938 : M(M), F(F), Machine(&Machine) {}
941 : ShouldCreateStorage(M), M(M) {}
946 if (!ShouldCreateStorage)
949 ShouldCreateStorage =
false;
950 MachineStorage = std::make_unique<SlotTracker>(M);
951 Machine = MachineStorage.get();
952 if (ProcessModuleHookFn)
953 Machine->setProcessHook(ProcessModuleHookFn);
954 if (ProcessFunctionHookFn)
955 Machine->setProcessHook(ProcessFunctionHookFn);
968 Machine->purgeFunction();
969 Machine->incorporateFunction(&F);
974 assert(F &&
"No function incorporated");
975 return Machine->getLocalSlot(V);
980 ProcessModuleHookFn = std::move(Fn);
985 ProcessFunctionHookFn = std::move(Fn);
1015#define ST_DEBUG(X) dbgs() << X
1024 ShouldTrackMetadataDefinitions(ShouldTrackMetadataDefinitions) {}
1029 : TheModule(
F ?
F->
getParent() : nullptr), TheFunction(
F),
1030 ShouldTrackMetadataDefinitions(
false) {}
1033 : TheModule(nullptr), ShouldTrackMetadataDefinitions(
false),
1039 TheModule =
nullptr;
1042 if (TheFunction && !FunctionProcessed)
1049 int NumSlots = processIndex();
1056void SlotTracker::processModule() {
1057 ST_DEBUG(
"begin processModule!\n");
1062 CreateModuleSlot(&Var);
1063 auto Attrs = Var.getAttributes();
1064 if (Attrs.hasAttributes())
1065 CreateAttributeSetSlot(Attrs);
1070 CreateModuleSlot(&
A);
1073 for (
const GlobalIFunc &
I : TheModule->ifuncs()) {
1075 CreateModuleSlot(&
I);
1081 CreateModuleSlot(&
F);
1085 AttributeSet FnAttrs =
F.getAttributes().getFnAttrs();
1087 CreateAttributeSetSlot(FnAttrs);
1090 if (ProcessModuleHookFn)
1091 ProcessModuleHookFn(
this, TheModule);
1097void SlotTracker::processFunction() {
1098 ST_DEBUG(
"begin processFunction!\n");
1103 AE = TheFunction->arg_end(); AI != AE; ++AI)
1105 CreateFunctionSlot(&*AI);
1107 ST_DEBUG(
"Inserting Instructions:\n");
1110 for (
auto &BB : *TheFunction) {
1112 CreateFunctionSlot(&BB);
1114 for (
auto &
I : BB) {
1115 if (!
I.getType()->isVoidTy() && !
I.hasName())
1116 CreateFunctionSlot(&
I);
1123 if (
Attrs.hasAttributes())
1124 CreateAttributeSetSlot(Attrs);
1129 if (ProcessFunctionHookFn)
1130 ProcessFunctionHookFn(
this, TheFunction);
1132 FunctionProcessed =
true;
1134 ST_DEBUG(
"end processFunction!\n");
1138int SlotTracker::processIndex() {
1145 std::vector<StringRef> ModulePaths;
1146 for (
auto &[ModPath,
_] : TheIndex->modulePaths())
1147 ModulePaths.push_back(ModPath);
1149 for (
auto &ModPath : ModulePaths)
1150 CreateModulePathSlot(ModPath);
1153 GUIDNext = ModulePathNext;
1156 for (
const auto &GlobalList : TheIndex->sortedGlobalValueSummariesRange())
1157 CreateGUIDSlot(GlobalList.first);
1160 TypeIdCompatibleVtableNext = GUIDNext;
1161 for (
auto &TId : TheIndex->typeIdCompatibleVtableMap())
1162 CreateTypeIdCompatibleVtableSlot(TId.first);
1165 TypeIdNext = TypeIdCompatibleVtableNext;
1166 for (
const auto &TID : TheIndex->typeIds())
1167 CreateTypeIdSlot(TID.second.first);
1174class MetadataNodeVisitor {
1176 SmallPtrSet<const MDNode *, 32> VisitedMDNodes;
1177 function_ref<void(
const MDNode *)> Visit;
1179 void visit(
const MDNode *
N) {
1184 for (
const MDOperand &
Op :
N->operands())
1190 FLCtx->getUsedMDNodes(UsedMDNodes);
1191 for (
auto *Node : UsedMDNodes)
1196 void visitGlobalObjectMetadata(
const GlobalObject &GO) {
1199 for (
auto &MD : MDs)
1203 void visitDbgRecordMetadata(
const DbgRecord &DR) {
1207 if (DVR->getRawVariable())
1208 visit(DVR->getRawVariable());
1209 if (DVR->isDbgAssign()) {
1210 if (
auto *AssignID = DVR->getRawAssignID())
1216 visit(DLR->getRawLabel());
1224 void visitInstructionMetadata(
const Instruction &
I) {
1226 if (
Function *
F = CI->getCalledFunction())
1227 if (
F->isIntrinsic())
1228 for (
auto &
Op :
I.operands())
1234 I.getAllMetadata(MDs);
1235 for (
auto &MD : MDs)
1239 void visitFunctionMetadata(
const Function &
F) {
1240 visitGlobalObjectMetadata(
F);
1241 for (
const BasicBlock &BB :
F)
1242 for (
const Instruction &
I : BB) {
1243 for (
const DbgRecord &DR :
I.getDbgRecordRange())
1244 visitDbgRecordMetadata(DR);
1245 visitInstructionMetadata(
I);
1250 MetadataNodeVisitor(function_ref<
void(
const MDNode *)> Visit)
1253 void visitModuleMetadata(
const Module &M) {
1254 for (
const GlobalVariable &Var :
M.globals())
1255 visitGlobalObjectMetadata(Var);
1256 for (
const GlobalIFunc &
I :
M.ifuncs())
1257 visitGlobalObjectMetadata(
I);
1258 for (
const NamedMDNode &NMD :
M.named_metadata())
1259 for (
const MDNode *
N : NMD.operands())
1262 visitFunctionMetadata(
F);
1273class MetadataIDRenumberer {
1274 uint32_t NextID = 0;
1280 bool IsAdditionalMetadata =
false;
1281 auto Renumber = [&](
const MDNode *
N) {
1282 N->getContext().pImpl->setMetadataPrintID(
const_cast<MDNode *
>(
N),
1284 if (IsAdditionalMetadata && AdditionalMetadataNodes)
1285 AdditionalMetadataNodes->emplace_back(
1286 N->getContext().pImpl->getMetadataPrintID(
N),
N);
1288 MetadataNodeVisitor Visitor(Renumber);
1290 Visitor.visitModuleMetadata(M);
1292 IsAdditionalMetadata =
true;
1293 Visitor.visitMetadata(AdditionalMetadata);
1297 M.getContext().pImpl->getAllMetadataNodes(RemainingNodes);
1299 return Visitor.contains(
N) ||
1300 M.getContext().pImpl->getMetadataPrintID(
N) >= NextID;
1303 return M.getContext().pImpl->getMetadataPrintID(
LHS) <
1304 M.getContext().pImpl->getMetadataPrintID(
RHS);
1306 for (MDNode *
N : RemainingNodes)
1307 M.getContext().pImpl->setMetadataPrintID(
1308 N,
M.getContext().pImpl->allocateMetadataPrintID());
1310 if (AdditionalMetadataNodes)
1317 MetadataIDRenumberer().run(*
this, {});
1323 assert(M &&
"metadata renumbering requires a module");
1324 MetadataIDRenumberer().run(*M, AdditionalMetadata, AdditionalMetadataNodes);
1330 assert(M &&
"metadata collection requires a module");
1331 bool IsAdditionalMetadata =
false;
1332 auto Collect = [&](
const MDNode *
N) {
1333 if (IsAdditionalMetadata)
1335 N->getContext().pImpl->getMetadataPrintID(
N),
N);
1337 MetadataNodeVisitor Visitor(Collect);
1338 Visitor.visitModuleMetadata(*M);
1339 IsAdditionalMetadata =
true;
1340 Visitor.visitMetadata(AdditionalMetadata);
1348 ST_DEBUG(
"begin purgeFunction!\n");
1350 TheFunction =
nullptr;
1351 FunctionProcessed =
false;
1362 return MI == mMap.end() ? -1 : (int)
MI->second;
1367 ProcessModuleHookFn = std::move(Fn);
1372 ProcessFunctionHookFn = std::move(Fn);
1385 if (ShouldTrackMetadataDefinitions)
1386 CreateMetadataSlot(
N);
1387 return N->getContext().pImpl->getMetadataPrintID(
N);
1398 return FI == fMap.end() ? -1 : (int)FI->second;
1407 return AI == asMap.end() ? -1 : (int)AI->second;
1415 auto I = ModulePathMap.find(Path);
1416 return I == ModulePathMap.end() ? -1 : (int)
I->second;
1425 return I == GUIDMap.end() ? -1 : (int)
I->second;
1433 auto I = TypeIdMap.find(Id);
1434 return I == TypeIdMap.end() ? -1 : (int)
I->second;
1442 auto I = TypeIdCompatibleVtableMap.find(Id);
1443 return I == TypeIdCompatibleVtableMap.end() ? -1 : (int)
I->second;
1447void SlotTracker::CreateModuleSlot(
const GlobalValue *V) {
1448 assert(V &&
"Can't insert a null Value into SlotTracker!");
1449 assert(!V->getType()->isVoidTy() &&
"Doesn't need a slot!");
1450 assert(!V->hasName() &&
"Doesn't need a slot!");
1452 unsigned DestSlot = mNext++;
1455 ST_DEBUG(
" Inserting value [" << V->getType() <<
"] = " << V <<
" slot=" <<
1465void SlotTracker::CreateFunctionSlot(
const Value *
V) {
1466 assert(!
V->getType()->isVoidTy() && !
V->hasName() &&
"Doesn't need a slot!");
1468 unsigned DestSlot = fNext++;
1472 ST_DEBUG(
" Inserting value [" <<
V->getType() <<
"] = " <<
V <<
" slot=" <<
1473 DestSlot <<
" [o]\n");
1477void SlotTracker::CreateMetadataSlot(
const MDNode *
N) {
1478 assert(
N &&
"Can't insert a null Value into SlotTracker!");
1483 unsigned ID =
N->getContext().pImpl->getMetadataPrintID(
N);
1484 if (!mdnMap.try_emplace(
N, ID).second)
1488 for (
const MDOperand &
Op :
N->operands())
1490 CreateMetadataSlot(OpNode);
1496 FLContext->getUsedMDNodes(UsedMDNodes);
1497 for (
auto *Node : UsedMDNodes)
1498 CreateMetadataSlot(Node);
1502void SlotTracker::CreateAttributeSetSlot(
AttributeSet AS) {
1505 if (asMap.try_emplace(AS, asNext).second)
1510void SlotTracker::CreateModulePathSlot(
StringRef Path) {
1511 ModulePathMap[
Path] = ModulePathNext++;
1516 GUIDMap[
GUID] = GUIDNext++;
1520void SlotTracker::CreateTypeIdSlot(
StringRef Id) {
1521 TypeIdMap[
Id] = TypeIdNext++;
1525void SlotTracker::CreateTypeIdCompatibleVtableSlot(
StringRef Id) {
1526 TypeIdCompatibleVtableMap[
Id] = TypeIdCompatibleVtableNext++;
1531struct AsmWriterContext {
1532 TypePrinting *TypePrinter =
nullptr;
1533 SlotTracker *
Machine =
nullptr;
1535 const ModuleSlotTracker *MST =
nullptr;
1537 AsmWriterContext(TypePrinting *TP, SlotTracker *ST,
const Module *M =
nullptr,
1538 const ModuleSlotTracker *MST =
nullptr)
1541 static AsmWriterContext &getEmpty() {
1542 static AsmWriterContext EmptyCtx(
nullptr,
nullptr);
1548 virtual void onWriteMetadataAsOperand(
const Metadata *) {}
1550 virtual ~AsmWriterContext() =
default;
1559 AsmWriterContext &WriterCtx,
1560 bool PrintType =
false);
1563 AsmWriterContext &WriterCtx,
1564 bool FromValue =
false);
1568 Out << FPO->getFastMathFlags();
1571 if (OBO->hasNoUnsignedWrap())
1573 if (OBO->hasNoSignedWrap())
1579 if (PDI->isDisjoint())
1582 if (
GEP->isInBounds())
1584 else if (
GEP->hasNoUnsignedSignedWrap())
1586 if (
GEP->hasNoUnsignedWrap())
1589 Out <<
" inrange(" <<
InRange->getLower() <<
", " <<
InRange->getUpper()
1593 if (NNI->hasNonNeg())
1596 if (TI->hasNoUnsignedWrap())
1598 if (TI->hasNoSignedWrap())
1601 if (ICmp->hasSameSign())
1604 if (ASC->hasNonNull())
1612 unsigned NumDigits = std::max((Val.
getBitWidth() + 3) / 4, 1U);
1614 for (
unsigned i = 0; i < NumDigits - Bits.size(); i++)
1620 bool ForceBitwiseOutput =
false;
1626 ForceBitwiseOutput = !HiWord.
isZero();
1629 if (!ForceBitwiseOutput) {
1632 Out << (APF.
isNegative() ?
'-' :
'+') <<
"inf";
1674 AsmWriterContext &WriterCtx) {
1676 Type *Ty = CI->getType();
1678 if (Ty->isVectorTy()) {
1680 WriterCtx.TypePrinter->print(Ty->getScalarType(), Out);
1684 if (Ty->getScalarType()->isIntegerTy(1))
1685 Out << (CI->getZExtValue() ?
"true" :
"false");
1687 Out << CI->getValue();
1689 if (Ty->isVectorTy())
1696 Type *Ty = CB->getType();
1698 if (Ty->isVectorTy()) {
1700 WriterCtx.TypePrinter->print(Ty->getScalarType(), Out);
1704 Out << CB->getValue();
1706 if (Ty->isVectorTy())
1713 Type *Ty = CFP->getType();
1715 if (Ty->isVectorTy()) {
1716 if (CFP->getValue().bitcastToAPInt().isZero()) {
1717 Out <<
"zeroinitializer";
1722 WriterCtx.TypePrinter->print(Ty->getScalarType(), Out);
1728 if (Ty->isVectorTy())
1735 Out <<
"zeroinitializer";
1740 Out <<
"blockaddress(";
1749 Out <<
"dso_local_equivalent ";
1764 unsigned NumOpsToWrite = 2;
1765 if (!CPA->getOperand(2)->isNullValue())
1773 for (
unsigned i = 0, e = NumOpsToWrite; i != e; ++i) {
1785 for (
const Value *
Op : CA->operands()) {
1796 if (CA->isString()) {
1805 for (
uint64_t i = 0, e = CA->getNumElements(); i != e; ++i) {
1815 if (CS->getType()->isPacked())
1818 if (CS->getNumOperands() != 0) {
1821 for (
const Value *
Op : CS->operands()) {
1828 if (CS->getType()->isPacked())
1853 for (
unsigned i = 0, e = CVVTy->getNumElements(); i != e; ++i) {
1897 if (CE->getOpcode() == Instruction::ShuffleVector) {
1898 if (
auto *SplatVal = CE->getSplatValue()) {
1909 Out << CE->getOpcodeName();
1914 WriterCtx.TypePrinter->print(
GEP->getSourceElementType(), Out);
1919 for (
const Value *
Op : CE->operands()) {
1926 WriterCtx.TypePrinter->print(CE->getType(), Out);
1929 if (CE->getOpcode() == Instruction::ShuffleVector)
1936 Out <<
"<placeholder or erroneous Constant>";
1940 AsmWriterContext &WriterCtx) {
1948 Value *
V = MDV->getValue();
1952 WriterCtx.onWriteMetadataAsOperand(MD);
1961struct MDFieldPrinter {
1964 AsmWriterContext &WriterCtx;
1966 explicit MDFieldPrinter(raw_ostream &Out)
1967 :
Out(
Out), WriterCtx(AsmWriterContext::getEmpty()) {}
1968 MDFieldPrinter(raw_ostream &Out, AsmWriterContext &Ctx)
1969 :
Out(
Out), WriterCtx(Ctx) {}
1971 void printTag(
const DINode *
N);
1972 void printMacinfoType(
const DIMacroNode *
N);
1973 void printChecksum(
const DIFile::ChecksumInfo<StringRef> &
N);
1974 void printString(StringRef Name, StringRef
Value,
1975 bool ShouldSkipEmpty =
true);
1976 void printMetadata(StringRef Name,
const Metadata *MD,
1977 bool ShouldSkipNull =
true);
1978 void printMetadataOrInt(StringRef Name,
const Metadata *MD,
bool IsUnsigned,
1979 bool ShouldSkipZero =
true);
1980 template <
class IntTy>
1981 void printInt(StringRef Name, IntTy
Int,
bool ShouldSkipZero =
true);
1982 void printAPInt(StringRef Name,
const APInt &
Int,
bool IsUnsigned,
1983 bool ShouldSkipZero);
1984 void printBool(StringRef Name,
bool Value,
1985 std::optional<bool>
Default = std::nullopt);
1988 template <
class IntTy,
class Stringifier>
1989 void printDwarfEnum(StringRef Name, IntTy
Value, Stringifier
toString,
1990 bool ShouldSkipZero =
true);
1992 void printNameTableKind(StringRef Name,
1999void MDFieldPrinter::printTag(
const DINode *
N) {
2000 Out <<
FS <<
"tag: ";
2008void MDFieldPrinter::printMacinfoType(
const DIMacroNode *
N) {
2009 Out <<
FS <<
"type: ";
2014 Out <<
N->getMacinfoType();
2017void MDFieldPrinter::printChecksum(
2020 printString(
"checksum", Checksum.
Value,
false);
2024 bool ShouldSkipEmpty) {
2025 if (ShouldSkipEmpty &&
Value.empty())
2034 AsmWriterContext &WriterCtx) {
2040 WriterCtx.onWriteMetadataAsOperand(MD);
2044 bool ShouldSkipNull) {
2045 if (ShouldSkipNull && !MD)
2053 bool IsUnsigned,
bool ShouldSkipZero) {
2060 printInt(Name, CV->getZExtValue(), ShouldSkipZero);
2062 printInt(Name, CV->getSExtValue(), ShouldSkipZero);
2064 printMetadata(Name, MD);
2067template <
class IntTy>
2068void MDFieldPrinter::printInt(
StringRef Name, IntTy
Int,
bool ShouldSkipZero) {
2069 if (ShouldSkipZero && !
Int)
2076 bool IsUnsigned,
bool ShouldSkipZero) {
2077 if (ShouldSkipZero &&
Int.isZero())
2081 Int.print(Out, !IsUnsigned);
2085 std::optional<bool>
Default) {
2101 for (
auto F : SplitFlags) {
2103 assert(!StringF.empty() &&
"Expected valid flag");
2104 Out << FlagsFS << StringF;
2106 if (Extra || SplitFlags.empty())
2107 Out << FlagsFS << Extra;
2110void MDFieldPrinter::printDISPFlags(
StringRef Name,
2125 for (
auto F : SplitFlags) {
2127 assert(!StringF.empty() &&
"Expected valid flag");
2128 Out << FlagsFS << StringF;
2130 if (Extra || SplitFlags.empty())
2131 Out << FlagsFS << Extra;
2134void MDFieldPrinter::printEmissionKind(
StringRef Name,
2139void MDFieldPrinter::printNameTableKind(
StringRef Name,
2146void MDFieldPrinter::printFixedPointKind(
StringRef Name,
2151template <
class IntTy,
class Stringifier>
2153 Stringifier
toString,
bool ShouldSkipZero) {
2154 if (ShouldSkipZero && !
Value)
2166 AsmWriterContext &WriterCtx) {
2167 Out <<
"!GenericDINode(";
2168 MDFieldPrinter
Printer(Out, WriterCtx);
2170 Printer.printString(
"header",
N->getHeader());
2171 if (
N->getNumDwarfOperands()) {
2172 Out <<
Printer.FS <<
"operands: {";
2174 for (
auto &
I :
N->dwarf_operands()) {
2184 AsmWriterContext &WriterCtx) {
2185 Out <<
"!!scope(scope: ";
2190 AsmWriterContext &WriterCtx) {
2191 Out <<
"!!srcLoc(line: " << SrcLoc.
Line;
2193 Out <<
", column: " << SrcLoc.
Column;
2194 Out <<
", scope: " << SrcLoc.
ScopeIdx.get() <<
")";
2197 AsmWriterContext &WriterCtx) {
2199 Out <<
"!!inlinedCall(";
2201 Out << LS <<
"srcLoc: " << InlinedCall.
SrcLocIdx.get();
2203 Out << LS <<
"inlinedAt: " << InlinedCall.
InlinedAtIdx.get();
2205 Out << LS <<
"uniquable: true";
2206 Out << LS <<
"inlineeContext: ";
2213 AsmWriterContext &WriterCtx) {
2214 Out <<
"!MDFunctionLocalContext(";
2217 Out << LS <<
"nonDebug: true";
2219 auto WriteEntries = [&](
StringRef Name,
auto Nodes) {
2220 Out << LS << Name <<
": [";
2232 Out <<
", ; " << Index <<
"\n";
2239 WriteEntries(
"scopes", FLMD->
getScopes());
2248 AsmWriterContext &WriterCtx) {
2249 Out <<
"!DILocation(";
2250 MDFieldPrinter
Printer(Out, WriterCtx);
2252 Printer.printInt(
"line",
DL->getLine(),
false);
2253 Printer.printInt(
"column",
DL->getColumn());
2254 Printer.printMetadata(
"scope",
DL->getRawScope(),
false);
2255 Printer.printMetadata(
"inlinedAt",
DL->getRawInlinedAt());
2256 Printer.printBool(
"isImplicitCode",
DL->isImplicitCode(),
2258 Printer.printInt(
"atomGroup",
DL->getAtomGroup());
2259 Printer.printInt<
unsigned>(
"atomRank",
DL->getAtomRank());
2260 Printer.printMetadata(
"irlayers",
DL->getRawIRLayers());
2265 AsmWriterContext &WriterCtx) {
2266 Out <<
"!DILayerLoc(";
2267 MDFieldPrinter
Printer(Out, WriterCtx);
2268 Printer.printInt(
"line",
N->getLine(),
false);
2269 Printer.printInt(
"column",
N->getColumn());
2270 Printer.printMetadata(
"file",
N->getRawFile(),
false);
2271 Printer.printString(
"kind",
N->getKind(),
false);
2276 AsmWriterContext &WriterCtx) {
2277 Out <<
"!DILayerLocList(";
2287 AsmWriterContext &WriterCtx) {
2288 Out <<
"!DIAssignID()";
2289 MDFieldPrinter
Printer(Out, WriterCtx);
2293 AsmWriterContext &WriterCtx) {
2294 Out <<
"!DISubrange(";
2295 MDFieldPrinter
Printer(Out, WriterCtx);
2297 Printer.printMetadataOrInt(
"count",
N->getRawCountNode(),
2303 Printer.printMetadataOrInt(
"lowerBound",
N->getRawLowerBound(),
2306 Printer.printMetadataOrInt(
"upperBound",
N->getRawUpperBound(),
2309 Printer.printMetadataOrInt(
"stride",
N->getRawStride(),
2317 AsmWriterContext &WriterCtx) {
2318 Out <<
"!DIGenericSubrange(";
2319 MDFieldPrinter
Printer(Out, WriterCtx);
2321 auto GetConstant = [&](
Metadata *Bound) -> std::optional<int64_t> {
2324 return std::nullopt;
2325 if (BE->isConstant() &&
2327 *BE->isConstant()) {
2328 return static_cast<int64_t
>(BE->getElement(1));
2330 return std::nullopt;
2333 auto *
Count =
N->getRawCountNode();
2334 if (
auto ConstantCount = GetConstant(
Count))
2335 Printer.printInt(
"count", *ConstantCount,
2340 auto *LBound =
N->getRawLowerBound();
2341 if (
auto ConstantLBound = GetConstant(LBound))
2342 Printer.printInt(
"lowerBound", *ConstantLBound,
2345 Printer.printMetadata(
"lowerBound", LBound,
true);
2347 auto *UBound =
N->getRawUpperBound();
2348 if (
auto ConstantUBound = GetConstant(UBound))
2349 Printer.printInt(
"upperBound", *ConstantUBound,
2352 Printer.printMetadata(
"upperBound", UBound,
true);
2354 auto *Stride =
N->getRawStride();
2355 if (
auto ConstantStride = GetConstant(Stride))
2356 Printer.printInt(
"stride", *ConstantStride,
2359 Printer.printMetadata(
"stride", Stride,
true);
2365 AsmWriterContext &) {
2366 Out <<
"!DIEnumerator(";
2368 Printer.printString(
"name",
N->getName(),
false);
2369 Printer.printAPInt(
"value",
N->getValue(),
N->isUnsigned(),
2371 if (
N->isUnsigned())
2372 Printer.printBool(
"isUnsigned",
true);
2377 AsmWriterContext &WriterCtx) {
2378 Out <<
"!DIBasicType(";
2379 MDFieldPrinter
Printer(Out, WriterCtx);
2380 if (
N->getTag() != dwarf::DW_TAG_base_type)
2382 Printer.printString(
"name",
N->getName());
2383 Printer.printMetadata(
"scope",
N->getRawScope());
2384 Printer.printMetadata(
"file",
N->getRawFile());
2385 Printer.printInt(
"line",
N->getLine());
2386 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2387 Printer.printInt(
"align",
N->getAlignInBits());
2388 Printer.printInt(
"dataSize",
N->getDataSizeInBits());
2389 Printer.printDwarfEnum(
"encoding",
N->getEncoding(),
2391 Printer.printInt(
"num_extra_inhabitants",
N->getNumExtraInhabitants());
2392 Printer.printDIFlags(
"flags",
N->getFlags());
2397 AsmWriterContext &WriterCtx) {
2398 Out <<
"!DIFixedPointType(";
2399 MDFieldPrinter
Printer(Out, WriterCtx);
2400 if (
N->getTag() != dwarf::DW_TAG_base_type)
2402 Printer.printString(
"name",
N->getName());
2403 Printer.printMetadata(
"scope",
N->getRawScope());
2404 Printer.printMetadata(
"file",
N->getRawFile());
2405 Printer.printInt(
"line",
N->getLine());
2406 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2407 Printer.printInt(
"align",
N->getAlignInBits());
2408 Printer.printDwarfEnum(
"encoding",
N->getEncoding(),
2410 Printer.printDIFlags(
"flags",
N->getFlags());
2411 Printer.printFixedPointKind(
"kind",
N->getKind());
2412 if (
N->isRational()) {
2413 bool IsUnsigned = !
N->isSigned();
2414 Printer.printAPInt(
"numerator",
N->getNumerator(), IsUnsigned,
false);
2415 Printer.printAPInt(
"denominator",
N->getDenominator(), IsUnsigned,
false);
2417 Printer.printInt(
"factor",
N->getFactor());
2423 AsmWriterContext &WriterCtx) {
2424 Out <<
"!DIStringType(";
2425 MDFieldPrinter
Printer(Out, WriterCtx);
2426 if (
N->getTag() != dwarf::DW_TAG_string_type)
2428 Printer.printString(
"name",
N->getName());
2429 Printer.printMetadata(
"stringLength",
N->getRawStringLength());
2430 Printer.printMetadata(
"stringLengthExpression",
N->getRawStringLengthExp());
2431 Printer.printMetadata(
"stringLocationExpression",
2432 N->getRawStringLocationExp());
2433 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2434 Printer.printInt(
"align",
N->getAlignInBits());
2435 Printer.printDwarfEnum(
"encoding",
N->getEncoding(),
2437 Printer.printMetadata(
"charType",
N->getRawCharType());
2442 AsmWriterContext &WriterCtx) {
2443 Out <<
"!DIDerivedType(";
2444 MDFieldPrinter
Printer(Out, WriterCtx);
2446 Printer.printString(
"name",
N->getName());
2447 Printer.printMetadata(
"scope",
N->getRawScope());
2448 Printer.printMetadata(
"file",
N->getRawFile());
2449 Printer.printInt(
"line",
N->getLine());
2450 Printer.printMetadata(
"baseType",
N->getRawBaseType(),
2452 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2453 Printer.printInt(
"align",
N->getAlignInBits());
2454 Printer.printMetadataOrInt(
"offset",
N->getRawOffsetInBits(),
true);
2455 Printer.printDIFlags(
"flags",
N->getFlags());
2456 Printer.printMetadata(
"extraData",
N->getRawExtraData());
2457 if (
const auto &DWARFAddressSpace =
N->getDWARFAddressSpace())
2458 Printer.printInt(
"dwarfAddressSpace", *DWARFAddressSpace,
2460 Printer.printMetadata(
"annotations",
N->getRawAnnotations());
2461 if (
auto PtrAuthData =
N->getPtrAuthData()) {
2462 Printer.printInt(
"ptrAuthKey", PtrAuthData->key());
2463 Printer.printBool(
"ptrAuthIsAddressDiscriminated",
2464 PtrAuthData->isAddressDiscriminated());
2465 Printer.printInt(
"ptrAuthExtraDiscriminator",
2466 PtrAuthData->extraDiscriminator());
2467 Printer.printBool(
"ptrAuthIsaPointer", PtrAuthData->isaPointer());
2468 Printer.printBool(
"ptrAuthAuthenticatesNullValues",
2469 PtrAuthData->authenticatesNullValues());
2475 AsmWriterContext &WriterCtx) {
2476 Out <<
"!DISubrangeType(";
2477 MDFieldPrinter
Printer(Out, WriterCtx);
2478 Printer.printString(
"name",
N->getName());
2479 Printer.printMetadata(
"scope",
N->getRawScope());
2480 Printer.printMetadata(
"file",
N->getRawFile());
2481 Printer.printInt(
"line",
N->getLine());
2482 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2483 Printer.printInt(
"align",
N->getAlignInBits());
2484 Printer.printDIFlags(
"flags",
N->getFlags());
2485 Printer.printMetadata(
"baseType",
N->getRawBaseType(),
2487 Printer.printMetadata(
"lowerBound",
N->getRawLowerBound());
2488 Printer.printMetadata(
"upperBound",
N->getRawUpperBound());
2489 Printer.printMetadata(
"stride",
N->getRawStride());
2490 Printer.printMetadata(
"bias",
N->getRawBias());
2495 AsmWriterContext &WriterCtx) {
2496 Out <<
"!DICompositeType(";
2497 MDFieldPrinter
Printer(Out, WriterCtx);
2499 Printer.printString(
"name",
N->getName());
2500 Printer.printMetadata(
"scope",
N->getRawScope());
2501 Printer.printMetadata(
"file",
N->getRawFile());
2502 Printer.printInt(
"line",
N->getLine());
2503 Printer.printMetadata(
"baseType",
N->getRawBaseType());
2504 Printer.printMetadataOrInt(
"size",
N->getRawSizeInBits(),
true);
2505 Printer.printInt(
"align",
N->getAlignInBits());
2506 Printer.printMetadataOrInt(
"offset",
N->getRawOffsetInBits(),
true);
2507 Printer.printInt(
"num_extra_inhabitants",
N->getNumExtraInhabitants());
2508 Printer.printDIFlags(
"flags",
N->getFlags());
2509 Printer.printMetadata(
"elements",
N->getRawElements());
2510 Printer.printDwarfEnum(
"runtimeLang",
N->getRuntimeLang(),
2512 Printer.printMetadata(
"vtableHolder",
N->getRawVTableHolder());
2513 Printer.printMetadata(
"templateParams",
N->getRawTemplateParams());
2514 Printer.printString(
"identifier",
N->getIdentifier());
2515 Printer.printMetadata(
"discriminator",
N->getRawDiscriminator());
2516 Printer.printMetadata(
"dataLocation",
N->getRawDataLocation());
2517 Printer.printMetadata(
"associated",
N->getRawAssociated());
2518 Printer.printMetadata(
"allocated",
N->getRawAllocated());
2519 if (
auto *RankConst =
N->getRankConst())
2520 Printer.printInt(
"rank", RankConst->getSExtValue(),
2523 Printer.printMetadata(
"rank",
N->getRawRank(),
true);
2524 Printer.printMetadata(
"annotations",
N->getRawAnnotations());
2525 if (
auto *Specification =
N->getRawSpecification())
2526 Printer.printMetadata(
"specification", Specification);
2528 if (
auto EnumKind =
N->getEnumKind())
2532 Printer.printMetadata(
"bitStride",
N->getRawBitStride());
2537 AsmWriterContext &WriterCtx) {
2538 Out <<
"!DISubroutineType(";
2539 MDFieldPrinter
Printer(Out, WriterCtx);
2540 Printer.printDIFlags(
"flags",
N->getFlags());
2542 Printer.printMetadata(
"types",
N->getRawTypeArray(),
2550 Printer.printString(
"filename",
N->getFilename(),
2552 Printer.printString(
"directory",
N->getDirectory(),
2555 if (
N->getChecksum())
2556 Printer.printChecksum(*
N->getChecksum());
2558 Printer.printString(
"source", *
N->getSource(),
2564 AsmWriterContext &WriterCtx) {
2565 Out <<
"!DICompileUnit(";
2566 MDFieldPrinter
Printer(Out, WriterCtx);
2572 "sourceLanguageName",
2584 Printer.printMetadata(
"file",
N->getRawFile(),
false);
2585 Printer.printString(
"producer",
N->getProducer());
2586 Printer.printBool(
"isOptimized",
N->isOptimized());
2587 Printer.printString(
"flags",
N->getFlags());
2588 Printer.printInt(
"runtimeVersion",
N->getRuntimeVersion(),
2590 Printer.printString(
"splitDebugFilename",
N->getSplitDebugFilename());
2591 Printer.printEmissionKind(
"emissionKind",
N->getEmissionKind());
2592 Printer.printMetadata(
"enums",
N->getRawEnumTypes());
2593 Printer.printMetadata(
"retainedTypes",
N->getRawRetainedTypes());
2594 Printer.printMetadata(
"globals",
N->getRawGlobalVariables());
2595 Printer.printMetadata(
"imports",
N->getRawImportedEntities());
2596 Printer.printMetadata(
"macros",
N->getRawMacros());
2597 Printer.printInt(
"dwoId",
N->getDWOId());
2598 Printer.printBool(
"splitDebugInlining",
N->getSplitDebugInlining(),
true);
2599 Printer.printBool(
"debugInfoForProfiling",
N->getDebugInfoForProfiling(),
2601 Printer.printNameTableKind(
"nameTableKind",
N->getNameTableKind());
2602 Printer.printBool(
"rangesBaseAddress",
N->getRangesBaseAddress(),
false);
2603 Printer.printString(
"sysroot",
N->getSysRoot());
2604 Printer.printString(
"sdk",
N->getSDK());
2611 AsmWriterContext &WriterCtx) {
2612 Out <<
"!DISubprogram(";
2613 MDFieldPrinter
Printer(Out, WriterCtx);
2614 Printer.printString(
"name",
N->getName());
2615 Printer.printString(
"linkageName",
N->getLinkageName());
2616 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2617 Printer.printMetadata(
"file",
N->getRawFile());
2618 Printer.printInt(
"line",
N->getLine());
2619 Printer.printMetadata(
"type",
N->getRawType());
2620 Printer.printInt(
"scopeLine",
N->getScopeLine());
2621 Printer.printMetadata(
"containingType",
N->getRawContainingType());
2622 if (
N->getVirtuality() != dwarf::DW_VIRTUALITY_none ||
2623 N->getVirtualIndex() != 0)
2624 Printer.printInt(
"virtualIndex",
N->getVirtualIndex(),
false);
2625 Printer.printInt(
"thisAdjustment",
N->getThisAdjustment());
2626 Printer.printDIFlags(
"flags",
N->getFlags());
2627 Printer.printDISPFlags(
"spFlags",
N->getSPFlags());
2628 Printer.printMetadata(
"unit",
N->getRawUnit());
2629 Printer.printMetadata(
"templateParams",
N->getRawTemplateParams());
2630 Printer.printMetadata(
"declaration",
N->getRawDeclaration());
2631 Printer.printMetadata(
"retainedNodes",
N->getRawRetainedNodes());
2632 Printer.printMetadata(
"thrownTypes",
N->getRawThrownTypes());
2633 Printer.printMetadata(
"annotations",
N->getRawAnnotations());
2634 Printer.printString(
"targetFuncName",
N->getTargetFuncName());
2635 Printer.printBool(
"keyInstructions",
N->getKeyInstructionsEnabled(),
false);
2640 AsmWriterContext &WriterCtx) {
2641 Out <<
"!DILexicalBlock(";
2642 MDFieldPrinter
Printer(Out, WriterCtx);
2643 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2644 Printer.printMetadata(
"file",
N->getRawFile());
2645 Printer.printInt(
"line",
N->getLine());
2646 Printer.printInt(
"column",
N->getColumn());
2652 AsmWriterContext &WriterCtx) {
2653 Out <<
"!DILexicalBlockFile(";
2654 MDFieldPrinter
Printer(Out, WriterCtx);
2655 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2656 Printer.printMetadata(
"file",
N->getRawFile());
2657 Printer.printInt(
"discriminator",
N->getDiscriminator(),
2663 AsmWriterContext &WriterCtx) {
2664 Out <<
"!DINamespace(";
2665 MDFieldPrinter
Printer(Out, WriterCtx);
2666 Printer.printString(
"name",
N->getName());
2667 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2668 Printer.printBool(
"exportSymbols",
N->getExportSymbols(),
false);
2673 AsmWriterContext &WriterCtx) {
2674 Out <<
"!DICommonBlock(";
2675 MDFieldPrinter
Printer(Out, WriterCtx);
2676 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2677 Printer.printMetadata(
"declaration",
N->getRawDecl(),
false);
2678 Printer.printString(
"name",
N->getName());
2679 Printer.printMetadata(
"file",
N->getRawFile());
2680 Printer.printInt(
"line",
N->getLineNo());
2685 AsmWriterContext &WriterCtx) {
2687 MDFieldPrinter
Printer(Out, WriterCtx);
2689 Printer.printInt(
"line",
N->getLine());
2690 Printer.printString(
"name",
N->getName());
2691 Printer.printString(
"value",
N->getValue());
2696 AsmWriterContext &WriterCtx) {
2697 Out <<
"!DIMacroFile(";
2698 MDFieldPrinter
Printer(Out, WriterCtx);
2699 Printer.printInt(
"line",
N->getLine());
2700 Printer.printMetadata(
"file",
N->getRawFile(),
false);
2701 Printer.printMetadata(
"nodes",
N->getRawElements());
2706 AsmWriterContext &WriterCtx) {
2707 Out <<
"!DIModule(";
2708 MDFieldPrinter
Printer(Out, WriterCtx);
2709 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2710 Printer.printString(
"name",
N->getName());
2711 Printer.printString(
"configMacros",
N->getConfigurationMacros());
2712 Printer.printString(
"includePath",
N->getIncludePath());
2713 Printer.printString(
"apinotes",
N->getAPINotesFile());
2714 Printer.printMetadata(
"file",
N->getRawFile());
2715 Printer.printInt(
"line",
N->getLineNo());
2716 Printer.printBool(
"isDecl",
N->getIsDecl(),
false);
2722 AsmWriterContext &WriterCtx) {
2723 Out <<
"!DITemplateTypeParameter(";
2724 MDFieldPrinter
Printer(Out, WriterCtx);
2725 Printer.printString(
"name",
N->getName());
2726 Printer.printMetadata(
"type",
N->getRawType(),
false);
2727 Printer.printBool(
"defaulted",
N->isDefault(),
false);
2733 AsmWriterContext &WriterCtx) {
2734 Out <<
"!DITemplateValueParameter(";
2735 MDFieldPrinter
Printer(Out, WriterCtx);
2736 if (
N->getTag() != dwarf::DW_TAG_template_value_parameter)
2738 Printer.printString(
"name",
N->getName());
2739 Printer.printMetadata(
"type",
N->getRawType());
2740 Printer.printBool(
"defaulted",
N->isDefault(),
false);
2741 Printer.printMetadata(
"value",
N->getValue(),
false);
2746 AsmWriterContext &WriterCtx) {
2747 Out <<
"!DIGlobalVariable(";
2748 MDFieldPrinter
Printer(Out, WriterCtx);
2749 Printer.printString(
"name",
N->getName());
2750 Printer.printString(
"linkageName",
N->getLinkageName());
2751 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2752 Printer.printMetadata(
"file",
N->getRawFile());
2753 Printer.printInt(
"line",
N->getLine());
2754 Printer.printMetadata(
"type",
N->getRawType());
2755 Printer.printBool(
"isLocal",
N->isLocalToUnit());
2756 Printer.printBool(
"isDefinition",
N->isDefinition());
2757 Printer.printMetadata(
"declaration",
N->getRawStaticDataMemberDeclaration());
2758 Printer.printMetadata(
"templateParams",
N->getRawTemplateParams());
2759 Printer.printInt(
"align",
N->getAlignInBits());
2760 Printer.printMetadata(
"annotations",
N->getRawAnnotations());
2765 AsmWriterContext &WriterCtx) {
2766 Out <<
"!DILocalVariable(";
2767 MDFieldPrinter
Printer(Out, WriterCtx);
2768 Printer.printString(
"name",
N->getName());
2769 Printer.printInt(
"arg",
N->getArg());
2770 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2771 Printer.printMetadata(
"file",
N->getRawFile());
2772 Printer.printInt(
"line",
N->getLine());
2773 Printer.printMetadata(
"type",
N->getRawType());
2774 Printer.printDIFlags(
"flags",
N->getFlags());
2775 Printer.printInt(
"align",
N->getAlignInBits());
2776 Printer.printMetadata(
"annotations",
N->getRawAnnotations());
2781 AsmWriterContext &WriterCtx) {
2783 MDFieldPrinter
Printer(Out, WriterCtx);
2784 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2785 Printer.printString(
"name",
N->getName());
2786 Printer.printMetadata(
"file",
N->getRawFile());
2787 Printer.printInt(
"line",
N->getLine(),
false);
2788 Printer.printInt(
"column",
N->getColumn());
2789 Printer.printBool(
"isArtificial",
N->isArtificial(),
false);
2790 if (
N->getCoroSuspendIdx())
2791 Printer.printInt(
"coroSuspendIdx", *
N->getCoroSuspendIdx(),
2797 AsmWriterContext &WriterCtx) {
2798 Out <<
"!DIExpression(";
2803 assert(!OpStr.empty() &&
"Expected valid opcode");
2807 Out << FS << Convert.getBitSize();
2810 for (
unsigned A = 0, AE =
Op.getNumArgs();
A != AE; ++
A)
2811 Out << FS <<
Op.getArg(
A);
2815 for (
const auto &
I :
N->getElements())
2822 AsmWriterContext &WriterCtx,
2823 bool FromValue =
false) {
2825 "Unexpected DIArgList metadata outside of value argument");
2826 Out <<
"!DIArgList(";
2828 MDFieldPrinter
Printer(Out, WriterCtx);
2829 for (
const Metadata *Arg :
N->getArgs()) {
2838 AsmWriterContext &WriterCtx) {
2839 Out <<
"!DIGlobalVariableExpression(";
2840 MDFieldPrinter
Printer(Out, WriterCtx);
2841 Printer.printMetadata(
"var",
N->getVariable());
2842 Printer.printMetadata(
"expr",
N->getExpression());
2847 AsmWriterContext &WriterCtx) {
2848 Out <<
"!DIObjCProperty(";
2849 MDFieldPrinter
Printer(Out, WriterCtx);
2850 Printer.printString(
"name",
N->getName());
2851 Printer.printMetadata(
"file",
N->getRawFile());
2852 Printer.printInt(
"line",
N->getLine());
2853 Printer.printString(
"setter",
N->getSetterName());
2854 Printer.printString(
"getter",
N->getGetterName());
2855 Printer.printInt(
"attributes",
N->getAttributes());
2856 Printer.printMetadata(
"type",
N->getRawType());
2861 AsmWriterContext &WriterCtx) {
2862 Out <<
"!DIProperty(";
2863 MDFieldPrinter
Printer(Out, WriterCtx);
2864 Printer.printString(
"name",
N->getName());
2865 Printer.printMetadata(
"file",
N->getRawFile());
2866 Printer.printInt(
"line",
N->getLine());
2867 Printer.printMetadata(
"type",
N->getRawType());
2868 Printer.printMetadata(
"backing_storage",
N->getRawBackingStorage());
2873 AsmWriterContext &WriterCtx) {
2874 Out <<
"!DIImportedEntity(";
2875 MDFieldPrinter
Printer(Out, WriterCtx);
2877 Printer.printString(
"name",
N->getName());
2878 Printer.printMetadata(
"scope",
N->getRawScope(),
false);
2879 Printer.printMetadata(
"entity",
N->getRawEntity());
2880 Printer.printMetadata(
"file",
N->getRawFile());
2881 Printer.printInt(
"line",
N->getLine());
2882 Printer.printMetadata(
"elements",
N->getRawElements());
2887 AsmWriterContext &Ctx) {
2888 if (
Node->isDistinct())
2890 else if (
Node->isTemporary())
2891 Out <<
"<temporary!> ";
2893 switch (
Node->getMetadataID()) {
2896#define HANDLE_MDNODE_LEAF(CLASS) \
2897 case Metadata::CLASS##Kind: \
2898 write##CLASS(Out, cast<CLASS>(Node), Ctx); \
2900#include "llvm/IR/Metadata.def"
2907 AsmWriterContext &WriterCtx,
2910 WriterCtx.TypePrinter->print(
V->getType(), Out);
2921 assert(WriterCtx.TypePrinter &&
"Constants require TypePrinting!");
2928 if (IA->hasSideEffects())
2929 Out <<
"sideeffect ";
2930 if (IA->isAlignStack())
2931 Out <<
"alignstack ";
2934 Out <<
"inteldialect ";
2953 auto *
Machine = WriterCtx.Machine;
2957 Slot =
Machine->getGlobalSlot(GV);
2974 Slot =
Machine->getGlobalSlot(GV);
2986 Out << Prefix << Slot;
2992 AsmWriterContext &WriterCtx,
3007 Loc && WriterCtx.MST &&
3013 std::unique_ptr<SlotTracker> MachineStorage;
3015 if (!WriterCtx.Machine) {
3016 MachineStorage = std::make_unique<SlotTracker>(WriterCtx.Context);
3017 WriterCtx.Machine = MachineStorage.get();
3027 Out <<
"<" <<
N <<
">";
3041 assert(WriterCtx.TypePrinter &&
"TypePrinter required for metadata values");
3043 "Unexpected function-local metadata outside of value argument");
3050class AssemblyWriter {
3051 const IROptions &Opts;
3052 formatted_raw_ostream &
Out;
3053 const Module *TheModule =
nullptr;
3054 const ModuleSummaryIndex *TheIndex =
nullptr;
3056 TypePrinting TypePrinter;
3057 AssemblyAnnotationWriter *AnnotationWriter =
nullptr;
3059 bool ShouldPreserveUseListOrder;
3064 DenseMap<const GlobalValueSummary *, GlobalValue::GUID> SummaryToGUIDMap;
3068 AssemblyWriter(
const IROptions &Opts, formatted_raw_ostream &o,
3069 SlotTracker &Mac,
const Module *M,
3070 AssemblyAnnotationWriter *AAW,
bool IsForDebug,
3071 bool ShouldPreserveUseListOrder =
false);
3073 AssemblyWriter(formatted_raw_ostream &o, SlotTracker &Mac,
3074 const ModuleSummaryIndex *Index,
bool IsForDebug);
3077 return AsmWriterContext(&TypePrinter, &
Machine, TheModule);
3080 void printMDNodeBody(
const MDNode *MD);
3081 void printNamedMDNode(
const NamedMDNode *NMD);
3083 void printModule(
const Module *M);
3085 void writeOperand(
const Value *
Op,
bool PrintType);
3086 void writeParamOperand(
const Value *Operand, AttributeSet Attrs);
3087 void writeOperandBundles(
const CallBase *
Call);
3088 void writeSyncScope(
const LLVMContext &
Context,
3090 void writeAtomic(
const LLVMContext &
Context,
3093 void writeAtomicCmpXchg(
const LLVMContext &
Context,
3098 void writeAllMDNodes();
3099 void writeMDNode(
unsigned Slot,
const MDNode *Node);
3100 void writeAttribute(
const Attribute &Attr,
bool InAttrGroup =
false);
3101 void writeAttributeSet(
const AttributeSet &AttrSet,
bool InAttrGroup =
false);
3102 void writeAllAttributeGroups();
3104 void printTypeIdentities();
3105 void printGlobal(
const GlobalVariable *GV);
3106 void printAlias(
const GlobalAlias *GA);
3107 void printIFunc(
const GlobalIFunc *GI);
3108 void printComdat(
const Comdat *
C);
3110 void printArgument(
const Argument *FA, AttributeSet Attrs);
3112 void printInstructionLine(
const Instruction &
I);
3113 void printInstruction(
const Instruction &
I);
3114 void printDbgMarker(
const DbgMarker &DPI);
3115 void printDbgVariableRecord(
const DbgVariableRecord &DVR);
3116 void printDbgLabelRecord(
const DbgLabelRecord &DLR);
3117 void printDbgRecord(
const DbgRecord &DR);
3118 void printDbgRecordLine(
const DbgRecord &DR);
3120 void printUseListOrder(
const Value *
V, ArrayRef<unsigned> Shuffle);
3123 void printModuleSummaryIndex();
3124 void printSummaryInfo(
unsigned Slot,
const ValueInfo &VI);
3125 void printSummary(
const GlobalValueSummary &Summary);
3126 void printAliasSummary(
const AliasSummary *AS);
3127 void printGlobalVarSummary(
const GlobalVarSummary *GS);
3128 void printFunctionSummary(
const FunctionSummary *FS);
3129 void printTypeIdSummary(
const TypeIdSummary &TIS);
3131 void printTypeTestResolution(
const TypeTestResolution &TTRes);
3132 void printArgs(ArrayRef<uint64_t> Args);
3133 void printWPDRes(
const WholeProgramDevirtResolution &WPDRes);
3134 void printTypeIdInfo(
const FunctionSummary::TypeIdInfo &TIDInfo);
3135 void printVFuncId(
const FunctionSummary::VFuncId VFId);
3143 void printMetadataAttachments(
3144 const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs,
3145 StringRef Separator);
3149 void printInfoComment(
const Value &
V,
bool isMaterializable =
false);
3153 void printGCRelocateComment(
const GCRelocateInst &Relocate);
3169 bool ShouldPreserveUseListOrder)
3170 : Opts(Opts),
Out(
o), TheModule(
M),
Machine(Mac), TypePrinter(
M),
3171 AnnotationWriter(AAW), IsForDebug(IsForDebug),
3172 ShouldPreserveUseListOrder(
3173 valueOr(Opts.preserve_ll_uselistorder, ShouldPreserveUseListOrder)) {}
3178 TypePrinter(nullptr), IsForDebug(IsForDebug),
3179 ShouldPreserveUseListOrder(
false) {}
3181void AssemblyWriter::writeOperand(
const Value *Operand,
bool PrintType) {
3183 Out <<
"<null operand!>";
3190void AssemblyWriter::writeSyncScope(
const LLVMContext &
Context,
3198 Context.getSyncScopeNames(SSNs);
3200 Out <<
" syncscope(\"";
3208void AssemblyWriter::writeAtomic(
const LLVMContext &
Context,
3211 if (Ordering == AtomicOrdering::NotAtomic)
3214 writeSyncScope(
Context, SSID);
3218void AssemblyWriter::writeAtomicCmpXchg(
const LLVMContext &
Context,
3222 assert(SuccessOrdering != AtomicOrdering::NotAtomic &&
3223 FailureOrdering != AtomicOrdering::NotAtomic);
3225 writeSyncScope(
Context, SSID);
3230void AssemblyWriter::writeParamOperand(
const Value *Operand,
3231 AttributeSet Attrs) {
3233 Out <<
"<null operand!>";
3238 TypePrinter.print(Operand->
getType(), Out);
3240 if (
Attrs.hasAttributes()) {
3242 writeAttributeSet(Attrs);
3250void AssemblyWriter::writeOperandBundles(
const CallBase *
Call) {
3266 ListSeparator InnerLS;
3268 for (
const auto &Input : BU.
Inputs) {
3270 if (Input ==
nullptr)
3271 Out <<
"<null operand bundle!>";
3282void AssemblyWriter::printModule(
const Module *M) {
3285 if (ShouldPreserveUseListOrder)
3288 if (!
M->getModuleIdentifier().empty() &&
3291 M->getModuleIdentifier().find(
'\n') == std::string::npos)
3292 Out <<
"; ModuleID = '" <<
M->getModuleIdentifier() <<
"'\n";
3294 if (!
M->getSourceFileName().empty()) {
3295 Out <<
"source_filename = \"";
3300 const std::string &
DL =
M->getDataLayoutStr();
3302 Out <<
"target datalayout = \"" <<
DL <<
"\"\n";
3303 if (!
M->getTargetTriple().empty())
3304 Out <<
"target triple = \"" <<
M->getTargetTriple().str() <<
"\"\n";
3306 if (
M->hasModuleInlineAsm()) {
3309 for (
const Module::GlobalAsmFragment &Frag :
M->getModuleInlineAsm()) {
3310 Out <<
"module asm";
3312 Frag.Props.getAsStrings();
3313 if (!Props.
empty()) {
3318 Out <<
Key <<
": \"";
3326 StringRef
Asm = Frag.Asm;
3329 std::tie(Front, Asm) =
Asm.split(
'\n');
3336 }
while (!
Asm.empty());
3340 printTypeIdentities();
3344 SmallPtrSet<const Comdat *, 8> PrintedComdats;
3345 for (
const GlobalObject &GO :
M->global_objects()) {
3347 if (!
C || !PrintedComdats.
insert(
C).second)
3355 if (!
M->global_empty()) Out <<
'\n';
3356 for (
const GlobalVariable &GV :
M->globals()) {
3357 printGlobal(&GV); Out <<
'\n';
3361 if (!
M->alias_empty()) Out <<
"\n";
3362 for (
const GlobalAlias &GA :
M->aliases())
3366 if (!
M->ifunc_empty()) Out <<
"\n";
3367 for (
const GlobalIFunc &GI :
M->ifuncs())
3377 printUseLists(
nullptr);
3382 writeAllAttributeGroups();
3386 if (!
M->named_metadata_empty()) Out <<
'\n';
3388 for (
const NamedMDNode &Node :
M->named_metadata())
3389 printNamedMDNode(&Node);
3398void AssemblyWriter::printModuleSummaryIndex() {
3400 int NumSlots =
Machine.initializeIndexIfNeeded();
3406 std::vector<std::pair<std::string, ModuleHash>> moduleVec;
3407 std::string RegularLTOModuleName =
3410 for (
auto &[ModPath, ModHash] : TheIndex->
modulePaths())
3411 moduleVec[
Machine.getModulePathSlot(ModPath)] = std::make_pair(
3414 ModPath.empty() ? RegularLTOModuleName : std::string(ModPath), ModHash);
3417 for (
auto &ModPair : moduleVec) {
3418 Out <<
"^" << i++ <<
" = module: (";
3421 Out <<
"\", hash: (";
3423 for (
auto Hash : ModPair.second)
3433 for (
const auto &GlobalList : SortedGVS) {
3434 auto GUID = GlobalList.first;
3435 for (
auto &Summary : GlobalList.second.getSummaryList())
3440 for (
const auto &GlobalList : SortedGVS) {
3441 auto GUID = GlobalList.first;
3443 printSummaryInfo(
Machine.getGUIDSlot(GUID), VI);
3447 for (
const auto &TID : TheIndex->
typeIds()) {
3448 Out <<
"^" <<
Machine.getTypeIdSlot(TID.second.first)
3449 <<
" = typeid: (name: \"";
3452 printTypeIdSummary(TID.second.second);
3453 Out <<
") ; guid = " << TID.first <<
"\n";
3459 Out <<
"^" <<
Machine.getTypeIdCompatibleVtableSlot(TId.first)
3460 <<
" = typeidCompatibleVTable: (name: \"";
3463 printTypeIdCompatibleVtableSummary(TId.second);
3464 Out <<
") ; guid = " <<
GUID <<
"\n";
3469 auto PrintCfiFunctions = [&](
const CfiFunctionIndex &CfiIndex,
3470 StringRef EntryName) {
3471 if (CfiIndex.
empty())
3473 Out <<
"^" << NumSlots++ <<
" = " << EntryName <<
": (";
3476 Out <<
FS <<
"(guid: " <<
GUID <<
", name: \"";
3487 Out <<
"^" << NumSlots <<
" = flags: " << TheIndex->
getFlags() <<
"\n";
3491 Out <<
"^" << NumSlots <<
" = blockcount: " << TheIndex->
getBlockCount()
3501 return "singleImpl";
3503 return "branchFunnel";
3505 return "speculative";
3516 return "uniformRetVal";
3518 return "uniqueRetVal";
3520 return "virtualConstProp";
3543void AssemblyWriter::printTypeTestResolution(
const TypeTestResolution &TTRes) {
3550 Out <<
", alignLog2: " << TTRes.
AlignLog2;
3552 Out <<
", sizeM1: " << TTRes.
SizeM1;
3555 Out <<
", bitMask: " << (unsigned)TTRes.
BitMask;
3562void AssemblyWriter::printTypeIdSummary(
const TypeIdSummary &TIS) {
3563 Out <<
", summary: (";
3564 printTypeTestResolution(TIS.
TTRes);
3565 if (!TIS.
WPDRes.empty()) {
3566 Out <<
", wpdResolutions: (";
3568 for (
auto &WPDRes : TIS.
WPDRes) {
3570 Out <<
"(offset: " << WPDRes.first <<
", ";
3571 printWPDRes(WPDRes.second);
3579void AssemblyWriter::printTypeIdCompatibleVtableSummary(
3581 Out <<
", summary: (";
3583 for (
auto &
P : TI) {
3585 Out <<
"(offset: " <<
P.AddressPointOffset <<
", ";
3586 Out <<
"^" <<
Machine.getGUIDSlot(
P.VTableVI.getGUID());
3592void AssemblyWriter::printArgs(ArrayRef<uint64_t> Args) {
3596void AssemblyWriter::printWPDRes(
const WholeProgramDevirtResolution &WPDRes) {
3597 Out <<
"wpdRes: (kind: ";
3602 Out <<
", singleImplName: \"";
3608 Out <<
", resByArg: (";
3610 for (
auto &ResByArg : WPDRes.
ResByArg) {
3612 printArgs(ResByArg.first);
3613 Out <<
", byArg: (kind: ";
3615 if (ResByArg.second.TheKind ==
3617 ResByArg.second.TheKind ==
3619 Out <<
", info: " << ResByArg.second.Info;
3623 if (ResByArg.second.Byte || ResByArg.second.Bit)
3624 Out <<
", byte: " << ResByArg.second.Byte
3625 <<
", bit: " << ResByArg.second.Bit;
3646void AssemblyWriter::printAliasSummary(
const AliasSummary *AS) {
3647 Out <<
", aliasee: ";
3657void AssemblyWriter::printGlobalVarSummary(
const GlobalVarSummary *GS) {
3658 auto VTableFuncs =
GS->vTableFuncs();
3659 Out <<
", varFlags: (readonly: " <<
GS->VarFlags.MaybeReadOnly <<
", "
3660 <<
"writeonly: " <<
GS->VarFlags.MaybeWriteOnly <<
", "
3661 <<
"constant: " <<
GS->VarFlags.Constant;
3662 if (!VTableFuncs.empty())
3664 <<
"vcall_visibility: " <<
GS->VarFlags.VCallVisibility;
3667 if (!VTableFuncs.empty()) {
3668 Out <<
", vTableFuncs: (";
3670 for (
auto &
P : VTableFuncs) {
3672 Out <<
"(virtFunc: ^" <<
Machine.getGUIDSlot(
P.FuncVI.getGUID())
3673 <<
", offset: " <<
P.VTableOffset;
3691 return "linkonce_odr";
3701 return "extern_weak";
3703 return "available_externally";
3732 return "definition";
3734 return "declaration";
3739void AssemblyWriter::printFunctionSummary(
const FunctionSummary *FS) {
3740 Out <<
", insts: " <<
FS->instCount();
3741 if (
FS->fflags().anyFlagSet())
3742 Out <<
", " <<
FS->fflags();
3744 if (!
FS->calls().empty()) {
3745 Out <<
", calls: (";
3747 for (
auto &
Call :
FS->calls()) {
3749 Out <<
"(callee: ^" <<
Machine.getGUIDSlot(
Call.first.getGUID());
3750 if (
Call.second.getHotness() != CalleeInfo::HotnessType::Unknown)
3754 if (
Call.second.HasTailCall)
3756 if (
Call.second.HasIndirectCall)
3757 Out <<
", indirect: 1";
3763 if (
const auto *TIdInfo =
FS->getTypeIdInfo())
3764 printTypeIdInfo(*TIdInfo);
3768 auto AllocTypeName = [](uint8_t
Type) ->
const char * {
3770 case (uint8_t)AllocationType::None:
3772 case (uint8_t)AllocationType::NotCold:
3774 case (uint8_t)AllocationType::Cold:
3776 case (uint8_t)AllocationType::Hot:
3778 case (uint8_t)AllocationType::NotCold | (uint8_t)AllocationType::Cold:
3785 if (!
FS->allocs().empty()) {
3786 Out <<
", allocs: (";
3788 for (
auto &AI :
FS->allocs()) {
3790 Out <<
"(versions: (";
3792 for (
auto V : AI.Versions) {
3794 Out << AllocTypeName(
V);
3796 Out <<
"), memProf: (";
3797 ListSeparator MIBFS;
3798 for (
auto &MIB : AI.MIBs) {
3800 Out <<
"(type: " << AllocTypeName((uint8_t)MIB.AllocType);
3801 Out <<
", stackIds: (";
3802 ListSeparator SIDFS;
3803 for (
auto Id : MIB.StackIdIndices) {
3814 if (!
FS->callsites().empty()) {
3815 Out <<
", callsites: (";
3817 for (
auto &CI :
FS->callsites()) {
3820 Out <<
"(callee: ^" <<
Machine.getGUIDSlot(CI.Callee.getGUID());
3822 Out <<
"(callee: null";
3823 Out <<
", clones: (";
3825 for (
auto V : CI.Clones) {
3829 Out <<
"), stackIds: (";
3830 ListSeparator SIDFS;
3831 for (
auto Id : CI.StackIdIndices) {
3840 auto PrintRange = [&](
const ConstantRange &
Range) {
3844 if (!
FS->paramAccesses().empty()) {
3845 Out <<
", params: (";
3847 for (
auto &PS :
FS->paramAccesses()) {
3849 Out <<
"(param: " << PS.ParamNo;
3850 Out <<
", offset: ";
3852 if (!PS.Calls.empty()) {
3853 Out <<
", calls: (";
3855 for (
auto &
Call : PS.Calls) {
3857 Out <<
"(callee: ^" <<
Machine.getGUIDSlot(
Call.Callee.getGUID());
3858 Out <<
", param: " <<
Call.ParamNo;
3859 Out <<
", offset: ";
3860 PrintRange(
Call.Offsets);
3871void AssemblyWriter::printTypeIdInfo(
3872 const FunctionSummary::TypeIdInfo &TIDInfo) {
3873 Out <<
", typeIdInfo: (";
3874 ListSeparator TIDFS;
3877 Out <<
"typeTests: (";
3880 auto TidIter = TheIndex->
typeIds().equal_range(GUID);
3881 if (TidIter.first == TidIter.second) {
3887 for (
const auto &[GUID, TypeIdPair] :
make_range(TidIter)) {
3889 auto Slot =
Machine.getTypeIdSlot(TypeIdPair.first);
3907 "typeTestAssumeConstVCalls");
3912 "typeCheckedLoadConstVCalls");
3917void AssemblyWriter::printVFuncId(
const FunctionSummary::VFuncId VFId) {
3918 auto TidIter = TheIndex->
typeIds().equal_range(VFId.
GUID);
3919 if (TidIter.first == TidIter.second) {
3920 Out <<
"vFuncId: (";
3921 Out <<
"guid: " << VFId.
GUID;
3922 Out <<
", offset: " << VFId.
Offset;
3928 for (
const auto &[GUID, TypeIdPair] :
make_range(TidIter)) {
3930 Out <<
"vFuncId: (";
3931 auto Slot =
Machine.getTypeIdSlot(TypeIdPair.first);
3934 Out <<
", offset: " << VFId.
Offset;
3939void AssemblyWriter::printNonConstVCalls(
3941 Out <<
Tag <<
": (";
3943 for (
auto &VFuncId : VCallList) {
3945 printVFuncId(VFuncId);
3950void AssemblyWriter::printConstVCalls(
3952 Out <<
Tag <<
": (";
3954 for (
auto &ConstVCall : VCallList) {
3957 printVFuncId(ConstVCall.VFunc);
3958 if (!ConstVCall.Args.empty()) {
3960 printArgs(ConstVCall.Args);
3967void AssemblyWriter::printSummary(
const GlobalValueSummary &Summary) {
3968 GlobalValueSummary::GVFlags GVFlags =
Summary.flags();
3971 Out <<
"(module: ^" <<
Machine.getModulePathSlot(
Summary.modulePath())
3974 Out <<
", visibility: "
3977 Out <<
", live: " << GVFlags.
Live;
3978 Out <<
", dsoLocal: " << GVFlags.
DSOLocal;
3980 Out <<
", importType: "
3992 auto RefList =
Summary.refs();
3993 if (!RefList.empty()) {
3996 for (
auto &
Ref : RefList) {
3998 if (
Ref.isReadOnly())
4000 else if (
Ref.isWriteOnly())
4001 Out <<
"writeonly ";
4002 Out <<
"^" <<
Machine.getGUIDSlot(
Ref.getGUID());
4010void AssemblyWriter::printSummaryInfo(
unsigned Slot,
const ValueInfo &VI) {
4011 Out <<
"^" <<
Slot <<
" = gv: (";
4012 if (
VI.hasName() && !
VI.name().empty()) {
4017 Out <<
"guid: " <<
VI.getGUID();
4019 if (!
VI.getSummaryList().empty()) {
4020 Out <<
", summaries: (";
4022 for (
auto &Summary :
VI.getSummaryList()) {
4024 printSummary(*Summary);
4029 if (
VI.hasName() && !
VI.name().empty())
4030 Out <<
" ; guid = " <<
VI.getGUID();
4037 Out <<
"<empty name> ";
4039 unsigned char FirstC =
static_cast<unsigned char>(Name[0]);
4040 if (isalpha(FirstC) || FirstC ==
'-' || FirstC ==
'$' || FirstC ==
'.' ||
4045 for (
unsigned i = 1, e = Name.size(); i != e; ++i) {
4046 unsigned char C = Name[i];
4047 if (isalnum(
C) ||
C ==
'-' ||
C ==
'$' ||
C ==
'.' ||
C ==
'_')
4055void AssemblyWriter::printNamedMDNode(
const NamedMDNode *NMD) {
4090 Out <<
"dso_local ";
4108 Out <<
"thread_local ";
4111 Out <<
"thread_local(localdynamic) ";
4114 Out <<
"thread_local(initialexec) ";
4117 Out <<
"thread_local(localexec) ";
4127 return "local_unnamed_addr";
4129 return "unnamed_addr";
4152void AssemblyWriter::printGlobal(
const GlobalVariable *GV) {
4154 Out <<
"; Materializable\n";
4175 Out << (GV->
isConstant() ?
"constant " :
"global ");
4184 Out <<
", section \"";
4189 Out <<
", partition \"";
4194 Out <<
", code_model \"";
4219 Out <<
", no_sanitize_address";
4221 Out <<
", no_sanitize_hwaddress";
4223 Out <<
", sanitize_memtag";
4225 Out <<
", sanitize_address_dyninit";
4230 Out <<
", align " <<
A->value();
4234 printMetadataAttachments(MDs,
", ");
4237 if (
Attrs.hasAttributes())
4238 Out <<
" #" <<
Machine.getAttributeGroupSlot(Attrs);
4243void AssemblyWriter::printAlias(
const GlobalAlias *GA) {
4245 Out <<
"; Materializable\n";
4265 if (
const Constant *Aliasee = GA->
getAliasee()) {
4268 TypePrinter.print(GA->
getType(), Out);
4269 Out <<
" <<NULL ALIASEE>>";
4273 Out <<
", partition \"";
4282void AssemblyWriter::printIFunc(
const GlobalIFunc *GI) {
4284 Out <<
"; Materializable\n";
4299 if (
const Constant *Resolver = GI->
getResolver()) {
4302 TypePrinter.print(GI->
getType(), Out);
4303 Out <<
" <<NULL RESOLVER>>";
4307 Out <<
", partition \"";
4314 printMetadataAttachments(MDs,
", ");
4321void AssemblyWriter::printComdat(
const Comdat *
C) {
4325void AssemblyWriter::printTypeIdentities() {
4326 if (TypePrinter.empty())
4332 auto &NumberedTypes = TypePrinter.getNumberedTypes();
4333 for (
unsigned I = 0,
E = NumberedTypes.size();
I !=
E; ++
I) {
4334 Out <<
'%' <<
I <<
" = type ";
4338 TypePrinter.printStructBody(NumberedTypes[
I], Out);
4342 auto &NamedTypes = TypePrinter.getNamedTypes();
4343 for (StructType *NamedType : NamedTypes) {
4349 TypePrinter.printStructBody(NamedType, Out);
4355void AssemblyWriter::printFunction(
const Function *
F) {
4356 if (
F->isMaterializable())
4357 Out <<
"; Materializable\n";
4358 else if (AnnotationWriter)
4361 const AttributeList &
Attrs =
F->getAttributes();
4362 if (
Attrs.hasFnAttrs()) {
4363 AttributeSet AS =
Attrs.getFnAttrs();
4364 std::string AttrStr;
4367 if (!Attr.isStringAttribute()) {
4368 if (!AttrStr.empty()) AttrStr +=
' ';
4369 AttrStr += Attr.getAsString();
4373 if (!AttrStr.empty())
4374 Out <<
"; Function Attrs: " << AttrStr <<
'\n';
4378 Out <<
"; Unknown intrinsic\n";
4382 if (
F->isDeclaration()) {
4385 F->getAllMetadata(MDs);
4386 printMetadataAttachments(MDs,
" ");
4397 if (
F->getCallingConv() != CallingConv::C) {
4402 FunctionType *FT =
F->getFunctionType();
4403 if (
Attrs.hasRetAttrs())
4404 Out <<
Attrs.getAsString(AttributeList::ReturnIndex) <<
' ';
4405 TypePrinter.print(
F->getReturnType(), Out);
4412 if (
F->isDeclaration() && !IsForDebug) {
4415 for (
unsigned I = 0,
E = FT->getNumParams();
I !=
E; ++
I) {
4418 TypePrinter.print(FT->getParamType(
I), Out);
4420 AttributeSet ArgAttrs =
Attrs.getParamAttrs(
I);
4423 writeAttributeSet(ArgAttrs);
4429 for (
const Argument &Arg :
F->args()) {
4431 printArgument(&Arg,
Attrs.getParamAttrs(Arg.getArgNo()));
4436 if (FT->isVarArg()) {
4437 if (FT->getNumParams()) Out <<
", ";
4448 bool ForcePrintAddressSpace =
4449 !
Mod ||
Mod->getDataLayout().getProgramAddressSpace() != 0;
4451 "", ForcePrintAddressSpace);
4452 if (
Attrs.hasFnAttrs())
4453 Out <<
" #" <<
Machine.getAttributeGroupSlot(
Attrs.getFnAttrs());
4454 if (
F->hasSection()) {
4455 Out <<
" section \"";
4459 if (
F->hasPartition()) {
4460 Out <<
" partition \"";
4465 if (MaybeAlign
A =
F->getAlign())
4466 Out <<
" align " <<
A->value();
4467 if (MaybeAlign
A =
F->getPreferredAlignment())
4468 Out <<
" prefalign(" <<
A->value() <<
')';
4470 Out <<
" gc \"" <<
F->getGC() <<
'"';
4471 if (
F->hasPrefixData()) {
4473 writeOperand(
F->getPrefixData(),
true);
4475 if (
F->hasPrologueData()) {
4476 Out <<
" prologue ";
4477 writeOperand(
F->getPrologueData(),
true);
4479 if (
F->hasPersonalityFn()) {
4480 Out <<
" personality ";
4481 writeOperand(
F->getPersonalityFn(),
true);
4484 if (Opts.print_prof_data) {
4485 if (
auto *MDProf =
F->getMetadata(LLVMContext::MD_prof)) {
4487 MDProf->print(Out, TheModule,
true);
4491 if (
F->isDeclaration()) {
4495 F->getAllMetadata(MDs);
4496 printMetadataAttachments(MDs,
" ");
4500 for (
const BasicBlock &BB : *
F)
4514void AssemblyWriter::printArgument(
const Argument *Arg, AttributeSet Attrs) {
4516 TypePrinter.print(Arg->
getType(), Out);
4519 if (
Attrs.hasAttributes()) {
4521 writeAttributeSet(Attrs);
4530 assert(Slot != -1 &&
"expect argument in function here");
4531 Out <<
" %" <<
Slot;
4542 }
else if (!IsEntryBlock) {
4544 int Slot =
Machine.getLocalSlot(BB);
4551 if (!IsEntryBlock) {
4556 Out <<
" No predecessors!";
4562 writeOperand(Pred,
false);
4573 for (
const DbgRecord &DR :
I.getDbgRecordRange())
4574 printDbgRecordLine(DR);
4575 printInstructionLine(
I);
4582void AssemblyWriter::printInstructionLine(
const Instruction &
I) {
4583 printInstruction(
I);
4589void AssemblyWriter::printGCRelocateComment(
const GCRelocateInst &Relocate) {
4592 writeOperand(BasePtr,
false);
4597 writeOperand(DerivedPtr,
false);
4605void AssemblyWriter::printInfoComment(
const Value &
V,
bool isMaterializable) {
4607 printGCRelocateComment(*Relocate);
4609 if (AnnotationWriter && !isMaterializable)
4612 if (Opts.print_inst_debug_locs) {
4614 if (
I->getDebugLoc()) {
4616 I->getDebugLoc().print(Out);
4620 if (Opts.print_prof_data) {
4622 if (
auto *MD =
I->getMetadata(LLVMContext::MD_prof)) {
4624 MD->print(Out, TheModule,
true);
4629 if (Opts.print_inst_addrs)
4635 if (Operand ==
nullptr) {
4636 Out <<
" <cannot get addrspace!>";
4646 bool ForcePrintAddrSpace =
4647 !
Mod ||
Mod->getDataLayout().getProgramAddressSpace() != 0;
4649 ForcePrintAddrSpace);
4653void AssemblyWriter::printInstruction(
const Instruction &
I) {
4663 }
else if (!
I.getType()->isVoidTy()) {
4665 int SlotNum =
Machine.getLocalSlot(&
I);
4667 Out <<
"<badref> = ";
4669 Out <<
'%' << SlotNum <<
" = ";
4673 if (CI->isMustTailCall())
4675 else if (CI->isTailCall())
4677 else if (CI->isNoTailCall())
4682 Out <<
I.getOpcodeName();
4702 Out <<
" elementwise";
4709 Out <<
' ' << CI->getPredicate();
4713 if (RMWI->isElementwise())
4714 Out <<
" elementwise";
4719 const Value *Operand =
I.getNumOperands() ?
I.getOperand(0) :
nullptr;
4724 writeOperand(BI->getCondition(),
true);
4726 writeOperand(BI->getSuccessor(0),
true);
4728 writeOperand(BI->getSuccessor(1),
true);
4733 writeOperand(
SI.getCondition(),
true);
4735 writeOperand(
SI.getDefaultDest(),
true);
4737 for (
auto Case :
SI.cases()) {
4739 writeOperand(Case.getCaseValue(),
true);
4741 writeOperand(Case.getCaseSuccessor(),
true);
4747 writeOperand(Operand,
true);
4751 for (
unsigned i = 1, e =
I.getNumOperands(); i != e; ++i) {
4753 writeOperand(
I.getOperand(i),
true);
4758 TypePrinter.print(
I.getType(), Out);
4762 for (
const auto &[
V,
Block] :
4763 zip_equal(PN->incoming_values(), PN->blocks())) {
4765 writeOperand(
V,
false);
4767 writeOperand(
Block,
false);
4772 writeOperand(
I.getOperand(0),
true);
4777 writeOperand(
I.getOperand(0),
true); Out <<
", ";
4778 writeOperand(
I.getOperand(1),
true);
4783 TypePrinter.print(
I.getType(), Out);
4784 if (LPI->isCleanup() || LPI->getNumClauses() != 0)
4787 if (LPI->isCleanup())
4790 for (
unsigned i = 0, e = LPI->getNumClauses(); i != e; ++i) {
4791 if (i != 0 || LPI->isCleanup()) Out <<
"\n";
4792 if (LPI->isCatch(i))
4797 writeOperand(LPI->getClause(i),
true);
4801 writeOperand(CatchSwitch->getParentPad(),
false);
4804 for (
const BasicBlock *PadBB : CatchSwitch->handlers()) {
4806 writeOperand(PadBB,
true);
4809 if (
const BasicBlock *UnwindDest = CatchSwitch->getUnwindDest())
4810 writeOperand(UnwindDest,
true);
4815 writeOperand(FPI->getParentPad(),
false);
4818 for (
const Value *
Op : FPI->arg_operands()) {
4820 writeOperand(
Op,
true);
4827 writeOperand(CRI->getOperand(0),
false);
4830 writeOperand(CRI->getOperand(1),
true);
4833 writeOperand(CRI->getOperand(0),
false);
4836 if (CRI->hasUnwindDest())
4837 writeOperand(CRI->getOperand(1),
true);
4842 if (CI->getCallingConv() != CallingConv::C) {
4847 Operand = CI->getCalledOperand();
4848 FunctionType *FTy = CI->getFunctionType();
4849 Type *RetTy = FTy->getReturnType();
4850 const AttributeList &PAL = CI->getAttributes();
4852 if (PAL.hasRetAttrs())
4853 Out <<
' ' << PAL.getAsString(AttributeList::ReturnIndex);
4862 TypePrinter.print(FTy->isVarArg() ? FTy : RetTy, Out);
4864 writeOperand(Operand,
false);
4866 bool HasPrettyPrintedArgs =
4871 Function *CalledFunc = CI->getCalledFunction();
4872 auto PrintArgComment = [&](
unsigned ArgNo) {
4874 if (!ConstArg || !CalledFunc)
4876 std::string ArgComment;
4877 raw_string_ostream ArgCommentStream(ArgComment);
4880 if (ArgComment.empty())
4882 Out <<
"/* " << ArgComment <<
" */ ";
4884 if (HasPrettyPrintedArgs) {
4885 for (
unsigned ArgNo = 0, NumArgs = CI->arg_size(); ArgNo < NumArgs;
4888 PrintArgComment(ArgNo);
4889 writeParamOperand(CI->getArgOperand(ArgNo), PAL.getParamAttrs(ArgNo));
4892 for (
unsigned ArgNo = 0, NumArgs = CI->arg_size(); ArgNo < NumArgs;
4895 writeParamOperand(CI->getArgOperand(ArgNo), PAL.getParamAttrs(ArgNo));
4900 if (CI->isMustTailCall() && CI->getParent() &&
4901 CI->getParent()->getParent() &&
4902 CI->getParent()->getParent()->isVarArg()) {
4903 if (CI->arg_size() > 0)
4909 if (PAL.hasFnAttrs())
4910 Out <<
" #" <<
Machine.getAttributeGroupSlot(PAL.getFnAttrs());
4912 writeOperandBundles(CI);
4914 Operand =
II->getCalledOperand();
4915 FunctionType *FTy =
II->getFunctionType();
4916 Type *RetTy = FTy->getReturnType();
4917 const AttributeList &PAL =
II->getAttributes();
4920 if (
II->getCallingConv() != CallingConv::C) {
4925 if (PAL.hasRetAttrs())
4926 Out <<
' ' << PAL.getAsString(AttributeList::ReturnIndex);
4936 TypePrinter.print(FTy->isVarArg() ? FTy : RetTy, Out);
4938 writeOperand(Operand,
false);
4941 for (
unsigned op = 0, Eop =
II->arg_size();
op < Eop; ++
op) {
4943 writeParamOperand(
II->getArgOperand(
op), PAL.getParamAttrs(
op));
4947 if (PAL.hasFnAttrs())
4948 Out <<
" #" <<
Machine.getAttributeGroupSlot(PAL.getFnAttrs());
4950 writeOperandBundles(
II);
4953 writeOperand(
II->getNormalDest(),
true);
4955 writeOperand(
II->getUnwindDest(),
true);
4957 Operand = CBI->getCalledOperand();
4958 FunctionType *FTy = CBI->getFunctionType();
4959 Type *RetTy = FTy->getReturnType();
4960 const AttributeList &PAL = CBI->getAttributes();
4963 if (CBI->getCallingConv() != CallingConv::C) {
4968 if (PAL.hasRetAttrs())
4969 Out <<
' ' << PAL.getAsString(AttributeList::ReturnIndex);
4976 TypePrinter.print(FTy->isVarArg() ? FTy : RetTy, Out);
4978 writeOperand(Operand,
false);
4980 ListSeparator ArgLS;
4981 for (
unsigned op = 0, Eop = CBI->arg_size();
op < Eop; ++
op) {
4983 writeParamOperand(CBI->getArgOperand(
op), PAL.getParamAttrs(
op));
4987 if (PAL.hasFnAttrs())
4988 Out <<
" #" <<
Machine.getAttributeGroupSlot(PAL.getFnAttrs());
4990 writeOperandBundles(CBI);
4993 writeOperand(CBI->getDefaultDest(),
true);
4995 ListSeparator DestLS;
4996 for (
const BasicBlock *Dest : CBI->getIndirectDests()) {
4998 writeOperand(Dest,
true);
5003 if (AI->isUsedWithInAlloca())
5005 if (AI->isSwiftError())
5006 Out <<
"swifterror ";
5007 TypePrinter.print(AI->getAllocatedType(), Out);
5013 if (!AI->getArraySize() || AI->isArrayAllocation() ||
5014 !AI->getArraySize()->getType()->isIntegerTy(32)) {
5016 writeOperand(AI->getArraySize(),
true);
5018 if (MaybeAlign
A = AI->getAlign()) {
5019 Out <<
", align " <<
A->value();
5027 writeOperand(Operand,
true);
5030 TypePrinter.print(
I.getType(), Out);
5034 writeOperand(Operand,
true);
5037 TypePrinter.print(
I.getType(), Out);
5038 }
else if (Operand) {
5041 TypePrinter.print(
GEP->getSourceElementType(), Out);
5045 TypePrinter.print(
I.getType(), Out);
5052 bool PrintAllTypes =
false;
5060 PrintAllTypes =
true;
5062 for (
unsigned i = 1,
E =
I.getNumOperands(); i !=
E; ++i) {
5063 Operand =
I.getOperand(i);
5066 if (Operand && Operand->
getType() != TheType) {
5067 PrintAllTypes =
true;
5073 if (!PrintAllTypes) {
5075 TypePrinter.print(TheType, Out);
5080 for (
const Value *
Op :
I.operands()) {
5082 writeOperand(
Op, PrintAllTypes);
5089 writeAtomic(LI->getContext(), LI->getOrdering(), LI->getSyncScopeID());
5090 if (MaybeAlign
A = LI->getAlign())
5091 Out <<
", align " <<
A->value();
5094 writeAtomic(
SI->getContext(),
SI->getOrdering(),
SI->getSyncScopeID());
5095 if (MaybeAlign
A =
SI->getAlign())
5096 Out <<
", align " <<
A->value();
5098 writeAtomicCmpXchg(CXI->getContext(), CXI->getSuccessOrdering(),
5099 CXI->getFailureOrdering(), CXI->getSyncScopeID());
5100 Out <<
", align " << CXI->getAlign().value();
5102 writeAtomic(RMWI->getContext(), RMWI->getOrdering(),
5103 RMWI->getSyncScopeID());
5104 Out <<
", align " << RMWI->getAlign().value();
5106 writeAtomic(FI->getContext(), FI->getOrdering(), FI->getSyncScopeID());
5114 printMetadataAttachments(InstMD,
", ");
5117 printInfoComment(
I);
5120void AssemblyWriter::printDbgMarker(
const DbgMarker &Marker) {
5124 printDbgRecord(DPR);
5128 Out <<
" DbgMarker -> { ";
5133void AssemblyWriter::printDbgRecord(
const DbgRecord &DR) {
5135 printDbgVariableRecord(*DVR);
5137 printDbgLabelRecord(*DLR);
5142void AssemblyWriter::printDbgVariableRecord(
const DbgVariableRecord &DVR) {
5146 case DbgVariableRecord::LocationType::Value:
5149 case DbgVariableRecord::LocationType::Declare:
5152 case DbgVariableRecord::LocationType::DeclareValue:
5153 Out <<
"declare_value";
5155 case DbgVariableRecord::LocationType::Assign:
5160 "Tried to print a DbgVariableRecord with an invalid LocationType!");
5191void AssemblyWriter::printDbgRecordLine(
const DbgRecord &DR) {
5198void AssemblyWriter::printDbgLabelRecord(
const DbgLabelRecord &Label) {
5200 Out <<
"#dbg_label(";
5207void AssemblyWriter::printMetadataAttachments(
5208 const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs,
5209 StringRef Separator) {
5213 if (MDNames.empty())
5214 MDs[0].second->getContext().getMDKindNames(MDNames);
5217 for (
const auto &
I : MDs) {
5218 unsigned Kind =
I.first;
5220 if (Kind < MDNames.size()) {
5224 Out <<
"!<unknown kind #" <<
Kind <<
">";
5230void AssemblyWriter::writeMDNode(
unsigned Slot,
const MDNode *Node) {
5231 if (AnnotationWriter)
5234 Out <<
'!' <<
Slot <<
" = ";
5235 printMDNodeBody(Node);
5239void AssemblyWriter::writeAllMDNodes() {
5246 for (
auto [Slot, Node] : Nodes)
5247 writeMDNode(Slot, Node);
5250void AssemblyWriter::printMDNodeBody(
const MDNode *Node) {
5255void AssemblyWriter::writeAttribute(
const Attribute &Attr,
bool InAttrGroup) {
5261 Out << Attribute::getNameFromAttrKind(Attr.
getKindAsEnum());
5264 TypePrinter.print(Ty, Out);
5269void AssemblyWriter::writeAttributeSet(
const AttributeSet &AttrSet,
5271 ListSeparator
LS(
" ");
5272 for (
const auto &Attr : AttrSet) {
5274 writeAttribute(Attr, InAttrGroup);
5278void AssemblyWriter::writeAllAttributeGroups() {
5279 std::vector<std::pair<AttributeSet, unsigned>> asVec;
5280 asVec.resize(
Machine.as_size());
5283 asVec[
I.second] =
I;
5285 for (
const auto &
I : asVec)
5286 Out <<
"attributes #" <<
I.second <<
" = { "
5287 <<
I.first.getAsString(
true) <<
" }\n";
5290void AssemblyWriter::printUseListOrder(
const Value *
V,
5291 ArrayRef<unsigned> Shuffle) {
5295 Out <<
"uselistorder ";
5296 writeOperand(
V,
true);
5298 assert(Shuffle.
size() >= 2 &&
"Shuffle too small");
5302void AssemblyWriter::printUseLists(
const Function *
F) {
5303 auto It = UseListOrders.find(
F);
5304 if (It == UseListOrders.end())
5307 Out <<
"\n; uselistorder directives\n";
5308 for (
const auto &Pair : It->second)
5309 printUseListOrder(Pair.first, Pair.second);
5317 bool ShouldPreserveUseListOrder,
bool IsForDebug)
const {
5321 AAW, IsForDebug, ShouldPreserveUseListOrder);
5322 W.printFunction(
this);
5326 bool ShouldPreserveUseListOrder,
5327 bool IsForDebug)
const {
5331 AAW, IsForDebug, ShouldPreserveUseListOrder);
5332 W.printBasicBlock(
this);
5336 bool ShouldPreserveUseListOrder,
bool IsForDebug)
const {
5340 IsForDebug, ShouldPreserveUseListOrder);
5341 W.printModule(
this);
5349 W.printNamedMDNode(
this);
5353 bool IsForDebug)
const {
5354 std::optional<SlotTracker> LocalST;
5360 SlotTable = &*LocalST;
5365 nullptr, IsForDebug);
5366 W.printNamedMDNode(
this);
5371 ROS <<
" = comdat ";
5378 ROS <<
"exactmatch";
5384 ROS <<
"nodeduplicate";
5396 TP.print(
const_cast<Type*
>(
this), OS);
5405 TP.printStructBody(STy, OS);
5412 print(ROS, MST, IsForDebug);
5418 print(ROS, MST, IsForDebug);
5422 bool IsForDebug)
const {
5431 AssemblyWriter W(
getOptions(M), OS, SlotTable, M,
nullptr, IsForDebug);
5432 W.printDbgMarker(*
this);
5438 print(ROS, MST, IsForDebug);
5442 bool IsForDebug)
const {
5448 ?
Marker->getParent()->getParent()
5453 AssemblyWriter W(
getOptions(M), OS, SlotTable, M,
nullptr, IsForDebug);
5454 W.printDbgVariableRecord(*
this);
5458 bool IsForDebug)
const {
5464 Marker->getParent() ?
Marker->getParent()->getParent() :
nullptr;
5469 AssemblyWriter W(
getOptions(M), OS, SlotTable, M,
nullptr, IsForDebug);
5470 W.printDbgLabelRecord(*
this);
5475 F->print(ROS,
nullptr,
false, IsForDebug);
5479 BB->print(ROS,
nullptr,
false, IsForDebug);
5484 print(ROS, MST, IsForDebug);
5488 bool IsForDebug)
const {
5493 auto IncorporateFunction = [&](
const Function *
F) {
5499 IncorporateFunction(
I->getParent() ?
I->getParent()->getParent() :
nullptr);
5502 W.printInstruction(*
I);
5504 IncorporateFunction(BB->getParent());
5507 W.printBasicBlock(BB);
5510 nullptr, IsForDebug);
5524 TypePrinting TypePrinter;
5525 TypePrinter.print(
C->getType(), OS);
5527 AsmWriterContext WriterCtx(&TypePrinter, MST.
getMachine());
5543 AsmWriterContext WriterCtx(
nullptr,
Machine, M);
5552 TypePrinting TypePrinter(MST.
getModule());
5582 AsmWriterContext &WriterCtx) {
5595struct MDTreeAsmWriterContext :
public AsmWriterContext {
5598 using EntryTy = std::pair<unsigned, std::string>;
5602 SmallPtrSet<const Metadata *, 4> Visited;
5604 raw_ostream &MainOS;
5606 MDTreeAsmWriterContext(TypePrinting *TP, SlotTracker *ST,
const Module *M,
5607 const ModuleSlotTracker *MST, raw_ostream &OS,
5609 : AsmWriterContext(TP,
ST,
M, MST),
Level(0
U), Visited({InitMD}),
5612 void onWriteMetadataAsOperand(
const Metadata *MD)
override {
5613 if (!Visited.
insert(MD).second)
5617 raw_string_ostream
SS(Str);
5622 unsigned InsertIdx = Buffer.
size() - 1;
5625 Buffer[InsertIdx].second = std::move(
SS.str());
5629 ~MDTreeAsmWriterContext()
override {
5630 for (
const auto &Entry : Buffer) {
5632 unsigned NumIndent =
Entry.first * 2U;
5641 bool OnlyAsOperand,
bool PrintAsTree =
false) {
5644 TypePrinting TypePrinter(M);
5646 std::unique_ptr<AsmWriterContext> WriterCtx;
5647 if (PrintAsTree && !OnlyAsOperand)
5648 WriterCtx = std::make_unique<MDTreeAsmWriterContext>(
5649 &TypePrinter, MST.
getMachine(), M, &MST, OS, &MD);
5651 WriterCtx = std::make_unique<AsmWriterContext>(&TypePrinter,
5681 const Module *M,
bool )
const {
5705 OS <<
" = distinct !MDFunctionLocalContext(";
5708 OS << LS <<
"nonDebug: true";
5710 OS << LS <<
"scopes: [<" <<
getScopes().size() <<
" entries>]";
5712 OS << LS <<
"srcLocs: [<" <<
getSrcLocs().size() <<
" entries>]";
5714 OS << LS <<
"inlinedCalls: [<" <<
getInlinedCalls().size() <<
" entries>]";
5718#define DEFINE_FLMD_NODE_PRINTS(TYPE) \
5719 void TYPE::print(raw_ostream &OS, const Module *M) const { \
5720 ModuleSlotTracker MST(M); \
5721 print(OS, MST, M); \
5723 void TYPE::print(raw_ostream &OS, ModuleSlotTracker &MST, const Module *M) \
5725 formatted_raw_ostream FOS(OS); \
5726 AsmWriterContext WriterCtx(nullptr, MST.getMachine(), M, &MST); \
5727 writeFLMDNode(OS, *this, WriterCtx); \
5736 AssemblyWriter W(OS, SlotTable,
this, IsForDebug);
5737 W.printModuleSummaryIndex();
5746 L.push_back(std::make_pair(
I.second,
I.first));
5749#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
amdgpu next use AMDGPU Next Use Analysis Printer
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static void writeDIMacro(raw_ostream &Out, const DIMacro *N, AsmWriterContext &WriterCtx)
static void writeMetadataAsOperand(raw_ostream &Out, const Metadata *MD, AsmWriterContext &WriterCtx)
static void writeDIGlobalVariableExpression(raw_ostream &Out, const DIGlobalVariableExpression *N, AsmWriterContext &WriterCtx)
static void writeDICompositeType(raw_ostream &Out, const DICompositeType *N, AsmWriterContext &WriterCtx)
static void writeDIFixedPointType(raw_ostream &Out, const DIFixedPointType *N, AsmWriterContext &WriterCtx)
static void printDSOLocation(const GlobalValue &GV, formatted_raw_ostream &Out)
static const char * getWholeProgDevirtResKindName(WholeProgramDevirtResolution::Kind K)
static void writeDISubrangeType(raw_ostream &Out, const DISubrangeType *N, AsmWriterContext &WriterCtx)
static void WriteFullHexAPInt(raw_ostream &Out, const APInt &Val)
static void writeAPFloatInternal(raw_ostream &Out, const APFloat &APF)
static void printMetadataImpl(raw_ostream &ROS, const Metadata &MD, ModuleSlotTracker &MST, const Module *M, bool OnlyAsOperand, bool PrintAsTree=false)
static void writeDIStringType(raw_ostream &Out, const DIStringType *N, AsmWriterContext &WriterCtx)
static std::string getLinkageNameWithSpace(GlobalValue::LinkageTypes LT)
static std::vector< unsigned > predictValueUseListOrder(const Value *V, unsigned ID, const OrderMap &OM)
static void writeDILayerLocList(raw_ostream &Out, const DILayerLocList *N, AsmWriterContext &WriterCtx)
static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N, AsmWriterContext &WriterCtx)
static void orderValue(const Value *V, OrderMap &OM)
static void writeDIBasicType(raw_ostream &Out, const DIBasicType *N, AsmWriterContext &WriterCtx)
#define DEFINE_FLMD_NODE_PRINTS(TYPE)
static StringRef getUnnamedAddrEncoding(GlobalVariable::UnnamedAddr UA)
static const char * getWholeProgDevirtResByArgKindName(WholeProgramDevirtResolution::ByArg::Kind K)
static void writeDILayerLoc(raw_ostream &Out, const DILayerLoc *N, AsmWriterContext &WriterCtx)
static void writeMDNodeBodyInternal(raw_ostream &Out, const MDNode *Node, AsmWriterContext &Ctx)
static void writeDIModule(raw_ostream &Out, const DIModule *N, AsmWriterContext &WriterCtx)
static void writeDIFile(raw_ostream &Out, const DIFile *N, AsmWriterContext &)
static void writeDISubroutineType(raw_ostream &Out, const DISubroutineType *N, AsmWriterContext &WriterCtx)
static void writeOptimizationInfo(raw_ostream &Out, const User *U)
#define CC_VLS_CASE(ABI_VLEN)
static void writeDILabel(raw_ostream &Out, const DILabel *N, AsmWriterContext &WriterCtx)
static void writeDIDerivedType(raw_ostream &Out, const DIDerivedType *N, AsmWriterContext &WriterCtx)
static void printMetadataIdentifier(StringRef Name, formatted_raw_ostream &Out)
static void printShuffleMask(raw_ostream &Out, Type *Ty, ArrayRef< int > Mask)
static void writeDIImportedEntity(raw_ostream &Out, const DIImportedEntity *N, AsmWriterContext &WriterCtx)
static const Module * getModuleFromDPI(const DbgMarker *Marker)
static void printAsOperandImpl(const Value &V, raw_ostream &O, bool PrintType, ModuleSlotTracker &MST)
static void writeMDFunctionLocalContext(raw_ostream &Out, const MDFunctionLocalContext *FLMD, AsmWriterContext &WriterCtx)
static void writeDIObjCProperty(raw_ostream &Out, const DIObjCProperty *N, AsmWriterContext &WriterCtx)
static void writeDISubprogram(raw_ostream &Out, const DISubprogram *N, AsmWriterContext &WriterCtx)
static const char * getSummaryKindName(GlobalValueSummary::SummaryKind SK)
static OrderMap orderModule(const Module *M)
static const char * getVisibilityName(GlobalValue::VisibilityTypes Vis)
static void printCallingConv(unsigned cc, raw_ostream &Out)
static void printAddressSpace(const Module *M, unsigned AS, raw_ostream &OS, StringRef Prefix=" ", StringRef Suffix="", bool ForcePrint=false)
static void printMetadataImplRec(raw_ostream &ROS, const Metadata &MD, AsmWriterContext &WriterCtx)
Recursive version of printMetadataImpl.
static SlotTracker * createSlotTracker(const Value *V)
static void writeFLMDNode(raw_ostream &Out, FLScope Scope, AsmWriterContext &WriterCtx)
static void writeDILocation(raw_ostream &Out, const DILocation *DL, AsmWriterContext &WriterCtx)
static void writeDINamespace(raw_ostream &Out, const DINamespace *N, AsmWriterContext &WriterCtx)
DenseMap< const Function *, MapVector< const Value *, std::vector< unsigned > > > UseListOrderMap
static void writeDICommonBlock(raw_ostream &Out, const DICommonBlock *N, AsmWriterContext &WriterCtx)
static UseListOrderMap predictUseListOrder(const Module *M)
static void printThreadLocalModel(GlobalVariable::ThreadLocalMode TLM, formatted_raw_ostream &Out)
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
static void writeGenericDINode(raw_ostream &Out, const GenericDINode *N, AsmWriterContext &WriterCtx)
static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N, AsmWriterContext &WriterCtx)
static const char * getTTResKindName(TypeTestResolution::Kind K)
static void writeDITemplateTypeParameter(raw_ostream &Out, const DITemplateTypeParameter *N, AsmWriterContext &WriterCtx)
static const char * getImportTypeName(GlobalValueSummary::ImportKind IK)
static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N, AsmWriterContext &WriterCtx)
static const IROptions & getOptions(const Module *M)
static const Module * getModuleFromVal(const Value *V)
static void printLLVMName(raw_ostream &OS, StringRef Name, PrefixType Prefix)
Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only cont...
static void maybePrintCallAddrSpace(const Value *Operand, const Instruction *I, raw_ostream &Out)
static void writeDIGenericSubrange(raw_ostream &Out, const DIGenericSubrange *N, AsmWriterContext &WriterCtx)
static void writeDISubrange(raw_ostream &Out, const DISubrange *N, AsmWriterContext &WriterCtx)
static void writeDIProperty(raw_ostream &Out, const DIProperty *N, AsmWriterContext &WriterCtx)
static void writeDILexicalBlockFile(raw_ostream &Out, const DILexicalBlockFile *N, AsmWriterContext &WriterCtx)
static void writeConstantInternal(raw_ostream &Out, const Constant *CV, AsmWriterContext &WriterCtx)
static void writeDIEnumerator(raw_ostream &Out, const DIEnumerator *N, AsmWriterContext &)
static void writeAsOperandInternal(raw_ostream &Out, const Value *V, AsmWriterContext &WriterCtx, bool PrintType=false)
static void printVisibility(GlobalValue::VisibilityTypes Vis, formatted_raw_ostream &Out)
constexpr IROptions DefaultOptions
static void writeMDTuple(raw_ostream &Out, const MDTuple *Node, AsmWriterContext &WriterCtx)
static void writeDIExpression(raw_ostream &Out, const DIExpression *N, AsmWriterContext &WriterCtx)
static void writeDIAssignID(raw_ostream &Out, const DIAssignID *DL, AsmWriterContext &WriterCtx)
static void writeDILexicalBlock(raw_ostream &Out, const DILexicalBlock *N, AsmWriterContext &WriterCtx)
static void maybePrintComdat(formatted_raw_ostream &Out, const GlobalObject &GO)
static void printDLLStorageClass(GlobalValue::DLLStorageClassTypes SCT, formatted_raw_ostream &Out)
static bool printWithoutType(const Value &V, raw_ostream &O, SlotTracker *Machine, const Module *M)
Print without a type, skipping the TypePrinting object.
static void writeDIArgList(raw_ostream &Out, const DIArgList *N, AsmWriterContext &WriterCtx, bool FromValue=false)
static void writeDITemplateValueParameter(raw_ostream &Out, const DITemplateValueParameter *N, AsmWriterContext &WriterCtx)
static const Value * skipMetadataWrapper(const Value *V)
Look for a value that might be wrapped as metadata, e.g.
static void writeDIMacroFile(raw_ostream &Out, const DIMacroFile *N, AsmWriterContext &WriterCtx)
Atomic ordering constants.
This file contains the simple types necessary to represent the attributes associated with functions a...
static const Function * getParent(const Value *V)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...
GlobalValue::SanitizerMetadata SanitizerMetadata
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
This defines the Use class.
static bool isAtomic(MachineBasicBlock::iterator I)
Machine Check Debug Module
static bool InRange(int64_t Value, unsigned short Shift, int LBound, int HBound)
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
static bool processModule(Module &M, NVPTXTargetMachine &TM)
static bool processFunction(Function &F, NVPTXTargetMachine &TM)
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
uint64_t IntrinsicInst * II
Function const char TargetMachine * Machine
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
static StringRef getName(Value *V)
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
static void visit(BasicBlock &Start, std::function< bool(BasicBlock *)> op)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file provides utility classes that use RAII to save and restore values.
This file defines the SmallPtrSet class.
This file defines the SmallString class.
This file defines the SmallVector class.
LocallyHashedType DenseMapInfo< LocallyHashedType >::Empty
static UseListOrderStack predictUseListOrder(const Module &M)
static constexpr const fltSemantics & PPCDoubleDouble()
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const
const fltSemantics & getSemantics() const
APInt bitcastToAPInt() const
APInt getNaNPayload() const
If the value is a NaN value, return an integer containing the payload of this value.
Class for arbitrary precision integers.
void clearBit(unsigned BitPosition)
Set a given bit to 0.
unsigned getActiveBits() const
Compute the number of active bits in the value.
LLVM_ABI APInt trunc(unsigned width) const
Truncate to new width.
void toStringUnsigned(SmallVectorImpl< char > &Str, unsigned Radix=10) const
Considers the APInt to be unsigned and converts it into a string in the radix given.
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
bool isSignMask() const
Check if the APInt's value is returned by getSignMask.
unsigned getBitWidth() const
Return the number of bits in the APInt.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
Abstract interface of slot tracker storage.
virtual ~AbstractSlotTrackerStorage()
const GlobalValueSummary & getAliasee() const
This class represents an incoming formal argument to a Function.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
virtual void emitMDNodeAnnot(const MDNode *, formatted_raw_ostream &)
emitMDNodeAnnot - This may be implemented to emit a string right before a metadata node is emitted.
virtual void emitBasicBlockStartAnnot(const BasicBlock *, formatted_raw_ostream &)
emitBasicBlockStartAnnot - This may be implemented to emit a string right after the basic block label...
virtual void emitBasicBlockEndAnnot(const BasicBlock *, formatted_raw_ostream &)
emitBasicBlockEndAnnot - This may be implemented to emit a string right after the basic block.
virtual void emitFunctionAnnot(const Function *, formatted_raw_ostream &)
emitFunctionAnnot - This may be implemented to emit a string right before the start of a function.
virtual void emitInstructionAnnot(const Instruction *, formatted_raw_ostream &)
emitInstructionAnnot - This may be implemented to emit a string right before an instruction is emitte...
virtual void printInfoComment(const Value &, formatted_raw_ostream &)
printInfoComment - This may be implemented to emit a comment to the right of an instruction or global...
virtual ~AssemblyAnnotationWriter()
static LLVM_ABI StringRef getOperationName(BinOp Op)
This class holds the attributes for a particular argument, parameter, function, or return value.
bool hasAttributes() const
Return true if attributes exists in this set.
LLVM_ABI std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
LLVM_ABI Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
LLVM_ABI bool isTypeAttribute() const
Return true if the attribute is a type attribute.
LLVM_ABI Type * getValueAsType() const
Return the attribute's value as a Type.
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
LLVM_ABI void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the basic block to an output stream with an optional AssemblyAnnotationWriter.
LLVM_ABI bool isEntryBlock() const
Return true if this is the entry block of the containing function.
LLVM_ABI const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
OperandBundleUse getOperandBundleAt(unsigned Index) const
Return the operand bundle at a specific index.
unsigned getNumOperandBundles() const
Return the number of operand bundles associated with this User.
AttributeList getAttributes() const
Return the attributes for this call.
bool hasOperandBundles() const
Return true if this User has any operand bundles.
std::vector< std::pair< StringRef, GlobalValue::GUID > > getSortedSymbols() const
API used for serialization, e.g. YAML.
LLVM_ABI void print(raw_ostream &OS, bool IsForDebug=false) const
LLVM_ABI void dump() const
@ Largest
The linker will choose the largest COMDAT.
@ SameSize
The data referenced by the COMDAT must be the same size.
@ Any
The linker may choose any COMDAT.
@ NoDeduplicate
No deduplication is performed.
@ ExactMatch
The data referenced by the COMDAT must be the same.
SelectionKind getSelectionKind() const
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
LLVM_ABI APInt getSignedMin() const
Return the smallest signed value contained in the ConstantRange.
LLVM_ABI APInt getSignedMax() const
Return the largest signed value contained in the ConstantRange.
This is an important base class in LLVM.
LLVM_ABI Constant * getSplatValue(bool AllowPoison=false) const
If all elements of the vector constant have the same value, return that value.
LLVM_ABI Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.
Basic type, like 'int' or 'float'.
static LLVM_ABI const char * nameTableKindString(DebugNameTableKind PK)
static LLVM_ABI const char * emissionKindString(DebugEmissionKind EK)
A lightweight wrapper around an expression operand.
static LLVM_ABI const char * fixedPointKindString(FixedPointKind)
A pair of DIGlobalVariable and DIExpression.
An imported module (C++ using directive or similar).
A sequence of DILayerLoc entries.
A single intermediate-IR layer location.
Macro Info DWARF-like metadata node.
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Tagged DWARF-like metadata node.
static LLVM_ABI DIFlags splitFlags(DIFlags Flags, SmallVectorImpl< DIFlags > &SplitFlags)
Split up a flags bitfield.
static LLVM_ABI StringRef getFlagString(DIFlags Flag)
A property of a class or structure.
Wrapper structure that holds source language identity metadata that includes language name,...
uint32_t getVersion() const
Returns language version. Only valid for versioned language names.
uint16_t getDialect() const
bool hasVersionedName() const
uint16_t getName() const
Returns a versioned or unversioned language name.
String type, Fortran CHARACTER(n)
Subprogram description. Uses SubclassData1.
static LLVM_ABI DISPFlags splitFlags(DISPFlags Flags, SmallVectorImpl< DISPFlags > &SplitFlags)
Split up a flags bitfield for easier printing.
static LLVM_ABI StringRef getFlagString(DISPFlags Flag)
DISPFlags
Debug info subprogram flags.
Type array for a subprogram.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Per-instruction record of debug-info.
LLVM_ABI void dump() const
Instruction * MarkedInstr
Link back to the Instruction that owns this marker.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on DbgMarker.
LLVM_ABI const BasicBlock * getParent() const
simple_ilist< DbgRecord > StoredDbgRecords
List of DbgRecords, the non-instruction equivalent of llvm.dbg.
Base class for non-instruction debug metadata records that have positions within IR.
DebugLoc getDebugLoc() const
LLVM_ABI void dump() const
DbgMarker * Marker
Marker that this DbgRecord is linked into.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
LocationType getType() const
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
MDNode * getRawExpression() const
MDNode * getRawAddressExpression() const
Metadata * getRawAssignID() const
MDNode * getRawVariable() const
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Metadata * getRawAddress() const
LLVM_ABI MDNode * getAsMDNode() const
Return this as a bar MDNode.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the function to an output stream with an optional AssemblyAnnotationWriter.
const Function & getFunction() const
const Argument * const_arg_iterator
LLVM_ABI Value * getBasePtr() const
LLVM_ABI Value * getDerivedPtr() const
Generic tagged DWARF-like metadata node.
const Constant * getAliasee() const
const Constant * getResolver() const
StringRef getSection() const
Get the custom section of this global if it has one.
LLVM_ABI void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
const Comdat * getComdat() const
bool hasSection() const
Check if this global has a custom object file section.
SummaryKind
Sububclass discriminator (for dyn_cast<> et al.)
bool hasPartition() const
static LLVM_ABI GUID getGUIDAssumingExternalLinkage(StringRef GlobalName)
Return a 64-bit global unique ID constructed from the name of a global symbol.
LLVM_ABI const SanitizerMetadata & getSanitizerMetadata() const
bool hasExternalLinkage() const
VisibilityTypes getVisibility() const
bool isImplicitDSOLocal() const
LinkageTypes getLinkage() const
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
ThreadLocalMode getThreadLocalMode() const
DLLStorageClassTypes
Storage classes of global values for PE targets.
@ DLLExportStorageClass
Function to be accessible from DLL.
@ DLLImportStorageClass
Function to be imported from DLL.
bool hasSanitizerMetadata() const
LLVM_ABI StringRef getPartition() const
Module * getParent()
Get the module that this global value is contained inside of...
PointerType * getType() const
Global values are always pointers.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
@ DefaultVisibility
The GV is visible.
@ HiddenVisibility
The GV is hidden.
@ ProtectedVisibility
The GV is protected.
LLVM_ABI bool isMaterializable() const
If this function's Module is being lazily streamed in functions from disk or some other source,...
UnnamedAddr getUnnamedAddr() const
LinkageTypes
An enumeration for the kinds of linkage for global values.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ CommonLinkage
Tentative definitions.
@ InternalLinkage
Rename collisions when linking (static functions).
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
@ AppendingLinkage
Special purpose, only applies to global arrays.
@ AvailableExternallyLinkage
Available for inspection, not emission.
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
DLLStorageClassTypes getDLLStorageClass() const
Type * getValueType() const
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool isExternallyInitialized() const
bool hasInitializer() const
Definitions have initializers, declarations don't.
AttributeSet getAttributes() const
Return the attribute set for this global.
std::optional< CodeModel::Model > getCodeModel() const
Get the custom code model of this global if it has one.
MaybeAlign getAlign() const
Returns the alignment of the given variable.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
A helper class to return the specified delimiter string after the first invocation of operator String...
Storage class for function-local metadata objects.
ArrayRef< FLInlinedCall > getInlinedCalls() const
LLVM_ABI void printShort(raw_ostream &OS, const Module *M=nullptr) const
Prints a shortened version of this FLContext, where only the number of entries in each storage array ...
ArrayRef< FLScope > getScopes() const
ArrayRef< FLSrcLoc > getSrcLocs() const
LLVM_ABI void printTree(raw_ostream &OS, const Module *M=nullptr) const
Print in tree shape.
LLVM_ABI void dumpTree() const
User-friendly dump in tree shape.
Tracking metadata reference owned by Metadata.
This class implements a map that also provides access to all stored values in a deterministic order.
Manage lifetime of a slot tracker for printing IR.
const Module * getModule() const
ModuleSlotTracker(SlotTracker &Machine, const Module *M, const Function *F=nullptr)
Wrap a preinitialized SlotTracker.
void renumberMetadataForAssembly(ArrayRef< const MDNode * > AdditionalMetadata, MachineMDNodeListType *AdditionalMetadataNodes=nullptr) const
Renumber module metadata and then additional metadata for canonical assembly output.
void collectMDNodes(MachineMDNodeListType &L) const
void setProcessHook(std::function< void(AbstractSlotTrackerStorage *, const Module *)>)
virtual ~ModuleSlotTracker()
Destructor to clean up storage.
void collectAdditionalMetadata(ArrayRef< const MDNode * > AdditionalMetadata, MachineMDNodeListType &AdditionalMetadataNodes) const
Collect metadata reachable from AdditionalMetadata but not from the module.
int getLocalSlot(const Value *V)
Return the slot number of the specified local value.
virtual bool shouldPrintDebugLocationInline(const DILocation *) const
Return whether a debug location should be printed inline instead of by ID.
SlotTracker * getMachine()
Lazily creates a slot tracker.
SmallVector< std::pair< unsigned, const MDNode * >, 0 > MachineMDNodeListType
void incorporateFunction(const Function &F)
Incorporate the given function.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
uint64_t getBlockCount() const
const TypeIdSummaryMapTy & typeIds() const
CfiFunctionIndex & cfiFunctionDecls()
ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const
Return a ValueInfo for the index value_type (convenient when iterating index).
static constexpr const char * getRegularLTOModuleName()
ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit=false, bool UnifiedLTO=false)
const auto & typeIdCompatibleVtableMap() const
const StringMap< ModuleHash > & modulePaths() const
Table of modules, containing module hash and id.
LLVM_ABI void dump() const
Dump to stderr (for debugging).
GlobalValueSummaryMapTy::SortedEntriesRange sortedGlobalValueSummariesRange() const
uint64_t getStackIdAtIndex(unsigned Index) const
LLVM_ABI void print(raw_ostream &OS, bool IsForDebug=false) const
Print to an output stream.
CfiFunctionIndex & cfiFunctionDefs()
LLVM_ABI uint64_t getFlags() const
A Module instance is used to store all the information related to an LLVM module.
LLVMContext & getContext() const
Get the global data context.
void renumberMetadataForAssembly()
Renumber the IDs stored in metadata nodes into canonical assembly order.
iterator_range< alias_iterator > aliases()
iterator_range< global_iterator > globals()
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the module to an output stream with an optional AssemblyAnnotationWriter.
void dump() const
Dump the module to stderr (for debugging).
LLVM_ABI void dump() const
LLVM_ABI StringRef getName() const
LLVM_ABI void print(raw_ostream &ROS, bool IsForDebug=false) const
iterator_range< op_iterator > operands()
unsigned getAddressSpace() const
Return the address space of the Pointer type.
This class provides computation of slot numbers for LLVM Assembly writing.
DenseMap< const Value *, unsigned > ValueMap
ValueMap - A mapping of Values to slot numbers.
int getMetadataSlot(const MDNode *N) override
getMetadataSlot - Get the slot number of a MDNode.
~SlotTracker() override=default
int getTypeIdCompatibleVtableSlot(StringRef Id)
int getModulePathSlot(StringRef Path)
unsigned mdn_size() const
SlotTracker(const SlotTracker &)=delete
void purgeFunction()
After calling incorporateFunction, use this method to remove the most recently incorporated function ...
int getTypeIdSlot(StringRef Id)
void initializeIfNeeded()
These functions do the actual initialization.
int getGlobalSlot(const GlobalValue *V)
getGlobalSlot - Get the slot number of a global value.
SlotTracker(const Module *M, bool ShouldTrackMetadataDefinitions=false)
Construct from a module.
const Function * getFunction() const
DenseMap< GlobalValue::GUID, unsigned >::iterator guid_iterator
GUID map iterators.
void incorporateFunction(const Function *F)
If you'd like to deal with a function instead of just a module, use this method to get its data into ...
int getLocalSlot(const Value *V)
Return the slot number of the specified value in it's type plane.
int getAttributeGroupSlot(AttributeSet AS)
void setProcessHook(std::function< void(AbstractSlotTrackerStorage *, const Module *)>)
void createMetadataSlot(const MDNode *N) override
getMetadataSlot - Get the slot number of a MDNode.
DenseMap< const MDNode *, unsigned >::iterator mdn_iterator
MDNode map iterators.
SlotTracker & operator=(const SlotTracker &)=delete
int getGUIDSlot(GlobalValue::GUID GUID)
int initializeIndexIfNeeded()
DenseMap< AttributeSet, unsigned >::iterator as_iterator
AttributeSet map iterators.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool contains(ConstPtrType Ptr) const
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
reference emplace_back(ArgTypes &&... Args)
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
ArrayRef< Type * > elements() const
unsigned getNumElements() const
Random access to the elements.
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition.
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
LLVM_ABI StringRef getName() const
Return the name for this struct type if it has an identity.
ArrayRef< Type * > type_params() const
Return the type parameters for this particular target extension type.
ArrayRef< unsigned > int_params() const
Return the integer parameters for this particular target extension type.
TypeFinder - Walk over a module, identifying all of the types that are used by the module.
LLVM_ABI void run(const Module &M, bool onlyNamed)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM_ABI StringRef getTargetExtName() const
Type(LLVMContext &C, TypeID tid)
LLVM_ABI void dump() const
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
LLVM_ABI unsigned getByteBitWidth() const
TypeID getTypeID() const
Return the type id for the type.
Type * getElementType() const
unsigned getAddressSpace() const
Return the address space of the Pointer type.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
LLVM_ABI void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
iterator_range< user_iterator > users()
LLVM_ABI 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.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
LLVM_ABI void dump() const
Support for debugging, callable in GDB: V->dump()
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
LLVM_ABI StringRef LanguageDialectString(unsigned LanguageDialect)
LLVM_ABI StringRef SourceLanguageNameString(SourceLanguageName Lang)
LLVM_ABI StringRef EnumKindString(unsigned EnumKind)
LLVM_ABI StringRef LanguageString(unsigned Language)
LLVM_ABI StringRef AttributeEncodingString(unsigned Encoding)
LLVM_ABI StringRef ConventionString(unsigned Convention)
LLVM_ABI StringRef MacinfoString(unsigned Encoding)
LLVM_ABI StringRef OperationEncodingString(unsigned Encoding)
LLVM_ABI StringRef TagString(unsigned Tag)
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
@ AArch64_VectorCall
Used between AArch64 Advanced SIMD functions.
@ X86_64_SysV
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
@ RISCV_VectorCall
Calling convention used for RISC-V V-extension.
@ AMDGPU_CS
Used for Mesa/AMDPAL compute shaders.
@ AMDGPU_VS
Used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (vertex shader if tess...
@ AVR_SIGNAL
Used for AVR signal routines.
@ Swift
Calling convention for Swift.
@ AMDGPU_KERNEL
Used for AMDGPU code object kernels.
@ AArch64_SVE_VectorCall
Used between AArch64 SVE functions.
@ ARM_APCS
ARM Procedure Calling Standard (obsolete, but still used on some targets).
@ CHERIoT_CompartmentCall
Calling convention used for CHERIoT when crossing a protection boundary.
@ CFGuard_Check
Special calling convention on Windows for calling the Control Guard Check ICall funtion.
@ AVR_INTR
Used for AVR interrupt routines.
@ PreserveMost
Used for runtime calls that preserves most registers.
@ AnyReg
OBSOLETED - Used for stack based JavaScript calls.
@ AMDGPU_Gfx
Used for AMD graphics targets.
@ DUMMY_HHVM
Placeholders for HHVM calling conventions (deprecated, removed).
@ AMDGPU_CS_ChainPreserve
Used on AMDGPUs to give the middle-end more control over argument placement.
@ AMDGPU_HS
Used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
@ ARM_AAPCS
ARM Architecture Procedure Calling Standard calling convention (aka EABI).
@ CHERIoT_CompartmentCallee
Calling convention used for the callee of CHERIoT_CompartmentCall.
@ AMDGPU_GS
Used for Mesa/AMDPAL geometry shaders.
@ AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2
Preserve X2-X15, X19-X29, SP, Z0-Z31, P0-P15.
@ CHERIoT_LibraryCall
Calling convention used for CHERIoT for cross-library calls to a stateless compartment.
@ CXX_FAST_TLS
Used for access functions.
@ X86_INTR
x86 hardware interrupt context.
@ AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0
Preserve X0-X13, X19-X29, SP, Z0-Z31, P0-P15.
@ WASM_EmscriptenInvoke
For emscripten __invoke_* functions.
@ AMDGPU_CS_Chain
Used on AMDGPUs to give the middle-end more control over argument placement.
@ AVR_BUILTIN
Used for special AVR rtlib functions which have an "optimized" convention to preserve registers.
@ GHC
Used by the Glasgow Haskell Compiler (GHC).
@ AMDGPU_PS
Used for Mesa/AMDPAL pixel shaders.
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
@ AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1
Preserve X1-X15, X19-X29, SP, Z0-Z31, P0-P15.
@ X86_ThisCall
Similar to X86_StdCall.
@ PTX_Device
Call to a PTX device function.
@ SPIR_KERNEL
Used for SPIR kernel functions.
@ PreserveAll
Used for runtime calls that preserves (almost) all registers.
@ X86_StdCall
stdcall is mostly used by the Win32 API.
@ SPIR_FUNC
Used for SPIR non-kernel device functions.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ MSP430_INTR
Used for MSP430 interrupt routines.
@ X86_VectorCall
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
@ Intel_OCL_BI
Used for Intel OpenCL built-ins.
@ PreserveNone
Used for runtime calls that preserves none general registers.
@ AMDGPU_ES
Used for AMDPAL shader stage before geometry shader if geometry is in use.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ Win64
The C convention as implemented on Windows/x86-64 and AArch64.
@ PTX_Kernel
Call to a PTX kernel. Passes all arguments in parameter space.
@ SwiftTail
This follows the Swift calling convention in how arguments are passed but guarantees tail calls will ...
@ GRAAL
Used by GraalVM. Two additional registers are reserved.
@ AMDGPU_LS
Used for AMDPAL vertex shader if tessellation is in use.
@ ARM_AAPCS_VFP
Same as ARM_AAPCS, but uses hard floating point ABI.
@ X86_RegCall
Register calling convention used for parameters transfer optimization.
@ M68k_RTD
Used for M68k rtd-based CC (similar to X86's stdcall).
@ X86_FastCall
'fast' analog of X86_StdCall.
LLVM_ABI void printImmArg(ID IID, unsigned ArgIdx, raw_ostream &OS, const Constant *ImmArgVal)
Print the argument info for the arguments with ArgInfo.
LLVM_ABI bool hasPrettyPrintedArgs(ID id)
Returns true if the intrinsic has pretty printed immediate arguments.
@ System
Synchronized with respect to all concurrently executing threads.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
bool isElementwise(const VPValue *V)
Return true if V is elementwise, i.e. none of the lanes are permuted.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
detail::zippy< detail::zip_first, T, U, Args... > zip_equal(T &&t, U &&u, Args &&...args)
zip iterator that assumes that all iteratees have the same length.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
InterleavedRange< Range > interleaved(const Range &R, StringRef Separator=", ", StringRef Prefix="", StringRef Suffix="")
Output range R as a sequence of interleaved elements.
const char * getHotnessName(CalleeInfo::HotnessType HT)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LLVM_ABI void printEscapedString(StringRef Name, raw_ostream &Out)
Print each character of the specified string, escaping it if it is not printable or if it is an escap...
constexpr auto equal_to(T &&Arg)
Functor variant of std::equal_to that can be used as a UnaryPredicate in functional algorithms like a...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
const char * toIRString(AtomicOrdering ao)
String used by LLVM IR to represent atomic ordering.
auto dyn_cast_or_null(const Y &Val)
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
constexpr int PoisonMaskElem
AtomicOrdering
Atomic ordering for LLVM's memory model.
@ Ref
The access may reference the value stored in memory.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
const IROptions & getIROptions(const LLVMContext &C)
LLVM_ABI Printable printBasicBlock(const BasicBlock *BB)
Print BasicBlock BB as an operand or print "<nullptr>" if BB is a nullptr.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
auto predecessors(const MachineBasicBlock *BB)
constexpr bool valueOr(BoolOrDefault X, bool Default)
bool pred_empty(const BasicBlock *BB)
std::vector< TypeIdOffsetVtableInfo > TypeIdCompatibleVtableInfo
List of vtable definitions decorated by a particular type identifier, and their corresponding offsets...
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
LLVM_ABI void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name)
Print out a name of an LLVM value without any prefixes.
A single checksum, represented by a Kind and a Value (a string).
T Value
The string value of the checksum.
StringRef getKindAsString() const
FLIndex< FLInlinedCall > InlinedAtIdx
MDFunctionLocalContext * InlineeContext
FLIndex< FLSrcLoc > SrcLocIdx
Unique FLMD, just a wrapper around a DILocalScope.
FLIndex< FLScope > ScopeIdx
std::vector< ConstVCall > TypeCheckedLoadConstVCalls
std::vector< VFuncId > TypeCheckedLoadVCalls
std::vector< ConstVCall > TypeTestAssumeConstVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm....
std::vector< GlobalValue::GUID > TypeTests
List of type identifiers used by this function in llvm.type.test intrinsics referenced by something o...
std::vector< VFuncId > TypeTestAssumeVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm....
unsigned NoRenameOnPromotion
This field is written by the ThinLTO prelink stage to decide whether a particular static global value...
unsigned DSOLocal
Indicates that the linker resolved the symbol to a definition from within the same linkage unit.
unsigned CanAutoHide
In the per-module summary, indicates that the global value is linkonce_odr and global unnamed addr (s...
unsigned ImportType
This field is written by the ThinLTO indexing step to postlink combined summary.
unsigned NotEligibleToImport
Indicate if the global value cannot be imported (e.g.
unsigned Linkage
The linkage type of the associated global value.
unsigned Visibility
Indicates the visibility.
unsigned Live
In per-module summary, indicate that the global value must be considered a live root for index-based ...
StringRef getTagName() const
Return the tag of this operand bundle as a string.
A utility class that uses RAII to save and restore the value of a variable.
std::map< uint64_t, WholeProgramDevirtResolution > WPDRes
Mapping from byte offset to whole-program devirt resolution for that (typeid, byte offset) pair.
Kind
Specifies which kind of type check we should emit for this byte array.
@ Unknown
Unknown (analysis not performed, don't lower)
@ Single
Single element (last example in "Short Inline Bit Vectors")
@ Inline
Inlined bit vector ("Short Inline Bit Vectors")
@ Unsat
Unsatisfiable type (i.e. no global has this type metadata)
@ AllOnes
All-ones bit vector ("Eliminating Bit Vector Checks for All-Ones Bit Vectors")
@ ByteArray
Test a byte array (first example)
unsigned SizeM1BitWidth
Range of size-1 expressed as a bit width.
enum llvm::TypeTestResolution::Kind TheKind
@ UniformRetVal
Uniform return value optimization.
@ VirtualConstProp
Virtual constant propagation.
@ UniqueRetVal
Unique return value optimization.
@ Indir
Just do a regular virtual call.
enum llvm::WholeProgramDevirtResolution::Kind TheKind
std::map< std::vector< uint64_t >, ByArg > ResByArg
Resolutions for calls with all constant integer arguments (excluding the first argument,...
std::string SingleImplName
@ SingleImpl
Single implementation devirtualization.
@ Indir
Just do a regular virtual call.
@ Speculative
Speculative devirtualization.
@ BranchFunnel
When retpoline mitigation is enabled, use a branch funnel that is defined in the merged module.
Function object to check whether the second component of a container supported by std::get (like std:...