Go to the documentation of this file.
33 cl::desc(
"Enable adding flow sensitive discriminators"));
40 : Variable(DII->getVariable()),
41 Fragment(DII->getExpression()->getFragmentInfo()),
44 DILocation::DILocation(
LLVMContext &
C, StorageType Storage,
unsigned Line,
47 :
MDNode(
C, DILocationKind, Storage, MDs) {
49 "Expected a scope and optional inlined-at");
52 assert(Column < (1u << 16) &&
"Expected 16-bit column");
54 SubclassData32 = Line;
55 SubclassData16 = Column;
57 setImplicitCode(ImplicitCode);
62 if (Column >= (1u << 16))
68 Metadata *InlinedAt,
bool ImplicitCode,
69 StorageType Storage,
bool ShouldCreate) {
81 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
99 auto *Merged = Locs[0];
102 if (Merged ==
nullptr)
118 std::pair<unsigned, unsigned>, 4>
123 unsigned Line = LocA->getLine();
124 unsigned Col = LocA->getColumn();
128 auto AdvanceToParentLoc = [&
S, &L, &
Line, &Col]() {
132 Col = L->getColumn();
134 L = L->getInlinedAt();
139 if (
auto *
LS = dyn_cast<DILocalScope>(
S))
140 Locations.try_emplace(std::make_pair(
LS, L), std::make_pair(
Line, Col));
141 AdvanceToParentLoc();
145 S = LocB->getScope();
146 L = LocB->getInlinedAt();
147 Line = LocB->getLine();
148 Col = LocB->getColumn();
150 if (
auto *
LS = dyn_cast<DILocalScope>(
S)) {
151 auto MatchLoc = Locations.find(std::make_pair(
LS, L));
152 if (MatchLoc != Locations.end()) {
156 bool SameLine =
Line == MatchLoc->second.first;
157 bool SameCol = Col == MatchLoc->second.second;
159 Col = SameLine && SameCol ? Col : 0;
163 AdvanceToParentLoc();
170 S = LocA->getScope();
176 std::optional<unsigned>
178 std::array<unsigned, 3> Components = {BD,
DF, CI};
186 std::accumulate(Components.begin(), Components.end(), RemainingWork);
190 unsigned NextBitInsertionIndex = 0;
191 while (RemainingWork > 0) {
192 unsigned C = Components[
I++];
195 Ret |= (EC << NextBitInsertionIndex);
203 unsigned TBD, TDF, TCI = 0;
205 if (TBD == BD && TDF ==
DF && TCI == CI)
221 #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
222 #include "llvm/IR/DebugInfoFlags.def"
228 #define HANDLE_DI_FLAG(ID, NAME) \
230 return "DIFlag" #NAME;
231 #include "llvm/IR/DebugInfoFlags.def"
242 if (A == FlagPrivate)
243 SplitFlags.push_back(FlagPrivate);
244 else if (A == FlagProtected)
245 SplitFlags.push_back(FlagProtected);
247 SplitFlags.push_back(FlagPublic);
251 if (R == FlagSingleInheritance)
252 SplitFlags.push_back(FlagSingleInheritance);
253 else if (R == FlagMultipleInheritance)
254 SplitFlags.push_back(FlagMultipleInheritance);
256 SplitFlags.push_back(FlagVirtualInheritance);
259 if ((Flags & FlagIndirectVirtualBase) == FlagIndirectVirtualBase) {
260 Flags &= ~FlagIndirectVirtualBase;
261 SplitFlags.push_back(FlagIndirectVirtualBase);
264 #define HANDLE_DI_FLAG(ID, NAME) \
265 if (DIFlags Bit = Flags & Flag##NAME) { \
266 SplitFlags.push_back(Bit); \
269 #include "llvm/IR/DebugInfoFlags.def"
274 if (
auto *
T = dyn_cast<DIType>(
this))
275 return T->getScope();
277 if (
auto *SP = dyn_cast<DISubprogram>(
this))
278 return SP->getScope();
280 if (
auto *LB = dyn_cast<DILexicalBlockBase>(
this))
281 return LB->getScope();
283 if (
auto *NS = dyn_cast<DINamespace>(
this))
284 return NS->getScope();
286 if (
auto *CB = dyn_cast<DICommonBlock>(
this))
287 return CB->getScope();
289 if (
auto *
M = dyn_cast<DIModule>(
this))
290 return M->getScope();
292 assert((isa<DIFile>(
this) || isa<DICompileUnit>(
this)) &&
293 "Unhandled type of scope.");
298 if (
auto *
T = dyn_cast<DIType>(
this))
300 if (
auto *SP = dyn_cast<DISubprogram>(
this))
301 return SP->getName();
302 if (
auto *NS = dyn_cast<DINamespace>(
this))
303 return NS->getName();
304 if (
auto *CB = dyn_cast<DICommonBlock>(
this))
305 return CB->getName();
306 if (
auto *
M = dyn_cast<DIModule>(
this))
308 assert((isa<DILexicalBlockBase>(
this) || isa<DIFile>(
this) ||
309 isa<DICompileUnit>(
this)) &&
310 "Unhandled type of scope.");
316 return !
S || !
S->getString().empty();
324 StorageType Storage,
bool ShouldCreate) {
332 Hash =
Key.getHash();
334 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
345 void GenericDINode::recalculateHash() {
346 setHash(GenericDINodeInfo::KeyTy::calculateHash(
this));
349 #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
350 #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
351 #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
353 if (Storage == Uniqued) { \
354 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
355 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
360 assert(ShouldCreate && \
361 "Expected non-uniqued nodes to always be created"); \
364 #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
365 return storeImpl(new (std::size(OPS), Storage) \
366 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
367 Storage, Context.pImpl->CLASS##s)
368 #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
369 return storeImpl(new (0u, Storage) \
370 CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
371 Storage, Context.pImpl->CLASS##s)
372 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
373 return storeImpl(new (std::size(OPS), Storage) CLASS(Context, Storage, OPS), \
374 Storage, Context.pImpl->CLASS##s)
375 #define DEFINE_GETIMPL_STORE_N(CLASS, ARGS, OPS, NUM_OPS) \
376 return storeImpl(new (NUM_OPS, Storage) \
377 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
378 Storage, Context.pImpl->CLASS##s)
380 DISubrange::DISubrange(
LLVMContext &
C, StorageType Storage,
382 :
DINode(
C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops) {}
384 StorageType Storage,
bool ShouldCreate) {
394 int64_t Lo, StorageType Storage,
404 StorageType Storage,
bool ShouldCreate) {
415 assert((isa<ConstantAsMetadata>(CB) || isa<DIVariable>(CB) ||
416 isa<DIExpression>(CB)) &&
417 "Count must be signed constant or DIVariable or DIExpression");
419 if (
auto *MD = dyn_cast<ConstantAsMetadata>(CB))
420 return BoundType(cast<ConstantInt>(MD->getValue()));
422 if (
auto *MD = dyn_cast<DIVariable>(CB))
423 return BoundType(MD);
425 if (
auto *MD = dyn_cast<DIExpression>(CB))
426 return BoundType(MD);
436 assert((isa<ConstantAsMetadata>(LB) || isa<DIVariable>(LB) ||
437 isa<DIExpression>(LB)) &&
438 "LowerBound must be signed constant or DIVariable or DIExpression");
440 if (
auto *MD = dyn_cast<ConstantAsMetadata>(LB))
441 return BoundType(cast<ConstantInt>(MD->getValue()));
443 if (
auto *MD = dyn_cast<DIVariable>(LB))
444 return BoundType(MD);
446 if (
auto *MD = dyn_cast<DIExpression>(LB))
447 return BoundType(MD);
457 assert((isa<ConstantAsMetadata>(UB) || isa<DIVariable>(UB) ||
458 isa<DIExpression>(UB)) &&
459 "UpperBound must be signed constant or DIVariable or DIExpression");
461 if (
auto *MD = dyn_cast<ConstantAsMetadata>(UB))
462 return BoundType(cast<ConstantInt>(MD->getValue()));
464 if (
auto *MD = dyn_cast<DIVariable>(UB))
465 return BoundType(MD);
467 if (
auto *MD = dyn_cast<DIExpression>(UB))
468 return BoundType(MD);
478 assert((isa<ConstantAsMetadata>(
ST) || isa<DIVariable>(
ST) ||
479 isa<DIExpression>(
ST)) &&
480 "Stride must be signed constant or DIVariable or DIExpression");
482 if (
auto *MD = dyn_cast<ConstantAsMetadata>(
ST))
483 return BoundType(cast<ConstantInt>(MD->getValue()));
485 if (
auto *MD = dyn_cast<DIVariable>(
ST))
486 return BoundType(MD);
488 if (
auto *MD = dyn_cast<DIExpression>(
ST))
489 return BoundType(MD);
493 DIGenericSubrange::DIGenericSubrange(
LLVMContext &
C, StorageType Storage,
495 :
DINode(
C, DIGenericSubrangeKind, Storage, dwarf::DW_TAG_generic_subrange,
504 Metadata *Ops[] = {CountNode, LB, UB, Stride};
513 assert((isa<DIVariable>(CB) || isa<DIExpression>(CB)) &&
514 "Count must be signed constant or DIVariable or DIExpression");
516 if (
auto *MD = dyn_cast<DIVariable>(CB))
519 if (
auto *MD = dyn_cast<DIExpression>(CB))
530 assert((isa<DIVariable>(LB) || isa<DIExpression>(LB)) &&
531 "LowerBound must be signed constant or DIVariable or DIExpression");
533 if (
auto *MD = dyn_cast<DIVariable>(LB))
536 if (
auto *MD = dyn_cast<DIExpression>(LB))
547 assert((isa<DIVariable>(UB) || isa<DIExpression>(UB)) &&
548 "UpperBound must be signed constant or DIVariable or DIExpression");
550 if (
auto *MD = dyn_cast<DIVariable>(UB))
553 if (
auto *MD = dyn_cast<DIExpression>(UB))
564 assert((isa<DIVariable>(
ST) || isa<DIExpression>(
ST)) &&
565 "Stride must be signed constant or DIVariable or DIExpression");
567 if (
auto *MD = dyn_cast<DIVariable>(
ST))
570 if (
auto *MD = dyn_cast<DIExpression>(
ST))
576 DIEnumerator::DIEnumerator(
LLVMContext &
C, StorageType Storage,
579 :
DINode(
C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
585 StorageType Storage,
bool ShouldCreate) {
594 uint32_t AlignInBits,
unsigned Encoding,
595 DIFlags Flags, StorageType Storage,
607 case dwarf::DW_ATE_signed:
608 case dwarf::DW_ATE_signed_char:
610 case dwarf::DW_ATE_unsigned:
611 case dwarf::DW_ATE_unsigned_char:
623 unsigned Encoding, StorageType Storage,
634 DIType *DIDerivedType::getClassType()
const {
636 return cast_or_null<DIType>(getExtraData());
640 if (
auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
641 if (
auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
642 return static_cast<uint32_t>(CI->getZExtValue());
647 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
648 return C->getValue();
654 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
655 return C->getValue();
660 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
661 return C->getValue();
670 std::optional<unsigned> DWARFAddressSpace, DIFlags Flags,
672 StorageType Storage,
bool ShouldCreate) {
681 DWARFAddressSpace,
Flags),
732 if (CT->getTag() !=
Tag)
737 if (!CT->isForwardDecl() || (
Flags & DINode::FlagFwdDecl))
748 "Mismatched number of operands");
749 for (
unsigned I = 0,
E = CT->getNumOperands();
I !=
E; ++
I)
750 if (Ops[
I] != CT->getOperand(
I))
751 CT->setOperand(
I, Ops[
I]);
759 DIFlags Flags,
Metadata *Elements,
unsigned RuntimeLang,
774 if (CT->getTag() !=
Tag)
787 DISubroutineType::DISubroutineType(
LLVMContext &
C, StorageType Storage,
788 DIFlags Flags, uint8_t
CC,
790 :
DIType(
C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type, 0,
791 0, 0, 0, Flags, Ops),
804 std::optional<ChecksumInfo<MDString *>> CS,
MDString *Src,
806 :
DIScope(
C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
807 Checksum(CS),
Source(Src) {}
825 std::optional<DIFile::ChecksumKind>
848 DICompileUnit::DICompileUnit(
LLVMContext &
C, StorageType Storage,
851 uint64_t DWOId,
bool SplitDebugInlining,
854 :
DIScope(
C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
857 SplitDebugInlining(SplitDebugInlining),
858 DebugInfoForProfiling(DebugInfoForProfiling),
866 unsigned RuntimeVersion,
MDString *SplitDebugFilename,
869 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
871 MDString *SDK, StorageType Storage,
bool ShouldCreate) {
890 RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
891 DebugInfoForProfiling, NameTableKind, RangesBaseAddress,
896 std::optional<DICompileUnit::DebugEmissionKind>
906 std::optional<DICompileUnit::DebugNameTableKind>
922 return "LineTablesOnly";
924 return "DebugDirectivesOnly";
940 DISubprogram::DISubprogram(
LLVMContext &
C, StorageType Storage,
unsigned Line,
941 unsigned ScopeLine,
unsigned VirtualIndex,
942 int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags,
944 :
DILocalScope(
C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram, Ops),
945 Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
946 ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags) {
951 unsigned Virtuality,
bool IsMainSubprogram) {
953 static_assert(
int(SPFlagVirtual) ==
int(dwarf::DW_VIRTUALITY_virtual) &&
954 int(SPFlagPureVirtual) ==
955 int(dwarf::DW_VIRTUALITY_pure_virtual),
956 "Virtuality constant mismatch");
959 (IsLocalToUnit ? SPFlagLocalToUnit : SPFlagZero) |
960 (IsDefinition ? SPFlagDefinition : SPFlagZero) |
961 (IsOptimized ? SPFlagOptimized : SPFlagZero) |
962 (IsMainSubprogram ? SPFlagMainSubprogram : SPFlagZero));
966 if (
auto *Block = dyn_cast<DILexicalBlockBase>(
this))
967 return Block->getScope()->getSubprogram();
968 return const_cast<DISubprogram *
>(cast<DISubprogram>(
this));
972 if (
auto *File = dyn_cast<DILexicalBlockFile>(
this))
973 return File->getScope()->getNonLexicalBlockFileScope();
981 DIScope *CachedResult =
nullptr;
983 for (
DIScope *Scope = &RootScope; !isa<DISubprogram>(Scope);
984 Scope = Scope->getScope()) {
985 if (
auto It = Cache.
find(Scope); It != Cache.
end()) {
986 CachedResult = cast<DIScope>(It->second);
989 ScopeChain.push_back(Scope);
994 DIScope *UpdatedScope = CachedResult ? CachedResult : &NewSP;
996 TempMDNode ClonedScope = ScopeToUpdate->
clone();
997 cast<DILexicalBlockBase>(*ClonedScope).replaceScope(UpdatedScope);
1000 Cache[ScopeToUpdate] = UpdatedScope;
1003 return cast<DILocalScope>(UpdatedScope);
1008 #define HANDLE_DISP_FLAG(ID, NAME) .Case("DISPFlag" #NAME, SPFlag##NAME)
1009 #include "llvm/IR/DebugInfoFlags.def"
1018 #define HANDLE_DISP_FLAG(ID, NAME) \
1019 case SPFlag##NAME: \
1020 return "DISPFlag" #NAME;
1021 #include "llvm/IR/DebugInfoFlags.def"
1032 #define HANDLE_DISP_FLAG(ID, NAME) \
1033 if (DISPFlags Bit = Flags & SPFlag##NAME) { \
1034 SplitFlags.push_back(Bit); \
1037 #include "llvm/IR/DebugInfoFlags.def"
1044 unsigned ScopeLine,
Metadata *ContainingType,
unsigned VirtualIndex,
1045 int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags,
Metadata *Unit,
1048 StorageType Storage,
bool ShouldCreate) {
1079 (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, SPFlags), Ops,
1083 bool DISubprogram::describes(
const Function *
F)
const {
1084 assert(
F &&
"Invalid function");
1085 return F->getSubprogram() ==
this;
1094 unsigned Column, StorageType Storage,
1095 bool ShouldCreate) {
1107 unsigned Discriminator,
1108 StorageType Storage,
1109 bool ShouldCreate) {
1118 :
DIScope(
Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace, Ops),
1119 ExportSymbols(ExportSymbols) {}
1121 MDString *Name,
bool ExportSymbols,
1122 StorageType Storage,
bool ShouldCreate) {
1132 :
DIScope(
Context, DICommonBlockKind, Storage, dwarf::DW_TAG_common_block,
1138 StorageType Storage,
bool ShouldCreate) {
1148 :
DIScope(
Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops),
1149 LineNo(LineNo), IsDecl(IsDecl) {}
1154 unsigned LineNo,
bool IsDecl, StorageType Storage,
1155 bool ShouldCreate) {
1164 StorageType Storage,
1168 dwarf::DW_TAG_template_type_parameter, IsDefault,
1174 StorageType Storage,
bool ShouldCreate) {
1183 bool isDefault,
Metadata *
Value, StorageType Storage,
bool ShouldCreate) {
1195 Metadata *StaticDataMemberDeclaration,
1198 bool ShouldCreate) {
1221 unsigned Arg, DIFlags Flags,
uint32_t AlignInBits,
1223 bool ShouldCreate) {
1225 assert(Arg <= UINT16_MAX &&
"Expected argument number to fit in 16-bits");
1238 :
DINode(
C,
ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
1239 AlignInBits(AlignInBits) {}
1245 if (
auto *
T = dyn_cast<DIType>(RawType))
1249 if (
auto *DT = dyn_cast<DIDerivedType>(RawType)) {
1251 RawType = DT->getRawBaseType();
1260 return std::nullopt;
1263 DILabel::DILabel(
LLVMContext &
C, StorageType Storage,
unsigned Line,
1265 :
DINode(
C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
1267 Metadata *File,
unsigned Line, StorageType Storage,
1268 bool ShouldCreate) {
1278 StorageType Storage,
bool ShouldCreate) {
1290 bool ShouldCreate) {
1292 assert(
Storage != StorageType::Uniqued &&
"uniqued DIAssignID unsupported");
1299 if (Op >= dwarf::DW_OP_breg0 && Op <= dwarf::DW_OP_breg31)
1305 case dwarf::DW_OP_bregx:
1307 case dwarf::DW_OP_constu:
1308 case dwarf::DW_OP_consts:
1309 case dwarf::DW_OP_deref_size:
1310 case dwarf::DW_OP_plus_uconst:
1314 case dwarf::DW_OP_regx:
1324 if (
I->get() +
I->getSize() >
E->get())
1328 if ((
Op >= dwarf::DW_OP_reg0 &&
Op <= dwarf::DW_OP_reg31) ||
1329 (
Op >= dwarf::DW_OP_breg0 &&
Op <= dwarf::DW_OP_breg31))
1338 return I->get() +
I->getSize() ==
E->get();
1339 case dwarf::DW_OP_stack_value: {
1341 if (
I->get() +
I->getSize() ==
E->get())
1348 case dwarf::DW_OP_swap: {
1369 return I->get() == FirstOp->get() &&
I->getArg(0) == 1;
1375 case dwarf::DW_OP_constu:
1376 case dwarf::DW_OP_plus_uconst:
1377 case dwarf::DW_OP_plus:
1378 case dwarf::DW_OP_minus:
1379 case dwarf::DW_OP_mul:
1380 case dwarf::DW_OP_div:
1381 case dwarf::DW_OP_mod:
1382 case dwarf::DW_OP_or:
1383 case dwarf::DW_OP_and:
1384 case dwarf::DW_OP_xor:
1385 case dwarf::DW_OP_shl:
1386 case dwarf::DW_OP_shr:
1387 case dwarf::DW_OP_shra:
1388 case dwarf::DW_OP_deref:
1389 case dwarf::DW_OP_deref_size:
1390 case dwarf::DW_OP_xderef:
1391 case dwarf::DW_OP_lit0:
1392 case dwarf::DW_OP_not:
1393 case dwarf::DW_OP_dup:
1394 case dwarf::DW_OP_regx:
1395 case dwarf::DW_OP_bregx:
1396 case dwarf::DW_OP_push_object_address:
1397 case dwarf::DW_OP_over:
1398 case dwarf::DW_OP_consts:
1412 for (
const auto &It :
expr_ops()) {
1413 switch (It.getOp()) {
1416 case dwarf::DW_OP_stack_value:
1434 for (
const auto &It :
expr_ops()) {
1435 switch (It.getOp()) {
1455 auto ExprOpBegin =
expr_ops().begin();
1478 return ExprOp.getOp() == dwarf::DW_OP_LLVM_arg;
1488 std::optional<const DIExpression *>
1492 return std::nullopt;
1515 return ExprOp.getOp() == dwarf::DW_OP_LLVM_arg;
1528 if (
Op.getOp() == dwarf::DW_OP_stack_value ||
1530 Ops.push_back(dwarf::DW_OP_deref);
1533 Op.appendToVector(Ops);
1536 Ops.push_back(dwarf::DW_OP_deref);
1542 bool SecondIndirect) {
1548 return FirstOps == SecondOps;
1551 std::optional<DIExpression::FragmentInfo>
1553 for (
auto I = Start;
I != End; ++
I)
1558 return std::nullopt;
1564 Ops.push_back(dwarf::DW_OP_plus_uconst);
1567 Ops.push_back(dwarf::DW_OP_constu);
1571 Ops.push_back(AbsMinusOne + 1);
1572 Ops.push_back(dwarf::DW_OP_minus);
1582 if (
getNumElements() == 2 && Elements[0] == dwarf::DW_OP_plus_uconst) {
1587 if (
getNumElements() == 3 && Elements[0] == dwarf::DW_OP_constu) {
1588 if (Elements[2] == dwarf::DW_OP_plus) {
1592 if (Elements[2] == dwarf::DW_OP_minus) {
1605 SeenOps.
insert(ExprOp.getArg(0));
1613 unsigned &AddrClass) {
1616 const unsigned PatternSize = 4;
1617 if (Expr->Elements.size() >= PatternSize &&
1618 Expr->Elements[PatternSize - 4] == dwarf::DW_OP_constu &&
1619 Expr->Elements[PatternSize - 2] == dwarf::DW_OP_swap &&
1620 Expr->Elements[PatternSize - 1] == dwarf::DW_OP_xderef) {
1621 AddrClass = Expr->Elements[PatternSize - 3];
1623 if (Expr->Elements.size() == PatternSize)
1627 Expr->Elements.size() - PatternSize));
1636 Ops.push_back(dwarf::DW_OP_deref);
1640 Ops.push_back(dwarf::DW_OP_deref);
1651 assert(Expr &&
"Can't add ops to this expression");
1655 [](
auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
1657 "Location Index must be 0 for a non-variadic expression.");
1666 if (
Op.getOp() == dwarf::DW_OP_stack_value)
1669 NewOps.push_back(dwarf::DW_OP_stack_value);
1673 Op.appendToVector(NewOps);
1678 NewOps.push_back(dwarf::DW_OP_stack_value);
1685 assert(Expr &&
"Can't replace args in this expression");
1691 Op.appendToVector(NewOps);
1700 NewOps.push_back(
Arg);
1708 assert(Expr &&
"Can't prepend ops to this expression");
1724 if (
Op.getOp() == dwarf::DW_OP_stack_value)
1727 Ops.push_back(dwarf::DW_OP_stack_value);
1731 Op.appendToVector(Ops);
1734 Ops.push_back(dwarf::DW_OP_stack_value);
1740 assert(Expr && !Ops.
empty() &&
"Can't append ops to this expression");
1746 if (
Op.getOp() == dwarf::DW_OP_stack_value ||
1753 Op.appendToVector(NewOps);
1758 assert(
result->isValid() &&
"concatenated expression is not valid");
1764 assert(Expr && !Ops.
empty() &&
"Can't append ops to this expression");
1767 return Op == dwarf::DW_OP_stack_value ||
1770 "Can't append this op");
1777 unsigned DropUntilStackValue = FI ? 3 : 0;
1780 bool NeedsDeref = (Expr->
getNumElements() > DropUntilStackValue) &&
1781 (ExprOpsBeforeFragment.
back() != dwarf::DW_OP_stack_value);
1782 bool NeedsStackValue = NeedsDeref || ExprOpsBeforeFragment.
empty();
1788 NewOps.push_back(dwarf::DW_OP_deref);
1790 if (NeedsStackValue)
1791 NewOps.push_back(dwarf::DW_OP_stack_value);
1796 const DIExpression *Expr,
unsigned OffsetInBits,
unsigned SizeInBits) {
1800 bool CanSplitValue =
true;
1804 switch (
Op.getOp()) {
1807 case dwarf::DW_OP_shr:
1808 case dwarf::DW_OP_shra:
1809 case dwarf::DW_OP_shl:
1810 case dwarf::DW_OP_plus:
1811 case dwarf::DW_OP_plus_uconst:
1812 case dwarf::DW_OP_minus:
1818 CanSplitValue =
false;
1820 case dwarf::DW_OP_deref:
1821 case dwarf::DW_OP_deref_size:
1822 case dwarf::DW_OP_deref_type:
1823 case dwarf::DW_OP_xderef:
1824 case dwarf::DW_OP_xderef_size:
1825 case dwarf::DW_OP_xderef_type:
1828 CanSplitValue =
true;
1830 case dwarf::DW_OP_stack_value:
1833 return std::nullopt;
1837 uint64_t FragmentOffsetInBits =
Op.getArg(0);
1839 (void)FragmentSizeInBits;
1840 assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
1841 "new fragment outside of original fragment");
1842 OffsetInBits += FragmentOffsetInBits;
1846 Op.appendToVector(Ops);
1850 assert(Expr &&
"Unknown DIExpression");
1852 Ops.push_back(OffsetInBits);
1853 Ops.push_back(SizeInBits);
1857 std::pair<DIExpression *, const ConstantInt *>
1865 bool Changed =
false;
1867 switch (
Op.getOp()) {
1880 if (
Op.getArg(1) == dwarf::DW_ATE_signed)
1883 assert(
Op.getArg(1) == dwarf::DW_ATE_unsigned &&
"Unexpected operand");
1888 Op.appendToVector(Ops);
1900 Result =
std::max(Result, ExprOp.getArg(0) + 1);
1902 "Expression is missing one or more location operands.");
1906 std::optional<DIExpression::SignedOrUnsignedConstant>
1919 return std::nullopt;
1922 return SignedOrUnsignedConstant::SignedConstant;
1927 return std::nullopt;
1929 ? SignedOrUnsignedConstant::UnsignedConstant
1930 : SignedOrUnsignedConstant::SignedConstant;
1942 unsigned FromSize,
unsigned ToSize,
1950 bool ShouldCreate) {
1958 :
DINode(
C, DIObjCPropertyKind,
Storage, dwarf::DW_TAG_APPLE_property, Ops),
1964 Metadata *
Type, StorageType Storage,
bool ShouldCreate) {
1978 StorageType Storage,
1979 bool ShouldCreate) {
1989 bool ShouldCreate) {
1998 Metadata *Elements, StorageType Storage,
1999 bool ShouldCreate) {
2007 StorageType Storage,
bool ShouldCreate) {
2014 assert((!New || isa<ValueAsMetadata>(New)) &&
2015 "DIArgList must be passed a ValueAsMetadata");
2025 if (&VM == OldVMPtr) {
2033 if (uniquify() !=
this)
2038 void DIArgList::track() {
2043 void DIArgList::untrack() {
2048 void DIArgList::dropAllReferences() {
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 ...
StringSwitch & Case(StringLiteral S, T Value)
static unsigned getNextComponentInDiscriminator(unsigned D)
Returns the next component stored in discriminator.
DebugVariable(const DbgVariableIntrinsic *DII)
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata * Macros
LLVMContextImpl *const pImpl
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...
Metadata * getRawLowerBound() const
List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.
ArrayRef< T > drop_back(size_t N=1) const
Drop the last N elements of the array.
static const char * nameTableKindString(DebugNameTableKind PK)
std::optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
This is an optimization pass for GlobalISel generic memory operations.
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
uint64_t getNumLocationOperands() const
Return the number of unique location operands referred to (via DW_OP_LLVM_arg) in this expression; th...
static unsigned getUnsignedFromPrefixEncoding(unsigned U)
Reverse transformation as getPrefixEncodingFromUnsigned.
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...
int64_t bool MDString * Name
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
static const DIExpression * convertToVariadicExpression(const DIExpression *Expr)
If Expr is a non-variadic expression (i.e.
Metadata MDString Metadata * File
Metadata * getRawCountNode() const
static const DILocation * getMergedLocation(const DILocation *LocA, const DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
unsigned StringRef DIFile * File
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString * Identifier
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata * ImportedEntities
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString MDString * SDK
Metadata Metadata MDString Metadata * File
const APInt & getValue() const
Return the constant as an APInt value reference.
std::optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const Module *M)
This lazily constructs the LazyValueInfoImpl.
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
String type, Fortran CHARACTER(n)
A single checksum, represented by a Kind and a Value (a string).
MDString MDString * Directory
Implements a dense probed hash-table based set with some number of buckets stored inline.
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
DIFlags uint8_t Metadata * TypeArray
unsigned MDString Metadata unsigned Metadata * Scope
static std::optional< const DIExpression * > convertToNonVariadicExpression(const DIExpression *Expr)
If Expr is a valid single-location expression, i.e.
static unsigned encodingBits(unsigned C)
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata * TemplateParams
StringRef getName() const
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata * GlobalVariables
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata * TemplateParams
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
cl::opt< bool > EnableFSDiscriminator
bool isStaticMember() const
BoundType getUpperBound() const
Metadata Metadata MDString MDString * ConfigurationMacros
The instances of the Type class are immutable: once they are created, they are never changed.
Metadata MDString MDString Metadata * File
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
bool extractIfOffset(int64_t &Offset) const
If this is a constant offset, extract it.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata * Associated
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata * EnumTypes
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t AlignInBits
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
static DISPFlags splitFlags(DISPFlags Flags, SmallVectorImpl< DISPFlags > &SplitFlags)
Split up a flags bitfield for easier printing.
unsigned getSize() const
Return the size of the operand.
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata * RetainedTypes
unsigned MDString ArrayRef< Metadata * > DwarfOps
unsigned Metadata MDString * Producer
std::pair< iterator, bool > insert(const ValueT &V)
unsigned MDString Metadata unsigned Line
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata * Discriminator
unsigned Metadata * Scope
Metadata Metadata MDString MDString MDString * IncludePath
static const char * emissionKindString(DebugEmissionKind EK)
Metadata MDString Metadata unsigned Line
bool empty() const
empty - Check if the array is empty.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Metadata Metadata * Scope
dwarf::Tag getTag() const
unsigned unsigned DILocalScope DILocation * InlinedAt
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata Metadata uint64_t bool bool unsigned bool MDString * SysRoot
Metadata MDString Metadata * File
Annotations lets you mark points and ranges inside source code, for tests:
void storeDistinctInContext()
It looks like we only need to define PPCfmarto for these because according to these instructions perform RTO on fma s result
static DICompositeType * getODRTypeIfExists(LLVMContext &Context, MDString &Identifier)
uint64_t getElement(unsigned I) const
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
This is the shared class of boolean and integer constants.
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...
Metadata Metadata MDString * Name
const T & back() const
back - Get the last element.
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata * Unit
unsigned MDString Metadata Metadata Metadata uint64_t SizeInBits
@ Ref
The access may reference the value stored in memory.
BoundType getCount() const
DILocalScope * getNonLexicalBlockFileScope() const
Get the first non DILexicalBlockFile scope of this scope.
element_iterator elements_begin() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::optional< Signedness > getSignedness() const
Return the signedness of this type, or std::nullopt if this type is neither signed nor unsigned.
(vector float) vec_cmpeq(*A, *B) C
Metadata MDString Metadata unsigned Metadata * Type
Metadata MDString MDString Metadata unsigned Metadata * Type
unsigned MDString * Header
unsigned Metadata Metadata * Entity
DISPFlags
Debug info subprogram flags.
Constant * getConstant() const
dwarf::Tag getTag() const
Metadata MDString Metadata unsigned Metadata unsigned DIFlags uint32_t AlignInBits
uint32_t getVBPtrOffset() const
bool isODRUniquingDebugTypes() const
Whether there is a string map for uniquing debug info identifiers across the context.
unsigned unsigned Metadata * File
unsigned unsigned DILocalScope * Scope
into llvm powi allowing the code generator to produce balanced multiplication trees First
unsigned StringRef DIFile unsigned DIScope DIType uint64_t SizeInBits
unsigned getEncoding() const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata * DataLocation
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata MDString * TargetFuncName
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF, unsigned &CI)
Raw decoder for values in an encoded discriminator D.
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.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata * Allocated
Analysis containing CSE Info
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops)
Metadata * getRawUpperBound() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata * Declaration
static DIFlags splitFlags(DIFlags Flags, SmallVectorImpl< DIFlags > &SplitFlags)
Split up a flags bitfield.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t AlignInBits
void handleChangedOperand(void *Ref, Metadata *New)
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.
static DIExpression * append(const DIExpression *Expr, ArrayRef< uint64_t > Ops)
Append the opcodes Ops to DIExpr.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata * Elements
constexpr bool empty() const
empty - Check if the string is empty.
std::array< uint64_t, 6 > ExtOps
bool isImplicit() const
Return whether this is an implicit location description.
Metadata MDString MDString Metadata unsigned Line
This is the common base class for debug info intrinsics for variables.
Metadata MDString MDString * LinkageName
static unsigned encodeComponent(unsigned C)
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
This is an important base class in LLVM.
unsigned MDString Metadata unsigned Metadata Metadata uint64_t SizeInBits
Metadata MDString MDString * LinkageName
Constant * getStorageOffsetInBits() const
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_...
Metadata * getRawType() const
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 std::optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Metadata Metadata MDString * Name
Metadata MDString MDString Metadata unsigned Metadata * Type
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
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.
This is an important class for using LLVM in a threaded context.
static std::optional< unsigned > encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI)
Raw encoding of the discriminator.
An imported module (C++ using directive or similar).
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Metadata Metadata MDString MDString MDString MDString * APINotesFile
iterator find(const_arg_type_t< KeyT > Val)
unsigned unsigned Metadata Metadata * Elements
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t std::optional< unsigned > DIFlags Metadata * ExtraData
static StringRef getFlagString(DISPFlags Flag)
unsigned StringRef uint64_t SizeInBits
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t std::optional< unsigned > DIFlags Flags
static DIFlags getFlag(StringRef Flag)
BoundType getCount() 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,...
Basic type, like 'int' or 'float'.
Class for arbitrary precision integers.
BoundType getStride() const
Type array for a subprogram.
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.
Class representing an expression and its matching format.
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
DIScope * getScope() const
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t uint64_t OffsetInBits
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t OffsetInBits
unsigned StringRef DIFile unsigned Line
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Base class for template parameters.
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
StringRef - Represent a constant reference to a string, i.e.
unsigned MDString Metadata Metadata Metadata uint64_t uint32_t AlignInBits
BoundType getStride() const
Tagged DWARF-like metadata node.
unsigned MDString Metadata * File
DebugEmissionKind getEmissionKind() const
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata * VTableHolder
MDString Metadata unsigned MDString MDString * SetterName
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...
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
uint64_t getOp() const
Get the operand code.
Generic tagged DWARF-like metadata node.
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 "...
MDString MDString std::optional< ChecksumInfo< MDString * > > CS
unsigned Metadata Metadata Metadata * File
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
unsigned StringRef uint64_t FlagZero unsigned StringRef uint64_t uint32_t unsigned DIFlags Flags
An iterator for expression operands.
unsigned unsigned MDString * Name
LLVMContext & getContext() const
unsigned MDString Metadata Metadata Metadata * StringLocationExp
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata * StaticDataMemberDeclaration
unsigned Metadata Metadata Metadata unsigned MDString * Name
unsigned Metadata MDString bool MDString unsigned MDString * SplitDebugFilename
BoundType getLowerBound() const
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Flags
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata * RetainedNodes
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
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.
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....
PointerUnion< DIVariable *, DIExpression * > BoundType
static IntegerType * getInt64Ty(LLVMContext &C)
static DIExpression * appendExt(const DIExpression *Expr, unsigned FromSize, unsigned ToSize, bool Signed)
Append a zero- or sign-extension to Expr.
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
Base class for scope-like contexts.
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata * ThrownTypes
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
std::optional< SignedOrUnsignedConstant > isConstant() const
Determine whether this represents a constant value, if so.
bool isComplex() const
Return whether the location is computed on the expression stack, meaning it cannot be a simple regist...
unsigned Metadata MDString bool MDString * Flags
unsigned unsigned DILocalScope DILocation bool ImplicitCode
std::pair< DIExpression *, const ConstantInt * > constantFold(const ConstantInt *CI)
Try to shorten an expression with an initial constant operand.
static std::optional< ChecksumKind > getChecksumKind(StringRef CSKindStr)
ArrayRef< uint64_t > getElements() const
static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed)
Returns the ops for a zero- or sign-extension in a DIExpression.
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata uint32_t AlignInBits
A pair of DIGlobalVariable and DIExpression.
Holds the characteristics of one fragment of a larger variable.
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata unsigned int DIFlags DISPFlags Metadata Metadata Metadata Metadata Metadata Metadata * Annotations
bool isSingleLocationExpression() const
Return whether the evaluated expression makes use of a single location at the start of the expression...
std::optional< uint64_t > getSizeInBits() const
Determines the size of the variable's type.
static StringRef getFlagString(DIFlags Flag)
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint32_t uint64_t DIFlags Metadata unsigned Metadata Metadata MDString Metadata Metadata Metadata Metadata Metadata * Rank
unsigned MDString Metadata * Type
Metadata MDString MDString Metadata unsigned Metadata unsigned Metadata * ContainingType
MDString Metadata unsigned MDString * GetterName
BoundType getLowerBound() const
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line, ArrayRef< Metadata * > Ops, uint32_t AlignInBits=0)
bool hasAllLocationOps(unsigned N) const
Returns true iff this DIExpression contains at least one instance of DW_OP_LLVM_arg,...
static const DILocation * getMergedLocations(ArrayRef< const DILocation * > Locs)
Try to combine the vector of locations passed as input in a single one.
unsigned MDString Metadata * StringLength
Metadata MDString MDString Metadata * File
size_t size() const
size - Get the array size.
unsigned MDString Metadata Metadata * StringLengthExp
unsigned MDString Metadata unsigned Metadata Metadata * BaseType
unsigned getNumElements() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
auto reverse(ContainerTy &&C)
expr_op_iterator expr_op_end() const
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
A switch()-like statement whose cases are string literals.
TempMDNode clone() const
Create a (temporary) clone of this.
unsigned StringRef DIFile unsigned DIScope DIType * BaseType
unsigned StringRef DIFile unsigned DIScope DIType uint64_t uint32_t AlignInBits
DebugNameTableKind getNameTableKind() const
Metadata * getRawStride() const
unsigned StringRef DIFile unsigned DIScope * Scope
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
StringRef getString() const
Constant * getDiscriminantValue() const
element_iterator elements_end() const
void reserve(size_type N)
LLVM Value Representation.
static DISPFlags getFlag(StringRef Flag)
BoundType getUpperBound() const
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata Metadata * TemplateParams
iterator_range< expr_op_iterator > expr_ops() const
iterator insert(iterator I, T &&Elt)
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.