34 cl::desc(
"Enable adding flow sensitive discriminators"));
38 std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::min()};
41 : Variable(DII->getVariable()),
42 Fragment(DII->getExpression()->getFragmentInfo()),
49DILocation::DILocation(
LLVMContext &
C, StorageType Storage,
unsigned Line,
52 :
MDNode(
C, DILocationKind, Storage, MDs) {
54 "Expected a scope and optional inlined-at");
57 assert(Column < (1u << 16) &&
"Expected 16-bit column");
59 SubclassData32 = Line;
60 SubclassData16 = Column;
62 setImplicitCode(ImplicitCode);
67 if (Column >= (1u << 16))
73 Metadata *InlinedAt,
bool ImplicitCode,
74 StorageType Storage,
bool ShouldCreate) {
86 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
101 if (Locs.
size() == 1)
103 auto *Merged = Locs[0];
106 if (Merged ==
nullptr)
131 for (
auto [L,
I] = std::make_pair(LocA, 0U); L; L = L->getInlinedAt(),
I++) {
135 assert(Res.second &&
"Multiple <SP, InlinedAt> pairs in a location chain?");
139 LocVec::reverse_iterator ARIt = ALocs.rend();
140 LocVec::reverse_iterator BRIt = BLocs.rend();
146 for (
auto [L,
I] = std::make_pair(LocB, 0U); L; L = L->getInlinedAt(),
I++) {
149 if (ARIt != ALocs.rend())
153 auto IT = ALookup.
find({L->getScope()->getSubprogram(), L->getInlinedAt()});
154 if (
IT == ALookup.
end())
158 ARIt = LocVec::reverse_iterator(ALocs.begin() +
IT->second + 1);
159 BRIt = LocVec::reverse_iterator(BLocs.begin() +
I + 1);
178 if (L1->getScope()->getSubprogram() != L2->getScope()->getSubprogram())
186 if (isa<DISubprogram>(S1))
190 for (; S2; S2 = S2->getScope()) {
191 if (Scopes.count(S2))
193 if (isa<DISubprogram>(S2))
200 auto Scope = GetNearestCommonScope(L1->getScope(), L2->getScope());
201 assert(
Scope &&
"No common scope in the same subprogram?");
203 bool SameLine = L1->getLine() == L2->getLine();
204 bool SameCol = L1->getColumn() == L2->getColumn();
205 unsigned Line = SameLine ? L1->getLine() : 0;
206 unsigned Col = SameLine && SameCol ? L1->getColumn() : 0;
211 DILocation *Result = ARIt != ALocs.rend() ? (*ARIt)->getInlinedAt() :
nullptr;
215 for (; ARIt != ALocs.rend() && BRIt != BLocs.rend(); ++ARIt, ++BRIt) {
216 DILocation *Tmp = MergeLocPair(*ARIt, *BRIt, Result);
238std::optional<unsigned>
240 std::array<unsigned, 3> Components = {BD,
DF, CI};
248 std::accumulate(Components.begin(), Components.end(), RemainingWork);
252 unsigned NextBitInsertionIndex = 0;
253 while (RemainingWork > 0) {
254 unsigned C = Components[
I++];
257 Ret |= (EC << NextBitInsertionIndex);
265 unsigned TBD, TDF, TCI = 0;
267 if (TBD == BD && TDF ==
DF && TCI == CI)
283#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
284#include "llvm/IR/DebugInfoFlags.def"
290#define HANDLE_DI_FLAG(ID, NAME) \
292 return "DIFlag" #NAME;
293#include "llvm/IR/DebugInfoFlags.def"
304 if (
A == FlagPrivate)
306 else if (
A == FlagProtected)
313 if (R == FlagSingleInheritance)
314 SplitFlags.
push_back(FlagSingleInheritance);
315 else if (R == FlagMultipleInheritance)
316 SplitFlags.
push_back(FlagMultipleInheritance);
318 SplitFlags.
push_back(FlagVirtualInheritance);
321 if ((
Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
322 Flags &= ~FlagIndirectVirtualBase;
323 SplitFlags.
push_back(FlagIndirectVirtualBase);
326#define HANDLE_DI_FLAG(ID, NAME) \
327 if (DIFlags Bit = Flags & Flag##NAME) { \
328 SplitFlags.push_back(Bit); \
331#include "llvm/IR/DebugInfoFlags.def"
336 if (
auto *
T = dyn_cast<DIType>(
this))
337 return T->getScope();
339 if (
auto *SP = dyn_cast<DISubprogram>(
this))
340 return SP->getScope();
342 if (
auto *LB = dyn_cast<DILexicalBlockBase>(
this))
343 return LB->getScope();
345 if (
auto *NS = dyn_cast<DINamespace>(
this))
346 return NS->getScope();
348 if (
auto *CB = dyn_cast<DICommonBlock>(
this))
349 return CB->getScope();
351 if (
auto *M = dyn_cast<DIModule>(
this))
352 return M->getScope();
354 assert((isa<DIFile>(
this) || isa<DICompileUnit>(
this)) &&
355 "Unhandled type of scope.");
360 if (
auto *
T = dyn_cast<DIType>(
this))
362 if (
auto *SP = dyn_cast<DISubprogram>(
this))
363 return SP->getName();
364 if (
auto *NS = dyn_cast<DINamespace>(
this))
365 return NS->getName();
366 if (
auto *CB = dyn_cast<DICommonBlock>(
this))
367 return CB->getName();
368 if (
auto *M = dyn_cast<DIModule>(
this))
370 assert((isa<DILexicalBlockBase>(
this) || isa<DIFile>(
this) ||
371 isa<DICompileUnit>(
this)) &&
372 "Unhandled type of scope.");
386 StorageType Storage,
bool ShouldCreate) {
394 Hash = Key.getHash();
396 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
407void GenericDINode::recalculateHash() {
408 setHash(GenericDINodeInfo::KeyTy::calculateHash(
this));
411#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
412#define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
413#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
415 if (Storage == Uniqued) { \
416 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
417 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
422 assert(ShouldCreate && \
423 "Expected non-uniqued nodes to always be created"); \
426#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
427 return storeImpl(new (std::size(OPS), Storage) \
428 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
429 Storage, Context.pImpl->CLASS##s)
430#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
431 return storeImpl(new (0u, Storage) \
432 CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
433 Storage, Context.pImpl->CLASS##s)
434#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
435 return storeImpl(new (std::size(OPS), Storage) CLASS(Context, Storage, OPS), \
436 Storage, Context.pImpl->CLASS##s)
437#define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS) \
438 return storeImpl(new (NUM_OPS, Storage) \
439 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
440 Storage, Context.pImpl->CLASS##s)
442DISubrange::DISubrange(
LLVMContext &
C, StorageType Storage,
444 :
DINode(
C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops) {}
446 StorageType Storage,
bool ShouldCreate) {
456 int64_t
Lo, StorageType Storage,
466 StorageType Storage,
bool ShouldCreate) {
477 assert((isa<ConstantAsMetadata>(CB) || isa<DIVariable>(CB) ||
478 isa<DIExpression>(CB)) &&
479 "Count must be signed constant or DIVariable or DIExpression");
481 if (
auto *MD = dyn_cast<ConstantAsMetadata>(CB))
482 return BoundType(cast<ConstantInt>(MD->getValue()));
484 if (
auto *MD = dyn_cast<DIVariable>(CB))
485 return BoundType(MD);
487 if (
auto *MD = dyn_cast<DIExpression>(CB))
488 return BoundType(MD);
498 assert((isa<ConstantAsMetadata>(LB) || isa<DIVariable>(LB) ||
499 isa<DIExpression>(LB)) &&
500 "LowerBound must be signed constant or DIVariable or DIExpression");
502 if (
auto *MD = dyn_cast<ConstantAsMetadata>(LB))
503 return BoundType(cast<ConstantInt>(MD->getValue()));
505 if (
auto *MD = dyn_cast<DIVariable>(LB))
506 return BoundType(MD);
508 if (
auto *MD = dyn_cast<DIExpression>(LB))
509 return BoundType(MD);
519 assert((isa<ConstantAsMetadata>(UB) || isa<DIVariable>(UB) ||
520 isa<DIExpression>(UB)) &&
521 "UpperBound must be signed constant or DIVariable or DIExpression");
523 if (
auto *MD = dyn_cast<ConstantAsMetadata>(UB))
524 return BoundType(cast<ConstantInt>(MD->getValue()));
526 if (
auto *MD = dyn_cast<DIVariable>(UB))
527 return BoundType(MD);
529 if (
auto *MD = dyn_cast<DIExpression>(UB))
530 return BoundType(MD);
540 assert((isa<ConstantAsMetadata>(ST) || isa<DIVariable>(ST) ||
541 isa<DIExpression>(ST)) &&
542 "Stride must be signed constant or DIVariable or DIExpression");
544 if (
auto *MD = dyn_cast<ConstantAsMetadata>(ST))
545 return BoundType(cast<ConstantInt>(MD->getValue()));
547 if (
auto *MD = dyn_cast<DIVariable>(ST))
548 return BoundType(MD);
550 if (
auto *MD = dyn_cast<DIExpression>(ST))
551 return BoundType(MD);
555DIGenericSubrange::DIGenericSubrange(
LLVMContext &
C, StorageType Storage,
557 :
DINode(
C, DIGenericSubrangeKind, Storage, dwarf::DW_TAG_generic_subrange,
566 Metadata *Ops[] = {CountNode, LB, UB, Stride};
575 assert((isa<DIVariable>(CB) || isa<DIExpression>(CB)) &&
576 "Count must be signed constant or DIVariable or DIExpression");
578 if (
auto *MD = dyn_cast<DIVariable>(CB))
581 if (
auto *MD = dyn_cast<DIExpression>(CB))
592 assert((isa<DIVariable>(LB) || isa<DIExpression>(LB)) &&
593 "LowerBound must be signed constant or DIVariable or DIExpression");
595 if (
auto *MD = dyn_cast<DIVariable>(LB))
598 if (
auto *MD = dyn_cast<DIExpression>(LB))
609 assert((isa<DIVariable>(UB) || isa<DIExpression>(UB)) &&
610 "UpperBound must be signed constant or DIVariable or DIExpression");
612 if (
auto *MD = dyn_cast<DIVariable>(UB))
615 if (
auto *MD = dyn_cast<DIExpression>(UB))
626 assert((isa<DIVariable>(ST) || isa<DIExpression>(ST)) &&
627 "Stride must be signed constant or DIVariable or DIExpression");
629 if (
auto *MD = dyn_cast<DIVariable>(ST))
632 if (
auto *MD = dyn_cast<DIExpression>(ST))
638DIEnumerator::DIEnumerator(
LLVMContext &
C, StorageType Storage,
641 :
DINode(
C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
647 StorageType Storage,
bool ShouldCreate) {
656 uint32_t AlignInBits,
unsigned Encoding,
657 DIFlags Flags, StorageType Storage,
669 case dwarf::DW_ATE_signed:
670 case dwarf::DW_ATE_signed_char:
672 case dwarf::DW_ATE_unsigned:
673 case dwarf::DW_ATE_unsigned_char:
685 unsigned Encoding, StorageType Storage,
696DIType *DIDerivedType::getClassType()
const {
698 return cast_or_null<DIType>(getExtraData());
702 if (
auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
703 if (
auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
704 return static_cast<uint32_t>(CI->getZExtValue());
709 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
710 return C->getValue();
716 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
717 return C->getValue();
722 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
723 return C->getValue();
732 std::optional<unsigned> DWARFAddressSpace, DIFlags Flags,
734 StorageType Storage,
bool ShouldCreate) {
743 DWARFAddressSpace,
Flags),
794 if (CT->getTag() !=
Tag)
799 if (!CT->isForwardDecl() || (
Flags & DINode::FlagFwdDecl))
809 assert((std::end(Ops) - std::begin(Ops)) == (
int)CT->getNumOperands() &&
810 "Mismatched number of operands");
811 for (
unsigned I = 0,
E = CT->getNumOperands();
I !=
E; ++
I)
812 if (Ops[
I] != CT->getOperand(
I))
813 CT->setOperand(
I, Ops[
I]);
821 DIFlags Flags,
Metadata *Elements,
unsigned RuntimeLang,
836 if (CT->getTag() !=
Tag)
849DISubroutineType::DISubroutineType(
LLVMContext &
C, StorageType Storage,
850 DIFlags Flags, uint8_t
CC,
852 :
DIType(
C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type, 0,
853 0, 0, 0,
Flags, Ops),
866 std::optional<ChecksumInfo<MDString *>> CS,
MDString *Src,
868 :
DIScope(
C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
869 Checksum(CS),
Source(Src) {}
879StringRef DIFile::getChecksumKindAsString(ChecksumKind CSKind) {
887std::optional<DIFile::ChecksumKind>
899 MDString *Source, StorageType Storage,
910DICompileUnit::DICompileUnit(
LLVMContext &
C, StorageType Storage,
912 unsigned RuntimeVersion,
unsigned EmissionKind,
913 uint64_t DWOId,
bool SplitDebugInlining,
914 bool DebugInfoForProfiling,
unsigned NameTableKind,
916 :
DIScope(
C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
919 SplitDebugInlining(SplitDebugInlining),
920 DebugInfoForProfiling(DebugInfoForProfiling),
928 unsigned RuntimeVersion,
MDString *SplitDebugFilename,
931 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
932 unsigned NameTableKind,
bool RangesBaseAddress,
MDString *SysRoot,
933 MDString *SDK, StorageType Storage,
bool ShouldCreate) {
952 RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
953 DebugInfoForProfiling, NameTableKind, RangesBaseAddress,
958std::optional<DICompileUnit::DebugEmissionKind>
968std::optional<DICompileUnit::DebugNameTableKind>
984 return "LineTablesOnly";
986 return "DebugDirectivesOnly";
1002DISubprogram::DISubprogram(
LLVMContext &
C, StorageType Storage,
unsigned Line,
1003 unsigned ScopeLine,
unsigned VirtualIndex,
1004 int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags,
1006 :
DILocalScope(
C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram, Ops),
1007 Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
1008 ThisAdjustment(ThisAdjustment),
Flags(
Flags), SPFlags(SPFlags) {
1013 unsigned Virtuality,
bool IsMainSubprogram) {
1015 static_assert(int(SPFlagVirtual) == int(dwarf::DW_VIRTUALITY_virtual) &&
1016 int(SPFlagPureVirtual) ==
1017 int(dwarf::DW_VIRTUALITY_pure_virtual),
1018 "Virtuality constant mismatch");
1021 (IsLocalToUnit ? SPFlagLocalToUnit : SPFlagZero) |
1022 (IsDefinition ? SPFlagDefinition : SPFlagZero) |
1023 (IsOptimized ? SPFlagOptimized : SPFlagZero) |
1024 (IsMainSubprogram ? SPFlagMainSubprogram : SPFlagZero));
1028 if (
auto *
Block = dyn_cast<DILexicalBlockBase>(
this))
1029 return Block->getScope()->getSubprogram();
1030 return const_cast<DISubprogram *
>(cast<DISubprogram>(
this));
1034 if (
auto *File = dyn_cast<DILexicalBlockFile>(
this))
1035 return File->getScope()->getNonLexicalBlockFileScope();
1043 DIScope *CachedResult =
nullptr;
1045 for (
DIScope *Scope = &RootScope; !isa<DISubprogram>(Scope);
1046 Scope = Scope->getScope()) {
1047 if (
auto It = Cache.
find(Scope); It != Cache.
end()) {
1048 CachedResult = cast<DIScope>(It->second);
1056 DIScope *UpdatedScope = CachedResult ? CachedResult : &NewSP;
1058 TempMDNode ClonedScope = ScopeToUpdate->
clone();
1059 cast<DILexicalBlockBase>(*ClonedScope).replaceScope(UpdatedScope);
1062 Cache[ScopeToUpdate] = UpdatedScope;
1065 return cast<DILocalScope>(UpdatedScope);
1070#define HANDLE_DISP_FLAG(ID, NAME) .Case("DISPFlag" #NAME, SPFlag##NAME)
1071#include "llvm/IR/DebugInfoFlags.def"
1080#define HANDLE_DISP_FLAG(ID, NAME) \
1081 case SPFlag##NAME: \
1082 return "DISPFlag" #NAME;
1083#include "llvm/IR/DebugInfoFlags.def"
1094#define HANDLE_DISP_FLAG(ID, NAME) \
1095 if (DISPFlags Bit = Flags & SPFlag##NAME) { \
1096 SplitFlags.push_back(Bit); \
1099#include "llvm/IR/DebugInfoFlags.def"
1106 unsigned ScopeLine,
Metadata *ContainingType,
unsigned VirtualIndex,
1107 int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags,
Metadata *Unit,
1110 StorageType Storage,
bool ShouldCreate) {
1141 (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, SPFlags), Ops,
1145bool DISubprogram::describes(
const Function *
F)
const {
1146 assert(
F &&
"Invalid function");
1147 return F->getSubprogram() ==
this;
1156 unsigned Column, StorageType Storage,
1157 bool ShouldCreate) {
1169 unsigned Discriminator,
1170 StorageType Storage,
1171 bool ShouldCreate) {
1178DINamespace::DINamespace(
LLVMContext &Context, StorageType Storage,
1180 :
DIScope(
Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace, Ops),
1181 ExportSymbols(ExportSymbols) {}
1184 StorageType Storage,
bool ShouldCreate) {
1192DICommonBlock::DICommonBlock(
LLVMContext &Context, StorageType Storage,
1194 :
DIScope(
Context, DICommonBlockKind, Storage, dwarf::DW_TAG_common_block,
1200 StorageType Storage,
bool ShouldCreate) {
1208DIModule::DIModule(
LLVMContext &Context, StorageType Storage,
unsigned LineNo,
1210 :
DIScope(
Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops),
1211 LineNo(LineNo), IsDecl(IsDecl) {}
1216 unsigned LineNo,
bool IsDecl, StorageType Storage,
1217 bool ShouldCreate) {
1225DITemplateTypeParameter::DITemplateTypeParameter(
LLVMContext &Context,
1226 StorageType Storage,
1230 dwarf::DW_TAG_template_type_parameter, IsDefault,
1236 StorageType Storage,
bool ShouldCreate) {
1245 bool isDefault,
Metadata *
Value, StorageType Storage,
bool ShouldCreate) {
1257 Metadata *StaticDataMemberDeclaration,
1260 bool ShouldCreate) {
1283 unsigned Arg, DIFlags Flags,
uint32_t AlignInBits,
1285 bool ShouldCreate) {
1287 assert(Arg <= UINT16_MAX &&
"Expected argument number to fit in 16-bits");
1300 :
DINode(
C,
ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
1301 AlignInBits(AlignInBits) {}
1307 if (
auto *
T = dyn_cast<DIType>(RawType))
1311 if (
auto *DT = dyn_cast<DIDerivedType>(RawType)) {
1313 RawType = DT->getRawBaseType();
1322 return std::nullopt;
1325DILabel::DILabel(
LLVMContext &
C, StorageType Storage,
unsigned Line,
1327 :
DINode(
C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
1329 Metadata *File,
unsigned Line, StorageType Storage,
1330 bool ShouldCreate) {
1340 StorageType Storage,
bool ShouldCreate) {
1355 bool ShouldCreate) {
1364 if (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31)
1370 case dwarf::DW_OP_bregx:
1372 case dwarf::DW_OP_constu:
1373 case dwarf::DW_OP_consts:
1374 case dwarf::DW_OP_deref_size:
1375 case dwarf::DW_OP_plus_uconst:
1379 case dwarf::DW_OP_regx:
1389 if (
I->get() +
I->getSize() >
E->get())
1393 if ((Op >= dwarf::DW_OP_reg0 && Op <= dwarf::DW_OP_reg31) ||
1394 (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31))
1403 return I->get() +
I->getSize() ==
E->get();
1404 case dwarf::DW_OP_stack_value: {
1406 if (
I->get() +
I->getSize() ==
E->get())
1413 case dwarf::DW_OP_swap: {
1434 return I->get() == FirstOp->get() &&
I->getArg(0) == 1;
1440 case dwarf::DW_OP_constu:
1441 case dwarf::DW_OP_plus_uconst:
1442 case dwarf::DW_OP_plus:
1443 case dwarf::DW_OP_minus:
1444 case dwarf::DW_OP_mul:
1445 case dwarf::DW_OP_div:
1446 case dwarf::DW_OP_mod:
1447 case dwarf::DW_OP_or:
1448 case dwarf::DW_OP_and:
1449 case dwarf::DW_OP_xor:
1450 case dwarf::DW_OP_shl:
1451 case dwarf::DW_OP_shr:
1452 case dwarf::DW_OP_shra:
1453 case dwarf::DW_OP_deref:
1454 case dwarf::DW_OP_deref_size:
1455 case dwarf::DW_OP_xderef:
1456 case dwarf::DW_OP_lit0:
1457 case dwarf::DW_OP_not:
1458 case dwarf::DW_OP_dup:
1459 case dwarf::DW_OP_regx:
1460 case dwarf::DW_OP_bregx:
1461 case dwarf::DW_OP_push_object_address:
1462 case dwarf::DW_OP_over:
1463 case dwarf::DW_OP_consts:
1464 case dwarf::DW_OP_eq:
1465 case dwarf::DW_OP_ne:
1466 case dwarf::DW_OP_gt:
1467 case dwarf::DW_OP_ge:
1468 case dwarf::DW_OP_lt:
1469 case dwarf::DW_OP_le:
1483 for (
const auto &It :
expr_ops()) {
1484 switch (It.getOp()) {
1487 case dwarf::DW_OP_stack_value:
1505 for (
const auto &It :
expr_ops()) {
1506 switch (It.getOp()) {
1526 auto ExprOpBegin =
expr_ops().begin();
1531 return !std::any_of(ExprOpBegin, ExprOpEnd, [](
auto Op) {
1549 return ExprOp.getOp() == dwarf::DW_OP_LLVM_arg;
1559std::optional<const DIExpression *>
1563 return std::nullopt;
1586 return ExprOp.getOp() == dwarf::DW_OP_LLVM_arg;
1599 if (Op.getOp() == dwarf::DW_OP_stack_value ||
1604 Op.appendToVector(Ops);
1613 bool SecondIndirect) {
1619 return FirstOps == SecondOps;
1622std::optional<DIExpression::FragmentInfo>
1624 for (
auto I = Start;
I !=
End; ++
I)
1629 return std::nullopt;
1635 Ops.
push_back(dwarf::DW_OP_plus_uconst);
1653 if (
getNumElements() == 2 && Elements[0] == dwarf::DW_OP_plus_uconst) {
1658 if (
getNumElements() == 3 && Elements[0] == dwarf::DW_OP_constu) {
1659 if (Elements[2] == dwarf::DW_OP_plus) {
1663 if (Elements[2] == dwarf::DW_OP_minus) {
1676 SeenOps.
insert(ExprOp.getArg(0));
1684 unsigned &AddrClass) {
1687 const unsigned PatternSize = 4;
1688 if (Expr->Elements.size() >= PatternSize &&
1689 Expr->Elements[PatternSize - 4] == dwarf::DW_OP_constu &&
1690 Expr->Elements[PatternSize - 2] == dwarf::DW_OP_swap &&
1691 Expr->Elements[PatternSize - 1] == dwarf::DW_OP_xderef) {
1692 AddrClass = Expr->Elements[PatternSize - 3];
1694 if (Expr->Elements.size() == PatternSize)
1698 Expr->Elements.size() - PatternSize));
1722 assert(Expr &&
"Can't add ops to this expression");
1726 [](
auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
1728 "Location Index must be 0 for a non-variadic expression.");
1737 if (Op.getOp() == dwarf::DW_OP_stack_value)
1740 NewOps.
push_back(dwarf::DW_OP_stack_value);
1744 Op.appendToVector(NewOps);
1749 NewOps.
push_back(dwarf::DW_OP_stack_value);
1756 assert(Expr &&
"Can't replace args in this expression");
1762 Op.appendToVector(NewOps);
1766 uint64_t Arg = Op.getArg(0) == OldArg ? NewArg : Op.getArg(0);
1779 assert(Expr &&
"Can't prepend ops to this expression");
1795 if (Op.getOp() == dwarf::DW_OP_stack_value)
1798 Ops.
push_back(dwarf::DW_OP_stack_value);
1802 Op.appendToVector(Ops);
1805 Ops.
push_back(dwarf::DW_OP_stack_value);
1811 assert(Expr && !Ops.
empty() &&
"Can't append ops to this expression");
1817 if (Op.getOp() == dwarf::DW_OP_stack_value ||
1824 Op.appendToVector(NewOps);
1829 assert(result->isValid() &&
"concatenated expression is not valid");
1835 assert(Expr && !Ops.
empty() &&
"Can't append ops to this expression");
1838 return Op == dwarf::DW_OP_stack_value ||
1841 "Can't append this op");
1848 unsigned DropUntilStackValue = FI ? 3 : 0;
1851 bool NeedsDeref = (Expr->
getNumElements() > DropUntilStackValue) &&
1852 (ExprOpsBeforeFragment.
back() != dwarf::DW_OP_stack_value);
1853 bool NeedsStackValue = NeedsDeref || ExprOpsBeforeFragment.
empty();
1861 if (NeedsStackValue)
1862 NewOps.
push_back(dwarf::DW_OP_stack_value);
1867 const DIExpression *Expr,
unsigned OffsetInBits,
unsigned SizeInBits) {
1871 bool CanSplitValue =
true;
1875 switch (Op.getOp()) {
1878 case dwarf::DW_OP_shr:
1879 case dwarf::DW_OP_shra:
1880 case dwarf::DW_OP_shl:
1881 case dwarf::DW_OP_plus:
1882 case dwarf::DW_OP_plus_uconst:
1883 case dwarf::DW_OP_minus:
1889 CanSplitValue =
false;
1891 case dwarf::DW_OP_deref:
1892 case dwarf::DW_OP_deref_size:
1893 case dwarf::DW_OP_deref_type:
1894 case dwarf::DW_OP_xderef:
1895 case dwarf::DW_OP_xderef_size:
1896 case dwarf::DW_OP_xderef_type:
1899 CanSplitValue =
true;
1901 case dwarf::DW_OP_stack_value:
1904 return std::nullopt;
1908 uint64_t FragmentOffsetInBits = Op.getArg(0);
1909 uint64_t FragmentSizeInBits = Op.getArg(1);
1910 (void)FragmentSizeInBits;
1911 assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
1912 "new fragment outside of original fragment");
1913 OffsetInBits += FragmentOffsetInBits;
1917 Op.appendToVector(Ops);
1921 assert(Expr &&
"Unknown DIExpression");
1928std::pair<DIExpression *, const ConstantInt *>
1936 bool Changed =
false;
1938 switch (Op.getOp()) {
1951 if (Op.getArg(1) == dwarf::DW_ATE_signed)
1954 assert(Op.getArg(1) == dwarf::DW_ATE_unsigned &&
"Unexpected operand");
1959 Op.appendToVector(Ops);
1971 Result = std::max(Result, ExprOp.getArg(0) + 1);
1973 "Expression is missing one or more location operands.");
1977std::optional<DIExpression::SignedOrUnsignedConstant>
1990 return std::nullopt;
1998 return std::nullopt;
2013 unsigned FromSize,
unsigned ToSize,
2021 bool ShouldCreate) {
2027 unsigned Line,
unsigned Attributes,
2029 :
DINode(
C, DIObjCPropertyKind,
Storage, dwarf::DW_TAG_APPLE_property, Ops),
2035 Metadata *
Type, StorageType Storage,
bool ShouldCreate) {
2049 StorageType Storage,
2050 bool ShouldCreate) {
2060 bool ShouldCreate) {
2069 Metadata *Elements, StorageType Storage,
2070 bool ShouldCreate) {
2078 StorageType Storage,
bool ShouldCreate) {
2085 assert((!New || isa<ValueAsMetadata>(New)) &&
2086 "DIArgList must be passed a ValueAsMetadata");
2096 if (&VM == OldVMPtr) {
2104 if (uniquify() !=
this)
2109void DIArgList::track() {
2114void DIArgList::untrack() {
2119void DIArgList::dropAllReferences() {
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
static unsigned encodingBits(unsigned C)
static unsigned encodeComponent(unsigned C)
static unsigned getNextComponentInDiscriminator(unsigned D)
Returns the next component stored in discriminator.
static unsigned getUnsignedFromPrefixEncoding(unsigned U)
Reverse transformation as getPrefixEncodingFromUnsigned.
This file contains constants used for implementing Dwarf debug support.
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallSet class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Class for arbitrary precision integers.
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Annotations lets you mark points and ranges inside source code, for tests:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & back() const
back - Get the last element.
size_t size() const
size - Get the array size.
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
bool empty() const
empty - Check if the array is empty.
This is the shared class of boolean and integer constants.
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
const APInt & getValue() const
Return the constant as an APInt value reference.
This is an important base class in LLVM.
List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.
void handleChangedOperand(void *Ref, Metadata *New)
Basic type, like 'int' or 'float'.
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t unsigned DIFlags Flags
unsigned StringRef uint64_t SizeInBits
std::optional< Signedness > getSignedness() const
Return the signedness of this type, or std::nullopt if this type is neither signed nor unsigned.
unsigned getEncoding() const
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t AlignInBits
Metadata Metadata MDString * Name
Metadata Metadata MDString Metadata * File
static const char * nameTableKindString(DebugNameTableKind PK)
static const char * emissionKindString(DebugEmissionKind EK)
DebugEmissionKind getEmissionKind() const
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata * Macros
unsigned Metadata MDString bool MDString * Flags
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata * EnumTypes
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata * RetainedTypes
DebugNameTableKind getNameTableKind() const
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata * GlobalVariables
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString MDString * SDK
unsigned Metadata MDString * Producer
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString * SysRoot
unsigned Metadata MDString bool MDString unsigned MDString * SplitDebugFilename
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata * ImportedEntities
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t AlignInBits
unsigned MDString Metadata unsigned Line
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata * Elements
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata * TemplateParams
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata Metadata * Rank
static DICompositeType * getODRTypeIfExists(LLVMContext &Context, MDString &Identifier)
static DICompositeType * buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator, Metadata *DataLocation, Metadata *Associated, Metadata *Allocated, Metadata *Rank, Metadata *Annotations)
Build a DICompositeType with the given ODR identifier.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t OffsetInBits
unsigned MDString Metadata unsigned Metadata * Scope
unsigned MDString Metadata * File
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata * Allocated
unsigned MDString Metadata unsigned Metadata Metadata * BaseType
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Flags
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata * Discriminator
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata * DataLocation
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString * Identifier
unsigned MDString Metadata unsigned Metadata Metadata uint64_t SizeInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata * Associated
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata * VTableHolder
unsigned StringRef DIFile unsigned DIScope DIType * BaseType
unsigned StringRef DIFile unsigned DIScope DIType uint64_t SizeInBits
unsigned StringRef DIFile * File
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t std::optional< unsigned > DIFlags Flags
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t OffsetInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t AlignInBits
unsigned StringRef DIFile unsigned DIScope * Scope
Constant * getConstant() const
Constant * getStorageOffsetInBits() const
Constant * getDiscriminantValue() const
uint32_t getVBPtrOffset() const
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t std::optional< unsigned > DIFlags Metadata * ExtraData
unsigned StringRef DIFile unsigned Line
int64_t bool MDString * Name
unsigned getSize() const
Return the size of the operand.
uint64_t getOp() const
Get the operand code.
An iterator for expression operands.
element_iterator elements_end() const
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
iterator_range< expr_op_iterator > expr_ops() const
static DIExpression * append(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Append the opcodes Ops to DIExpr.
std::array< uint64_t, 6 > ExtOps
unsigned getNumElements() const
static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed)
Returns the ops for a zero- or sign-extension in a DIExpression.
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
bool extractIfOffset(int64_t &Offset) const
If this is a constant offset, extract it.
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
static bool isEqualExpression(const DIExpression *FirstExpr, bool FirstIndirect, const DIExpression *SecondExpr, bool SecondIndirect)
Determines whether two debug values should produce equivalent DWARF expressions, using their DIExpres...
expr_op_iterator expr_op_end() const
bool isImplicit() const
Return whether this is an implicit location description.
element_iterator elements_begin() const
bool hasAllLocationOps(unsigned N) const
Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg,...
std::optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
static DIExpression * appendOpsToArg(const DIExpression *Expr, ArrayRef< uint64_t > Ops, unsigned ArgNo, bool StackValue=false)
Create a copy of Expr by appending the given list of Ops to each instance of the operand DW_OP_LLVM_a...
bool isComplex() const
Return whether the location is computed on the expression stack, meaning it cannot be a simple regist...
static std::optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
static std::optional< const DIExpression * > convertToNonVariadicExpression(const DIExpression *Expr)
If Expr is a valid single-location expression, i.e.
std::pair< DIExpression *, const ConstantInt * > constantFold(const ConstantInt *CI)
Try to shorten an expression with an initial constant operand.
bool isDeref() const
Return whether there is exactly one operator and it is a DW_OP_deref;.
static const DIExpression * convertToVariadicExpression(const DIExpression *Expr)
If Expr is a non-variadic expression (i.e.
uint64_t getNumLocationOperands() const
Return the number of unique location operands referred to (via DW_OP_LLVM_arg) in this expression; th...
ArrayRef< uint64_t > getElements() const
static DIExpression * replaceArg(const DIExpression *Expr, uint64_t OldArg, uint64_t NewArg)
Create a copy of Expr with each instance of DW_OP_LLVM_arg, \p OldArg replaced with DW_OP_LLVM_arg,...
static void canonicalizeExpressionOps(SmallVectorImpl< uint64_t > &Ops, const DIExpression *Expr, bool IsIndirect)
Inserts the elements of Expr into Ops modified to a canonical form, which uses DW_OP_LLVM_arg (i....
uint64_t getElement(unsigned I) const
static std::optional< DIExpression * > createFragmentExpression(const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits)
Create a DIExpression to describe one part of an aggregate variable that is fragmented across multipl...
static const DIExpression * convertToUndefExpression(const DIExpression *Expr)
Removes all elements from Expr that do not apply to an undef debug value, which includes every operat...
static DIExpression * prepend(const DIExpression *Expr, uint8_t Flags, int64_t Offset=0)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an ...
static DIExpression * appendToStack(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Convert DIExpr into a stack value if it isn't one already by appending DW_OP_deref if needed,...
static DIExpression * appendExt(const DIExpression *Expr, unsigned FromSize, unsigned ToSize, bool Signed)
Append a zero- or sign-extension to Expr.
bool isSingleLocationExpression() const
Return whether the evaluated expression makes use of a single location at the start of the expression...
std::optional< SignedOrUnsignedConstant > isConstant() const
Determine whether this represents a constant value, if so.
static const DIExpression * extractAddressClass(const DIExpression *Expr, unsigned &AddrClass)
Checks if the last 4 elements of the expression are DW_OP_constu <DWARF Address Space> DW_OP_swap DW_...
static DIExpression * prependOpcodes(const DIExpression *Expr, SmallVectorImpl< uint64_t > &Ops, bool StackValue=false, bool EntryValue=false)
Prepend DIExpr with the given opcodes and optionally turn it into a stack value.
MDString MDString * Directory
static std::optional< ChecksumKind > getChecksumKind(StringRef CSKindStr)
MDString MDString std::optional< ChecksumInfo< MDString * > > CS
Metadata * getRawLowerBound() const
Metadata * getRawCountNode() const
Metadata * getRawStride() const
BoundType getLowerBound() const
Metadata * getRawUpperBound() const
BoundType getCount() const
BoundType getUpperBound() const
PointerUnion< DIVariable *, DIExpression * > BoundType
BoundType getStride() const
A pair of DIGlobalVariable and DIExpression.
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata * TemplateParams
Metadata MDString MDString Metadata unsigned Line
Metadata MDString MDString Metadata unsigned Metadata * Type
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata * StaticDataMemberDeclaration
Metadata MDString MDString * LinkageName
Metadata MDString MDString Metadata * File
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata uint32_t AlignInBits
An imported module (C++ using directive or similar).
unsigned Metadata Metadata * Entity
unsigned Metadata Metadata Metadata unsigned MDString * Name
unsigned Metadata Metadata Metadata * File
unsigned Metadata * Scope
Metadata MDString Metadata * File
DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops)
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
DILocalScope * getNonLexicalBlockFileScope() const
Get the first non DILexicalBlockFile scope of this scope.
static DILocalScope * cloneScopeForSubprogram(DILocalScope &RootScope, DISubprogram &NewSP, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &Cache)
Traverses the scope chain rooted at RootScope until it hits a Subprogram, recreating the chain with "...
Metadata MDString Metadata unsigned Metadata * Type
Metadata MDString Metadata * File
Metadata MDString Metadata unsigned Line
Metadata MDString Metadata unsigned Metadata unsigned DIFlags uint32_t AlignInBits
unsigned unsigned DILocalScope * Scope
static DILocation * getMergedLocations(ArrayRef< DILocation * > Locs)
Try to combine the vector of locations passed as input in a single one.
static std::optional< unsigned > encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI)
Raw encoding of the discriminator.
unsigned unsigned DILocalScope DILocation bool ImplicitCode
static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF, unsigned &CI)
Raw decoder for values in an encoded discriminator D.
static DILocation * getMergedLocation(DILocation *LocA, DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
unsigned unsigned DILocalScope DILocation * InlinedAt
unsigned unsigned Metadata * File
unsigned unsigned Metadata Metadata * Elements
unsigned unsigned MDString * Name
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Metadata Metadata * Scope
Metadata Metadata MDString * Name
Metadata Metadata MDString MDString MDString MDString * APINotesFile
Metadata Metadata MDString MDString MDString * IncludePath
Metadata Metadata MDString MDString * ConfigurationMacros
Tagged DWARF-like metadata node.
dwarf::Tag getTag() const
static DIFlags getFlag(StringRef Flag)
static DIFlags splitFlags(DIFlags Flags, SmallVectorImpl< DIFlags > &SplitFlags)
Split up a flags bitfield.
static StringRef getFlagString(DIFlags Flag)
MDString Metadata unsigned MDString * GetterName
MDString Metadata unsigned MDString MDString * SetterName
Base class for scope-like contexts.
StringRef getName() const
DIScope * getScope() const
String type, Fortran CHARACTER(n)
unsigned MDString Metadata Metadata Metadata uint64_t SizeInBits
unsigned MDString Metadata Metadata Metadata uint64_t uint32_t AlignInBits
unsigned MDString Metadata Metadata Metadata * StringLocationExp
unsigned MDString Metadata Metadata * StringLengthExp
unsigned MDString Metadata * StringLength
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata * Unit
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata * Annotations
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata * ContainingType
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata * TemplateParams
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata * Declaration
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata MDString * TargetFuncName
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata * ThrownTypes
static DISPFlags getFlag(StringRef Flag)
Metadata MDString MDString Metadata * File
static DISPFlags splitFlags(DISPFlags Flags, SmallVectorImpl< DISPFlags > &SplitFlags)
Split up a flags bitfield for easier printing.
Metadata MDString MDString * LinkageName
static StringRef getFlagString(DISPFlags Flag)
Metadata MDString MDString Metadata unsigned Metadata * Type
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata * RetainedNodes
DISPFlags
Debug info subprogram flags.
BoundType getUpperBound() const
BoundType getStride() const
BoundType getLowerBound() const
BoundType getCount() const
Type array for a subprogram.
DIFlags uint8_t Metadata * TypeArray
Base class for template parameters.
unsigned MDString Metadata * Type
bool isStaticMember() const
std::optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
Metadata * getRawType() const
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line, ArrayRef< Metadata * > Ops, uint32_t AlignInBits=0)
This is the common base class for debug info intrinsics for variables.
DebugVariableAggregate(const DbgVariableIntrinsic *DVI)
Identifies a unique instance of a variable.
DebugVariable(const DbgVariableIntrinsic *DII)
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&... Args)
Class representing an expression and its matching format.
Generic tagged DWARF-like metadata node.
dwarf::Tag getTag() const
unsigned MDString * Header
unsigned MDString ArrayRef< Metadata * > DwarfOps
std::optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
This is an important class for using LLVM in a threaded context.
bool isODRUniquingDebugTypes() const
Whether there is a string map for uniquing debug info identifiers across the context.
LLVMContextImpl *const pImpl
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
void storeDistinctInContext()
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
TempMDNode clone() const
Create a (temporary) clone of this.
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
LLVMContext & getContext() const
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
StringRef getString() const
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Implements a dense probed hash-table based set with some number of buckets stored inline.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt64Ty(LLVMContext &C)
LLVM Value Representation.
std::pair< iterator, bool > insert(const ValueT &V)
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
@ C
The default llvm calling convention, compatible with C.
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
cl::opt< bool > EnableFSDiscriminator
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
@ Ref
The access may reference the value stored in memory.
Holds the characteristics of one fragment of a larger variable.
A single checksum, represented by a Kind and a Value (a string).