14 #ifndef LLVM_IR_DEBUGINFOMETADATA_H 15 #define LLVM_IR_DEBUGINFOMETADATA_H 35 #include <type_traits> 39 #define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__ 40 #define DEFINE_MDNODE_GET_UNPACK(ARGS) DEFINE_MDNODE_GET_UNPACK_IMPL ARGS 41 #define DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) \ 42 static CLASS *getDistinct(LLVMContext &Context, \ 43 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 44 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Distinct); \ 46 static Temp##CLASS getTemporary(LLVMContext &Context, \ 47 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 49 getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Temporary)); \ 51 #define DEFINE_MDNODE_GET(CLASS, FORMAL, ARGS) \ 52 static CLASS *get(LLVMContext &Context, DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 53 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued); \ 55 static CLASS *getIfExists(LLVMContext &Context, \ 56 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 57 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued, \ 60 DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) 80 assert((!MD || isa<T>(MD)) &&
"Expected valid type ref");
86 typename std::enable_if<std::is_convertible<U *, T *>::value>::
type * =
92 T *
resolve()
const {
return const_cast<T *
>(cast_or_null<T>(MD)); }
109 explicit operator bool()
const {
return get(); }
110 explicit operator MDTuple *()
const {
return get(); }
120 class iterator : std::iterator<std::input_iterator_tag, DITypeRef,
121 std::ptrdiff_t, void, DITypeRef> {
162 :
MDNode(C, ID, Storage, Ops1, Ops2) {
164 SubclassData16 =
Tag;
169 return cast_or_null<Ty>(getOperand(I));
173 if (
auto *S = getOperandAs<MDString>(I))
174 return S->getString();
188 unsigned getTag()
const {
return SubclassData16; }
195 #define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID, 196 #define DI_FLAG_LARGEST_NEEDED 197 #include "llvm/IR/DebugInfoFlags.def" 198 FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
199 FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
200 FlagVirtualInheritance,
218 case GenericDINodeKind:
220 case DIEnumeratorKind:
221 case DIBasicTypeKind:
222 case DIDerivedTypeKind:
223 case DICompositeTypeKind:
224 case DISubroutineTypeKind:
226 case DICompileUnitKind:
227 case DISubprogramKind:
228 case DILexicalBlockKind:
229 case DILexicalBlockFileKind:
230 case DINamespaceKind:
231 case DITemplateTypeParameterKind:
232 case DITemplateValueParameterKind:
233 case DIGlobalVariableKind:
234 case DILocalVariableKind:
236 case DIObjCPropertyKind:
237 case DIImportedEntityKind:
269 :
DINode(C, GenericDINodeKind, Storage, Tag, Ops1, Ops2) {
274 void setHash(
unsigned Hash) { SubclassData32 = Hash; }
275 void recalculateHash();
280 return getImpl(Context, Tag, getCanonicalMDString(Context, Header),
281 DwarfOps, Storage, ShouldCreate);
288 TempGenericDINode cloneImpl()
const {
290 getContext(),
getTag(), getHeader(),
295 unsigned getHash()
const {
return SubclassData32; }
299 (Tag, Header, DwarfOps))
302 (Tag, Header, DwarfOps))
305 TempGenericDINode clone()
const {
return cloneImpl(); }
307 unsigned getTag()
const {
return SubclassData16; }
314 return op_range(dwarf_op_begin(), dwarf_op_end());
319 return getOperand(I + 1);
322 replaceOperandWith(I + 1, New);
342 :
DINode(C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops),
343 LowerBound(LowerBound) {}
349 bool ShouldCreate =
true);
353 bool ShouldCreate =
true);
355 TempDISubrange cloneImpl()
const {
356 return getTemporary(getContext(), getRawCountNode(), getLowerBound());
364 (CountNode, LowerBound))
366 TempDISubrange clone()
const {
return cloneImpl(); }
368 int64_t getLowerBound()
const {
return LowerBound; }
371 return getOperand(0).get();
377 if (
auto *MD = dyn_cast<ConstantAsMetadata>(getRawCountNode()))
378 return CountType(cast<ConstantInt>(MD->getValue()));
380 if (
auto *DV = dyn_cast<DIVariable>(getRawCountNode()))
381 return CountType(DV);
402 :
DINode(C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
404 SubclassData32 = IsUnsigned;
411 return getImpl(Context, Value, IsUnsigned,
412 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
418 TempDIEnumerator cloneImpl()
const {
419 return getTemporary(getContext(), getValue(), isUnsigned(),
getName());
424 (Value, IsUnsigned, Name))
426 (Value, IsUnsigned, Name))
428 TempDIEnumerator clone()
const {
return cloneImpl(); }
451 :
DINode(C, ID, Storage, Tag, Ops) {}
471 return isa<DIFile>(
this) ? const_cast<DIScope *>(
this)
472 :
static_cast<Metadata *
>(getOperand(0));
479 case DIBasicTypeKind:
480 case DIDerivedTypeKind:
481 case DICompositeTypeKind:
482 case DISubroutineTypeKind:
484 case DICompileUnitKind:
485 case DISubprogramKind:
486 case DILexicalBlockKind:
487 case DILexicalBlockFileKind:
488 case DINamespaceKind:
519 template <
typename T>
529 return Kind == X.
Kind && Value == X.
Value;
542 :
DIScope(C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
543 Checksum(CS),
Source(Src) {}
553 MDChecksum.
emplace(CS->Kind, getCanonicalMDString(Context, CS->Value));
554 return getImpl(Context, getCanonicalMDString(Context, Filename),
555 getCanonicalMDString(Context, Directory), MDChecksum,
557 Storage, ShouldCreate);
563 bool ShouldCreate =
true);
565 TempDIFile cloneImpl()
const {
566 return getTemporary(getContext(), getFilename(), getDirectory(),
567 getChecksum(), getSource());
574 (Filename, Directory, CS, Source))
578 (Filename, Directory, CS, Source))
580 TempDIFile clone()
const {
return cloneImpl(); }
582 StringRef getFilename()
const {
return getStringOperand(0); }
583 StringRef getDirectory()
const {
return getStringOperand(1); }
587 StringRefChecksum.
emplace(Checksum->Kind, Checksum->Value->getString());
588 return StringRefChecksum;
594 MDString *getRawFilename()
const {
return getOperandAs<MDString>(0); }
595 MDString *getRawDirectory()
const {
return getOperandAs<MDString>(1); }
608 if (
auto *
F = getFile())
609 return F->getFilename();
614 if (
auto *
F = getFile())
615 return F->getDirectory();
620 if (
auto *
F = getFile())
621 return F->getSource();
634 uint64_t OffsetInBits;
639 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
641 :
DIScope(C, ID, Storage, Tag, Ops) {
642 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
647 uint64_t OffsetInBits,
DIFlags Flags) {
650 this->SizeInBits = SizeInBits;
651 this->AlignInBits = AlignInBits;
652 this->OffsetInBits = OffsetInBits;
656 void mutate(
unsigned Tag,
unsigned Line, uint64_t SizeInBits,
658 assert(isDistinct() &&
"Only distinct nodes can mutate");
660 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
684 auto NewTy = clone();
685 NewTy->Flags = NewFlags;
690 return (getFlags() & FlagAccessibility) == FlagPrivate;
693 return (getFlags() & FlagAccessibility) == FlagProtected;
696 return (getFlags() & FlagAccessibility) == FlagPublic;
701 bool isVirtual()
const {
return getFlags() & FlagVirtual; }
705 return getFlags() & FlagObjcClassComplete;
707 bool isVector()
const {
return getFlags() & FlagVector; }
708 bool isBitField()
const {
return getFlags() & FlagBitField; }
714 return getFlags() & FlagTypePassByReference;
721 case DIBasicTypeKind:
722 case DIDerivedTypeKind:
723 case DICompositeTypeKind:
724 case DISubroutineTypeKind:
741 uint64_t SizeInBits,
uint32_t AlignInBits,
unsigned Encoding,
743 :
DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
745 Encoding(Encoding) {}
750 uint32_t AlignInBits,
unsigned Encoding,
752 return getImpl(Context, Tag, getCanonicalMDString(Context, Name),
753 SizeInBits, AlignInBits, Encoding, Storage, ShouldCreate);
756 MDString *Name, uint64_t SizeInBits,
757 uint32_t AlignInBits,
unsigned Encoding,
760 TempDIBasicType cloneImpl()
const {
762 getAlignInBits(), getEncoding());
767 (Tag, Name, 0, 0, 0))
770 uint32_t AlignInBits,
unsigned Encoding),
771 (Tag, Name, SizeInBits, AlignInBits, Encoding))
773 (
unsigned Tag,
MDString *Name, uint64_t SizeInBits,
774 uint32_t AlignInBits,
unsigned Encoding),
775 (Tag, Name, SizeInBits, AlignInBits, Encoding))
777 TempDIBasicType clone()
const {
return cloneImpl(); }
807 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
810 :
DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
811 AlignInBits, OffsetInBits, Flags, Ops),
812 DWARFAddressSpace(DWARFAddressSpace) {}
818 uint64_t SizeInBits,
uint32_t AlignInBits,
819 uint64_t OffsetInBits,
823 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
824 Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits,
825 DWARFAddressSpace, Flags, ExtraData, Storage, ShouldCreate);
830 uint64_t SizeInBits,
uint32_t AlignInBits,
831 uint64_t OffsetInBits,
836 TempDIDerivedType cloneImpl()
const {
837 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
839 getAlignInBits(), getOffsetInBits(),
840 getDWARFAddressSpace(), getFlags(), getExtraData());
847 uint64_t SizeInBits,
uint32_t AlignInBits,
848 uint64_t OffsetInBits,
851 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
852 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
857 uint32_t AlignInBits, uint64_t OffsetInBits,
860 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
861 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
864 TempDIDerivedType clone()
const {
return cloneImpl(); }
868 Metadata *getRawBaseType()
const {
return getOperand(3); }
882 Metadata *getExtraData()
const {
return getRawExtraData(); }
883 Metadata *getRawExtraData()
const {
return getOperand(4); }
893 return dyn_cast_or_null<DIObjCProperty>(getExtraData());
898 if (
auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
899 if (
auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
900 return static_cast<uint32_t>(CI->getZExtValue());
904 Constant *getStorageOffsetInBits()
const {
905 assert(
getTag() == dwarf::DW_TAG_member && isBitField());
906 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
907 return C->getValue();
912 assert(
getTag() == dwarf::DW_TAG_member && isStaticMember());
913 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
914 return C->getValue();
917 Constant *getDiscriminantValue()
const {
918 assert(
getTag() == dwarf::DW_TAG_member && !isStaticMember());
919 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
920 return C->getValue();
925 static bool classof(
const Metadata *MD) {
938 unsigned RuntimeLang;
941 unsigned Line,
unsigned RuntimeLang, uint64_t SizeInBits,
944 :
DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
945 AlignInBits, OffsetInBits, Flags, Ops),
946 RuntimeLang(RuntimeLang) {}
950 void mutate(
unsigned Tag,
unsigned Line,
unsigned RuntimeLang,
951 uint64_t SizeInBits,
uint32_t AlignInBits,
952 uint64_t OffsetInBits,
DIFlags Flags) {
953 assert(isDistinct() &&
"Only distinct nodes can mutate");
954 assert(getRawIdentifier() &&
"Only ODR-uniqued nodes should mutate");
955 this->RuntimeLang = RuntimeLang;
956 DIType::mutate(Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
962 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
963 DIFlags Flags, DINodeArray Elements,
unsigned RuntimeLang,
964 DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
968 Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope,
969 BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements.get(),
970 RuntimeLang, VTableHolder, TemplateParams.get(),
971 getCanonicalMDString(Context, Identifier), Discriminator, Storage, ShouldCreate);
976 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
982 TempDICompositeType cloneImpl()
const {
983 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
985 getAlignInBits(), getOffsetInBits(), getFlags(),
986 getElements(), getRuntimeLang(), getVTableHolder(),
987 getTemplateParams(), getIdentifier(), getDiscriminator());
994 uint32_t AlignInBits, uint64_t OffsetInBits,
995 DIFlags Flags, DINodeArray Elements,
unsigned RuntimeLang,
997 DITemplateParameterArray TemplateParams =
nullptr,
999 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
1000 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
1001 VTableHolder, TemplateParams, Identifier, Discriminator))
1005 uint64_t SizeInBits,
uint32_t AlignInBits,
1007 unsigned RuntimeLang,
Metadata *VTableHolder,
1011 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
1012 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
1013 VTableHolder, TemplateParams, Identifier, Discriminator))
1015 TempDICompositeType clone()
const {
return cloneImpl(); }
1029 unsigned RuntimeLang,
Metadata *VTableHolder,
1048 unsigned RuntimeLang,
Metadata *VTableHolder,
1053 return cast_or_null<MDTuple>(getRawElements());
1057 return cast_or_null<MDTuple>(getRawTemplateParams());
1080 "Lost a member during member list replacement");
1082 replaceOperandWith(4, Elements.get());
1086 replaceOperandWith(5, VTableHolder);
1090 replaceOperandWith(6, TemplateParams.get());
1112 :
DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
1113 0, 0, 0, 0, Flags, Ops),
1120 bool ShouldCreate =
true) {
1121 return getImpl(Context, Flags, CC, TypeArray.
get(), Storage, ShouldCreate);
1126 bool ShouldCreate =
true);
1128 TempDISubroutineType cloneImpl()
const {
1129 return getTemporary(getContext(), getFlags(), getCC(), getTypeArray());
1135 (Flags, CC, TypeArray))
1138 (Flags, CC, TypeArray))
1140 TempDISubroutineType clone()
const {
return cloneImpl(); }
1145 return cast_or_null<MDTuple>(getRawTypeArray());
1165 LastEmissionKind = LineTablesOnly
1174 unsigned RuntimeVersion;
1177 bool SplitDebugInlining;
1178 bool DebugInfoForProfiling;
1182 bool IsOptimized,
unsigned RuntimeVersion,
1183 unsigned EmissionKind, uint64_t DWOId,
bool SplitDebugInlining,
1185 :
DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
1186 SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
1187 RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind),
1188 DWOId(DWOId), SplitDebugInlining(SplitDebugInlining),
1189 DebugInfoForProfiling(DebugInfoForProfiling), GnuPubnames(GnuPubnames) {
1190 assert(Storage != Uniqued);
1197 unsigned RuntimeVersion,
StringRef SplitDebugFilename,
1198 unsigned EmissionKind, DICompositeTypeArray EnumTypes,
1199 DIScopeArray RetainedTypes,
1200 DIGlobalVariableExpressionArray GlobalVariables,
1201 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1202 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1203 bool GnuPubnames,
StorageType Storage,
bool ShouldCreate =
true) {
1205 Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
1206 IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion,
1207 getCanonicalMDString(Context, SplitDebugFilename), EmissionKind,
1208 EnumTypes.get(), RetainedTypes.get(), GlobalVariables.get(),
1209 ImportedEntities.get(), Macros.get(), DWOId, SplitDebugInlining,
1210 DebugInfoForProfiling, GnuPubnames, Storage, ShouldCreate);
1215 unsigned RuntimeVersion,
MDString *SplitDebugFilename,
1218 Metadata *Macros, uint64_t DWOId,
bool SplitDebugInlining,
1219 bool DebugInfoForProfiling,
bool GnuPubnames,
StorageType Storage,
1220 bool ShouldCreate =
true);
1222 TempDICompileUnit cloneImpl()
const {
1223 return getTemporary(getContext(), getSourceLanguage(), getFile(),
1224 getProducer(), isOptimized(), getFlags(),
1225 getRuntimeVersion(), getSplitDebugFilename(),
1226 getEmissionKind(), getEnumTypes(), getRetainedTypes(),
1227 getGlobalVariables(), getImportedEntities(),
1228 getMacros(), DWOId, getSplitDebugInlining(),
1229 getDebugInfoForProfiling(), getGnuPubnames());
1233 static void get() =
delete;
1234 static void getIfExists() =
delete;
1239 bool IsOptimized,
StringRef Flags,
unsigned RuntimeVersion,
1241 DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
1242 DIGlobalVariableExpressionArray GlobalVariables,
1243 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1244 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1246 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1247 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1248 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1249 DebugInfoForProfiling, GnuPubnames))
1253 bool IsOptimized,
MDString *Flags,
unsigned RuntimeVersion,
1257 bool SplitDebugInlining,
bool DebugInfoForProfiling,
bool GnuPubnames),
1258 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1259 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1260 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1261 DebugInfoForProfiling, GnuPubnames))
1263 TempDICompileUnit clone()
const {
return cloneImpl(); }
1277 return cast_or_null<MDTuple>(getRawEnumTypes());
1280 return cast_or_null<MDTuple>(getRawRetainedTypes());
1283 return cast_or_null<MDTuple>(getRawGlobalVariables());
1286 return cast_or_null<MDTuple>(getRawImportedEntities());
1289 return cast_or_null<MDTuple>(getRawMacros());
1295 this->SplitDebugInlining = SplitDebugInlining;
1301 return getOperandAs<MDString>(3);
1316 replaceOperandWith(4, N.get());
1319 replaceOperandWith(5, N.get());
1322 replaceOperandWith(6, N.get());
1325 replaceOperandWith(7, N.get());
1344 :
DIScope(C, ID, Storage, Tag, Ops) {}
1381 bool ShouldCreate =
true);
1385 bool ShouldCreate =
true) {
1386 return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope),
1387 static_cast<Metadata *>(InlinedAt), Storage, ShouldCreate);
1394 static unsigned getPrefixEncodingFromUnsigned(
unsigned U) {
1396 return U > 0x1f ? (((U & 0xfe0) << 1) | (U & 0x1f) | 0x20) : U;
1400 static unsigned getUnsignedFromPrefixEncoding(
unsigned U) {
1401 return (U & 0x20) ? (((U >> 1) & 0xfe0) | (U & 0x1f)) : (U & 0x1f);
1405 static unsigned getNextComponentInDiscriminator(
unsigned D) {
1407 return D >> ((D & 0x40) ? 14 : 7);
1412 TempDILocation cloneImpl()
const {
1415 return getTemporary(getContext(), getLine(), getColumn(), getRawScope(),
1421 void replaceOperandWith(
unsigned I,
Metadata *New) =
delete;
1424 (
unsigned Line,
unsigned Column,
Metadata *Scope,
1426 (Line, Column, Scope, InlinedAt))
1430 (Line, Column, Scope, InlinedAt))
1433 TempDILocation clone()
const {
return cloneImpl(); }
1435 unsigned getLine()
const {
return SubclassData32; }
1436 unsigned getColumn()
const {
return SubclassData16; }
1437 DILocalScope *getScope()
const {
return cast<DILocalScope>(getRawScope()); }
1440 return cast_or_null<DILocation>(getRawInlinedAt());
1444 StringRef getFilename()
const {
return getScope()->getFilename(); }
1445 StringRef getDirectory()
const {
return getScope()->getDirectory(); }
1453 if (
auto *IA = getInlinedAt())
1454 return IA->getInlinedAtScope();
1463 bool canDiscriminate(
const DILocation &RHS)
const {
1464 return getLine() != RHS.getLine() ||
1465 getColumn() != RHS.getColumn() ||
1466 getDiscriminator() != RHS.getDiscriminator() ||
1467 getFilename() != RHS.getFilename() ||
1468 getDirectory() != RHS.getDirectory();
1497 inline unsigned getDiscriminator()
const;
1500 inline const DILocation *cloneWithDiscriminator(
unsigned Discriminator)
const;
1503 inline const DILocation *setBaseDiscriminator(
unsigned BD)
const;
1506 inline unsigned getDuplicationFactor()
const;
1509 inline unsigned getCopyIdentifier()
const;
1512 inline unsigned getBaseDiscriminator()
const;
1516 inline const DILocation *cloneWithDuplicationFactor(
unsigned DF)
const;
1518 enum { NoGeneratedLocation =
false, WithGeneratedLocation =
true };
1536 bool GenerateLocation = NoGeneratedLocation);
1541 return getUnsignedFromPrefixEncoding(D >> 1);
1548 D = getNextComponentInDiscriminator(D);
1549 if (D == 0 || (D & 1))
1552 return getUnsignedFromPrefixEncoding(D >> 1);
1557 return getUnsignedFromPrefixEncoding(getNextComponentInDiscriminator(
1558 getNextComponentInDiscriminator(D)));
1564 if (getNumOperands() == 2)
1565 return getOperand(1);
1584 unsigned VirtualIndex;
1593 unsigned Virtuality : 2;
1599 unsigned IsLocalToUnit : 1;
1600 unsigned IsDefinition : 1;
1601 unsigned IsOptimized : 1;
1603 unsigned Padding : 3;
1608 unsigned ScopeLine,
unsigned Virtuality,
unsigned VirtualIndex,
1609 int ThisAdjustment, DIFlags Flags,
bool IsLocalToUnit,
1611 :
DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
1613 Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
1614 ThisAdjustment(ThisAdjustment), Virtuality(Virtuality),
1615 IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition),
1616 IsOptimized(IsOptimized), Flags(Flags) {
1618 assert(Virtuality < 4 &&
"Virtuality out of range");
1626 unsigned ScopeLine,
DITypeRef ContainingType,
unsigned Virtuality,
1627 unsigned VirtualIndex,
int ThisAdjustment, DIFlags Flags,
1629 DITemplateParameterArray TemplateParams,
DISubprogram *Declaration,
1630 DINodeArray RetainedNodes, DITypeArray ThrownTypes,
1632 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
1633 getCanonicalMDString(Context, LinkageName), File, Line, Type,
1634 IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
1635 Virtuality, VirtualIndex, ThisAdjustment, Flags, IsOptimized,
1636 Unit, TemplateParams.
get(), Declaration, RetainedNodes.
get(),
1637 ThrownTypes.
get(), Storage, ShouldCreate);
1642 bool IsLocalToUnit,
bool IsDefinition,
unsigned ScopeLine,
1643 Metadata *ContainingType,
unsigned Virtuality,
unsigned VirtualIndex,
1644 int ThisAdjustment, DIFlags Flags,
bool IsOptimized,
Metadata *Unit,
1648 TempDISubprogram cloneImpl()
const {
1650 getFile(), getLine(),
getType(), isLocalToUnit(),
1651 isDefinition(), getScopeLine(), getContainingType(),
1653 getFlags(), isOptimized(), getUnit(),
1662 bool IsLocalToUnit,
bool IsDefinition,
unsigned ScopeLine,
1663 DITypeRef ContainingType,
unsigned Virtuality,
1664 unsigned VirtualIndex,
int ThisAdjustment, DIFlags Flags,
1666 DITemplateParameterArray TemplateParams =
nullptr,
1668 DINodeArray RetainedNodes =
nullptr,
1669 DITypeArray ThrownTypes =
nullptr),
1670 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
1671 IsDefinition, ScopeLine, ContainingType, Virtuality,
1672 VirtualIndex, ThisAdjustment, Flags, IsOptimized, Unit,
1673 TemplateParams, Declaration, RetainedNodes, ThrownTypes))
1677 unsigned Line,
Metadata *Type,
bool IsLocalToUnit,
bool IsDefinition,
1678 unsigned ScopeLine,
Metadata *ContainingType,
unsigned Virtuality,
1679 unsigned VirtualIndex,
int ThisAdjustment, DIFlags Flags,
1683 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
1684 ScopeLine, ContainingType, Virtuality, VirtualIndex, ThisAdjustment,
1685 Flags, IsOptimized, Unit, TemplateParams, Declaration, RetainedNodes,
1688 TempDISubprogram clone()
const {
return cloneImpl(); }
1691 TempDISubprogram cloneWithFlags(DIFlags NewFlags)
const {
1692 auto NewSP = clone();
1693 NewSP->Flags = NewFlags;
1698 unsigned getLine()
const {
return Line; }
1700 unsigned getVirtualIndex()
const {
return VirtualIndex; }
1701 int getThisAdjustment()
const {
return ThisAdjustment; }
1702 unsigned getScopeLine()
const {
return ScopeLine; }
1703 DIFlags getFlags()
const {
return Flags; }
1704 bool isLocalToUnit()
const {
return IsLocalToUnit; }
1705 bool isDefinition()
const {
return IsDefinition; }
1706 bool isOptimized()
const {
return IsOptimized; }
1708 bool isArtificial()
const {
return getFlags() & FlagArtificial; }
1709 bool isPrivate()
const {
1710 return (getFlags() & FlagAccessibility) == FlagPrivate;
1712 bool isProtected()
const {
1713 return (getFlags() & FlagAccessibility) == FlagProtected;
1715 bool isPublic()
const {
1716 return (getFlags() & FlagAccessibility) == FlagPublic;
1718 bool isExplicit()
const {
return getFlags() & FlagExplicit; }
1719 bool isPrototyped()
const {
return getFlags() & FlagPrototyped; }
1720 bool isMainSubprogram()
const {
return getFlags() & FlagMainSubprogram; }
1726 bool isLValueReference()
const {
return getFlags() & FlagLValueReference; }
1732 bool isRValueReference()
const {
return getFlags() & FlagRValueReference; }
1737 bool isNoReturn()
const {
return getFlags() & FlagNoReturn; }
1742 bool isThunk()
const {
return getFlags() & FlagThunk; }
1750 return cast_or_null<DISubroutineType>(getRawType());
1753 return DITypeRef(getRawContainingType());
1757 return cast_or_null<DICompileUnit>(getRawUnit());
1760 DITemplateParameterArray getTemplateParams()
const {
1761 return cast_or_null<MDTuple>(getRawTemplateParams());
1764 return cast_or_null<DISubprogram>(getRawDeclaration());
1766 DINodeArray getRetainedNodes()
const {
1767 return cast_or_null<MDTuple>(getRawRetainedNodes());
1769 DITypeArray getThrownTypes()
const {
1770 return cast_or_null<MDTuple>(getRawThrownTypes());
1773 Metadata *getRawScope()
const {
return getOperand(1); }
1774 MDString *getRawName()
const {
return getOperandAs<MDString>(2); }
1775 MDString *getRawLinkageName()
const {
return getOperandAs<MDString>(3); }
1776 Metadata *getRawType()
const {
return getOperand(4); }
1777 Metadata *getRawUnit()
const {
return getOperand(5); }
1778 Metadata *getRawDeclaration()
const {
return getOperand(6); }
1779 Metadata *getRawRetainedNodes()
const {
return getOperand(7); }
1780 Metadata *getRawContainingType()
const {
1781 return getNumOperands() > 8 ? getOperandAs<Metadata>(8) :
nullptr;
1783 Metadata *getRawTemplateParams()
const {
1784 return getNumOperands() > 9 ? getOperandAs<Metadata>(9) :
nullptr;
1786 Metadata *getRawThrownTypes()
const {
1787 return getNumOperands() > 10 ? getOperandAs<Metadata>(10) :
nullptr;
1793 bool describes(
const Function *
F)
const;
1804 :
DILocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
1829 assert(Column < (1u << 16) &&
"Expected 16-bit column");
1834 DIFile *File,
unsigned Line,
unsigned Column,
1836 bool ShouldCreate =
true) {
1837 return getImpl(Context, static_cast<Metadata *>(Scope),
1838 static_cast<Metadata *>(File), Line, Column, Storage,
1843 Metadata *File,
unsigned Line,
unsigned Column,
1846 TempDILexicalBlock cloneImpl()
const {
1847 return getTemporary(getContext(), getScope(), getFile(), getLine(),
1853 unsigned Line,
unsigned Column),
1854 (Scope, File, Line, Column))
1856 unsigned Line,
unsigned Column),
1857 (Scope, File, Line, Column))
1859 TempDILexicalBlock clone()
const {
return cloneImpl(); }
1873 unsigned Discriminator;
1878 Discriminator(Discriminator) {}
1882 DIFile *File,
unsigned Discriminator,
1884 bool ShouldCreate =
true) {
1885 return getImpl(Context, static_cast<Metadata *>(Scope),
1886 static_cast<Metadata *>(File), Discriminator, Storage,
1891 Metadata *File,
unsigned Discriminator,
1893 bool ShouldCreate =
true);
1895 TempDILexicalBlockFile cloneImpl()
const {
1896 return getTemporary(getContext(), getScope(), getFile(),
1897 getDiscriminator());
1902 unsigned Discriminator),
1903 (Scope, File, Discriminator))
1906 (Scope, File, Discriminator))
1908 TempDILexicalBlockFile clone()
const {
return cloneImpl(); }
1911 unsigned getLine()
const =
delete;
1912 unsigned getColumn()
const =
delete;
1921 unsigned DILocation::getDiscriminator()
const {
1922 if (
auto *
F = dyn_cast<DILexicalBlockFile>(getScope()))
1923 return F->getDiscriminator();
1934 for (
auto *LBF = dyn_cast<DILexicalBlockFile>(Scope);
1935 LBF && LBF->getDiscriminator() != 0;
1940 return DILocation::get(getContext(), getLine(), getColumn(), NewScope,
1945 return getBaseDiscriminatorFromDiscriminator(getDiscriminator());
1949 return getDuplicationFactorFromDiscriminator(getDiscriminator());
1953 return getCopyIdentifierFromDiscriminator(getDiscriminator());
1960 return cloneWithDiscriminator(getPrefixEncodingFromUnsigned(D) << 1);
1964 DF *= getDuplicationFactor();
1968 unsigned BD = getBaseDiscriminator();
1969 unsigned CI = getCopyIdentifier() << (DF > 0x1f ? 14 : 7);
1970 unsigned D = CI | (getPrefixEncodingFromUnsigned(DF) << 1);
1975 D = (D << (BD > 0x1f ? 14 : 7)) | (getPrefixEncodingFromUnsigned(BD) << 1);
1977 return cloneWithDiscriminator(D);
1984 unsigned ExportSymbols : 1;
1988 :
DIScope(Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace,
1990 ExportSymbols(ExportSymbols) {}
1996 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
1997 ExportSymbols, Storage, ShouldCreate);
2000 MDString *Name,
bool ExportSymbols,
2003 TempDINamespace cloneImpl()
const {
2004 return getTemporary(getContext(), getScope(),
getName(),
2005 getExportSymbols());
2011 (Scope, Name, ExportSymbols))
2014 (Scope, Name, ExportSymbols))
2016 TempDINamespace clone()
const {
return cloneImpl(); }
2037 :
DIScope(Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops) {}
2044 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2045 getCanonicalMDString(Context, ConfigurationMacros),
2046 getCanonicalMDString(Context, IncludePath),
2047 getCanonicalMDString(Context, ISysRoot),
2048 Storage, ShouldCreate);
2055 TempDIModule cloneImpl()
const {
2056 return getTemporary(getContext(), getScope(),
getName(),
2057 getConfigurationMacros(), getIncludePath(),
2065 (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot))
2069 (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot))
2071 TempDIModule clone()
const {
return cloneImpl(); }
2095 :
DINode(Context, ID, Storage, Tag, Ops) {}
2106 return MD->
getMetadataID() == DITemplateTypeParameterKind ||
2118 dwarf::DW_TAG_template_type_parameter, Ops) {}
2123 bool ShouldCreate =
true) {
2124 return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
2129 bool ShouldCreate =
true);
2131 TempDITemplateTypeParameter cloneImpl()
const {
2141 TempDITemplateTypeParameter clone()
const {
return cloneImpl(); }
2161 bool ShouldCreate =
true) {
2162 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
2163 Value, Storage, ShouldCreate);
2168 bool ShouldCreate =
true);
2170 TempDITemplateValueParameter cloneImpl()
const {
2178 (Tag, Name, Type, Value))
2181 (Tag, Name, Type, Value))
2183 TempDITemplateValueParameter clone()
const {
return cloneImpl(); }
2200 :
DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
2201 AlignInBits(AlignInBits) {}
2219 return BT->getSignedness();
2224 if (
auto *
F = getFile())
2225 return F->getFilename();
2230 if (
auto *
F = getFile())
2231 return F->getDirectory();
2236 if (
auto *
F = getFile())
2237 return F->getSource();
2265 std::vector<uint64_t> Elements;
2268 :
MDNode(C, DIExpressionKind, Storage,
None),
2269 Elements(Elements.
begin(), Elements.
end()) {}
2274 bool ShouldCreate =
true);
2276 TempDIExpression cloneImpl()
const {
2277 return getTemporary(getContext(), getElements());
2283 TempDIExpression clone()
const {
return cloneImpl(); }
2290 assert(I < Elements.
size() &&
"Index out of range");
2307 const uint64_t *
Op =
nullptr;
2313 const uint64_t *
get()
const {
return Op; }
2321 uint64_t
getArg(
unsigned I)
const {
return Op[I + 1]; }
2328 unsigned getSize()
const;
2332 V.
append(
get(),
get() + getSize());
2338 :
public std::iterator<std::input_iterator_tag, ExprOperand> {
2367 return getBase() == X.
getBase();
2370 return getBase() != X.
getBase();
2392 return {expr_op_begin(), expr_op_end()};
2396 bool isValid()
const;
2404 return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
2419 return getFragmentInfo(expr_op_begin(), expr_op_end());
2430 bool extractIfOffset(int64_t &Offset)
const;
2433 enum { NoDeref =
false, WithDeref =
true, WithStackValue =
true };
2438 int64_t Offset = 0,
bool DerefAfter =
false,
2439 bool StackValue =
false);
2445 bool StackValue =
false);
2471 createFragmentExpression(
const DIExpression *Expr,
unsigned OffsetInBits,
2472 unsigned SizeInBits);
2479 auto Fragment1 = *getFragmentInfo();
2481 unsigned l1 = Fragment1.OffsetInBits;
2482 unsigned l2 = Fragment2.OffsetInBits;
2483 unsigned r1 = l1 + Fragment1.SizeInBits;
2484 unsigned r2 = l2 + Fragment2.SizeInBits;
2497 return fragmentCmp(Other) == 0;
2512 bool IsLocalToUnit,
bool IsDefinition,
uint32_t AlignInBits,
2514 :
DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits),
2515 IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
2521 bool IsLocalToUnit,
bool IsDefinition,
2524 bool ShouldCreate =
true) {
2525 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2526 getCanonicalMDString(Context, LinkageName), File, Line, Type,
2527 IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration,
2528 AlignInBits, Storage, ShouldCreate);
2533 bool IsLocalToUnit,
bool IsDefinition,
2537 TempDIGlobalVariable cloneImpl()
const {
2539 getFile(), getLine(),
getType(), isLocalToUnit(),
2540 isDefinition(), getStaticDataMemberDeclaration(),
2548 bool IsLocalToUnit,
bool IsDefinition,
2551 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2552 IsDefinition, StaticDataMemberDeclaration, AlignInBits))
2556 bool IsLocalToUnit,
bool IsDefinition,
2557 Metadata *StaticDataMemberDeclaration,
2559 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2560 IsDefinition, StaticDataMemberDeclaration, AlignInBits))
2562 TempDIGlobalVariable clone()
const {
return cloneImpl(); }
2569 return cast_or_null<DIDerivedType>(getRawStaticDataMemberDeclaration());
2593 :
DIVariable(C, DILocalVariableKind, Storage, Line, Ops, AlignInBits),
2594 Arg(Arg), Flags(Flags) {
2595 assert(Arg < (1 << 16) &&
"DILocalVariable: Arg out of range");
2603 bool ShouldCreate =
true) {
2604 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2605 Line, Type, Arg, Flags, AlignInBits, Storage, ShouldCreate);
2611 bool ShouldCreate =
true);
2613 TempDILocalVariable cloneImpl()
const {
2614 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2615 getLine(),
getType(), getArg(), getFlags(),
2622 unsigned Line,
DITypeRef Type,
unsigned Arg,
2624 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2627 unsigned Line,
Metadata *Type,
unsigned Arg,
2629 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2631 TempDILocalVariable clone()
const {
return cloneImpl(); }
2653 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2671 :
DINode(C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
2677 bool ShouldCreate =
true) {
2678 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2679 Line, Storage, ShouldCreate);
2684 bool ShouldCreate =
true);
2686 TempDILabel cloneImpl()
const {
2687 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2695 (Scope, Name, File, Line))
2699 (Scope, Name, File, Line))
2701 TempDILabel clone()
const {
return cloneImpl(); }
2707 return cast_or_null<DILocalScope>(getRawScope());
2723 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2736 unsigned Attributes;
2740 :
DINode(C, DIObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
2742 Line(Line), Attributes(Attributes) {}
2749 return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
2750 getCanonicalMDString(Context, GetterName),
2751 getCanonicalMDString(Context, SetterName), Attributes, Type,
2752 Storage, ShouldCreate);
2757 unsigned Attributes,
Metadata *Type,
2760 TempDIObjCProperty cloneImpl()
const {
2761 return getTemporary(getContext(),
getName(), getFile(), getLine(),
2771 (Name, File, Line, GetterName, SetterName, Attributes,
2776 unsigned Attributes,
Metadata *Type),
2777 (Name, File, Line, GetterName, SetterName, Attributes,
2780 TempDIObjCProperty clone()
const {
return cloneImpl(); }
2791 if (
auto *
F = getFile())
2792 return F->getFilename();
2797 if (
auto *
F = getFile())
2798 return F->getDirectory();
2803 if (
auto *
F = getFile())
2804 return F->getSource();
2828 :
DINode(C, DIImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
2835 bool ShouldCreate =
true) {
2836 return getImpl(Context, Tag, Scope, Entity, File, Line,
2837 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
2843 bool ShouldCreate =
true);
2845 TempDIImportedEntity cloneImpl()
const {
2846 return getTemporary(getContext(),
getTag(), getScope(), getEntity(),
2847 getFile(), getLine(),
getName());
2854 (Tag, Scope, Entity, File, Line, Name))
2858 (Tag, Scope, Entity, File, Line, Name))
2860 TempDIImportedEntity clone()
const {
return cloneImpl(); }
2885 :
MDNode(C, DIGlobalVariableExpressionKind, Storage, Ops) {}
2892 TempDIGlobalVariableExpression cloneImpl()
const {
2893 return getTemporary(getContext(), getVariable(), getExpression());
2899 (Variable, Expression))
2901 TempDIGlobalVariableExpression clone()
const {
return cloneImpl(); }
2906 return cast_or_null<DIGlobalVariable>(getRawVariable());
2912 return cast<DIExpression>(getRawExpression());
2916 return MD->
getMetadataID() == DIGlobalVariableExpressionKind;
2933 :
MDNode(C, ID, Storage, Ops1, Ops2) {
2934 assert(MIType < 1u << 16);
2935 SubclassData16 = MIType;
2940 return cast_or_null<Ty>(getOperand(I));
2944 if (
auto *S = getOperandAs<MDString>(I))
2945 return S->getString();
2963 case DIMacroFileKind:
2977 :
DIMacroNode(C, DIMacroKind, Storage, MIType, Ops), Line(Line) {}
2982 bool ShouldCreate =
true) {
2983 return getImpl(Context, MIType, Line, getCanonicalMDString(Context, Name),
2984 getCanonicalMDString(Context, Value), Storage, ShouldCreate);
2988 bool ShouldCreate =
true);
2990 TempDIMacro cloneImpl()
const {
2991 return getTemporary(getContext(), getMacinfoType(), getLine(),
getName(),
2998 (MIType, Line, Name, Value))
3001 (MIType, Line, Name, Value))
3003 TempDIMacro clone()
const {
return cloneImpl(); }
3026 :
DIMacroNode(C, DIMacroFileKind, Storage, MIType, Ops), Line(Line) {}
3030 unsigned Line,
DIFile *File,
3032 bool ShouldCreate =
true) {
3033 return getImpl(Context, MIType, Line, static_cast<Metadata *>(File),
3034 Elements.get(), Storage, ShouldCreate);
3041 TempDIMacroFile cloneImpl()
const {
3042 return getTemporary(getContext(), getMacinfoType(), getLine(), getFile(),
3048 DIMacroNodeArray Elements),
3049 (MIType, Line, File, Elements))
3052 (MIType, Line, File, Elements))
3054 TempDIMacroFile clone()
const {
return cloneImpl(); }
3060 "Lost a macro node during macro node list replacement");
3062 replaceOperandWith(1, Elements.get());
3069 return cast_or_null<MDTuple>(getRawElements());
3082 #undef DEFINE_MDNODE_GET_UNPACK_IMPL 3083 #undef DEFINE_MDNODE_GET_UNPACK 3084 #undef DEFINE_MDNODE_GET 3086 #endif // LLVM_IR_DEBUGINFOMETADATA_H
T Value
The string value of the checksum.
bool operator==(const expr_op_iterator &X) const
bool isObjectPointer() const
StringRef getFilename() const
Metadata * getRawRetainedTypes() const
static bool classof(const Metadata *MD)
MDString * getRawName() const
const_iterator end(StringRef path)
Get end iterator over path.
Tracking metadata reference owned by Metadata.
ArrayRef< uint64_t > getElements() const
#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue)
LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can perform bitwise operatio...
StringRef getKindAsString() const
uint64_t getOffsetInBits() const
static void r2(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
DITypeRef operator[](unsigned I) const
static bool isConstant(const MachineInstr &MI)
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
bool isTypePassByValue() const
bool isDefinition() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Metadata * getRawVariable() const
StringRef getName() const
ChecksumKind Kind
The kind of checksum which Value encodes.
Compute iterated dominance frontiers using a linear time algorithm.
StringRef getName() const
unsigned getRuntimeVersion() const
Metadata * getRawGlobalVariables() const
Metadata * getRawScope() const
MDString * getRawName() const
StringRef getGetterName() const
Metadata * getRawVTableHolder() const
MDTuple * operator->() const
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
MDString * getRawName() const
static MDString * get(LLVMContext &Context, StringRef Str)
unsigned getNumArgs() const
Metadata * getRawFile() const
bool operator!=(const expr_op_iterator &X) const
DIScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
DITypeRef getBaseType() const
static bool classof(const Metadata *MD)
unsigned getDiscriminator() const
MDString * getRawValue() const
Metadata * getRawFile() const
Return the raw underlying file.
TypedDINodeRef(std::nullptr_t)
static bool classof(const Metadata *MD)
void setSplitDebugInlining(bool SplitDebugInlining)
void emplace(ArgTypes &&... Args)
Create a new object by constructing it in place with the given arguments.
Metadata * getRawInlinedAt() const
DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, ArrayRef< Metadata *> Ops)
static enum BaseType getBaseType(const Value *Val)
Return the baseType for Val which states whether Val is exclusively derived from constant/null, or not exclusively derived from constant.
unsigned getSize() const
Return the size of the operand.
ArrayRef< uint64_t >::iterator element_iterator
DICompositeTypeArray getEnumTypes() const
const ExprOperand & operator*() const
uint64_t getDWOId() const
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
Optional< DIBasicType::Signedness > getSignedness() const
Return the signedness of this variable's type, or None if this type is neither signed nor unsigned...
Metadata * getRawScope() const
const MDOperand & getOperand(unsigned I) const
static bool classof(const Metadata *MD)
StringRef getConfigurationMacros() const
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
StringRef getProducer() const
static bool classof(const Metadata *MD)
bool isForwardDecl() const
bool getDebugInfoForProfiling() const
unsigned getVirtuality(StringRef VirtualityString)
op_iterator op_end() const
StringRef getName() const
Tagged DWARF-like metadata node.
void replaceRetainedTypes(DITypeArray N)
const DILocation * setBaseDiscriminator(unsigned BD) const
Returns a new DILocation with updated base discriminator BD.
bool operator!=(const TypedDINodeRef< T > &X) const
DINodeArray getElements() const
TempMDNode clone() const
Create a (temporary) clone of this.
const DILocation * cloneWithDuplicationFactor(unsigned DF) const
Returns a new DILocation with duplication factor DF encoded in the discriminator. ...
MDString * getRawName() const
op_range dwarf_operands() const
static bool classof(const Metadata *MD)
StringRef getStringOperand(unsigned I) const
DIScope * getScope() const
Metadata * getRawTypeArray() const
Ty * getOperandAs(unsigned I) const
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
StringRef getSplitDebugFilename() const
StringRef getName() const
StringRef getFlags() const
StringRef getName() const
bool isLValueReference() const
bool isStaticMember() const
static bool classof(const Metadata *MD)
DIGlobalVariable * getVariable() const
static bool classof(const Metadata *MD)
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
MDString * getRawSetterName() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isArtificial() const
static bool classof(const Metadata *MD)
iterator(MDNode::op_iterator I)
static StringRef getName(Value *V)
const uint64_t * get() const
uint64_t getSizeInBits() const
Holds a subclass of DINode.
StringRef getDirectory() const
Metadata * getRawType() const
DITypeRef getVTableHolder() const
StringRef getFilename() const
MDString * getRawISysRoot() const
op_iterator op_begin() const
static int64_t getConstant(const MachineInstr *MI)
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
bool getExportSymbols() const
Metadata * getRawImportedEntities() const
bool isLocalToUnit() const
expr_op_iterator expr_op_end() const
TypedDINodeRef(const T *MD)
StringRef getIncludePath() const
Holds the characteristics of one fragment of a larger variable.
unsigned getRuntimeLang() const
unsigned getDuplicationFactor() const
Returns the duplication factor stored in the discriminator.
DITypeRef getType() const
MDString * getRawName() const
DITypeRef operator*() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
DIMacroNodeArray getElements() const
uint32_t getAlignInBytes() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const MDOperand & getDwarfOperand(unsigned I) const
uint32_t getAlignInBits() const
static Optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
DINode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
Metadata * getRawEntity() const
StringRef getFilename() const
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
DIScope * getScope() const
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
uint64_t getArg(unsigned I) const
Get an argument to the operand.
StringRef getDirectory() const
Metadata * getRawFile() const
StringRef getStringOperand(unsigned I) const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
StringRef getName() const
DIScope * getScope() const
static bool classof(const Metadata *MD)
uint64_t getOp() const
Get the operand code.
DIMacroNodeArray getMacros() const
bool isValidLocationForIntrinsic(const DILocation *DL) const
Check that a location is valid for this label.
ExprOperand(const uint64_t *Op)
Metadata * getValue() const
op_iterator dwarf_op_begin() const
void replaceVTableHolder(DITypeRef VTableHolder)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DITemplateParameterArray getTemplateParams() const
initializer< Ty > init(const Ty &Val)
unsigned getColumn() const
TypedDINodeRef< DINode > DINodeRef
expr_op_iterator(element_iterator I)
Metadata * getRawDiscriminator() const
bool operator==(const ChecksumInfo< T > &X) const
static bool classof(const Metadata *MD)
A single checksum, represented by a Kind and a Value (a string).
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static bool classof(const Metadata *MD)
void replaceDwarfOperandWith(unsigned I, Metadata *New)
size_t size() const
size - Get the array size.
This is an important base class in LLVM.
expr_op_iterator & operator++()
CountType getCount() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Metadata * getRawExpression() const
Base class for template parameters.
unsigned getAttributes() const
ChecksumInfo(ChecksumKind Kind, T Value)
Ty * getOperandAs(unsigned I) const
DIExpression * getExpression() const
StringRef getName() const
A lightweight wrapper around an expression operand.
bool isValidLocationForIntrinsic(const DILocation *DL) const
Check that a location is valid for this variable.
A pair of DIGlobalVariable and DIExpression.
DIImportedEntityArray getImportedEntities() const
static MDString * getCanonicalMDString(LLVMContext &Context, StringRef S)
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags)
Change fields in place.
DIDerivedType * getStaticDataMemberDeclaration() const
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
DEFINE_MDNODE_GET(DIGlobalVariableExpression,(Metadata *Variable, Metadata *Expression),(Variable, Expression)) TempDIGlobalVariableExpression clone() const
Base class for variables.
TypedDINodeRef(const TypedDINodeRef< U > &X, typename std::enable_if< std::is_convertible< U *, T *>::value >::type *=nullptr)
ChecksumKind
Which algorithm (e.g.
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Line, ArrayRef< Metadata *> Ops, uint32_t AlignInBits=0)
void init(unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags)
bool isObjectPointer() const
bool isObjcClassComplete() const
void appendToVector(SmallVectorImpl< uint64_t > &V) const
Append the elements of this operand to V.
static void r1(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
StringRef getHeader() const
static bool classof(const Metadata *MD)
MDString * getRawConfigurationMacros() const
element_iterator getBase() const
StringRef getDirectory() const
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
element_iterator elements_end() const
static wasm::ValType getType(const TargetRegisterClass *RC)
uint64_t getElement(unsigned I) const
Metadata * getRawType() const
static bool classof(const Metadata *MD)
MDString * getRawName() const
MDString * getRawName() const
static bool classof(const Metadata *MD)
bool isRValueReference() const
static bool classof(const Metadata *MD)
Optional< StringRef > getSource() const
An imported module (C++ using directive or similar).
StringRef getSetterName() const
Base class for scope-like contexts.
iterator_range< expr_op_iterator > expr_ops() const
expr_op_iterator operator++(int)
op_iterator dwarf_op_end() const
void setTag(unsigned Tag)
Allow subclasses to mutate the tag.
Metadata * getRawElements() const
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
static SimpleType getSimplifiedValue(const TypedDINodeRef< T > &MD)
static bool classof(const Metadata *MD)
Metadata * getRawScope() const
static unsigned getBaseDiscriminatorFromDiscriminator(unsigned D)
Returns the base discriminator for a given encoded discriminator D.
void setDWOId(uint64_t DwoId)
static MDString * getCanonicalMDString(LLVMContext &Context, StringRef S)
DITemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
Metadata * getRawTemplateParams() const
static bool classof(const Metadata *MD)
static unsigned getDuplicationFactorFromDiscriminator(unsigned D)
Returns the duplication factor for a given encoded discriminator D.
unsigned getCopyIdentifier() const
Returns the copy identifier stored in the discriminator.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
TypedDINodeRef(const Metadata *MD)
MDString * getRawHeader() const
bool getGnuPubnames() const
const ExprOperand * operator->() const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
MDTuple & operator*() const
static unsigned getCopyIdentifierFromDiscriminator(unsigned D)
Returns the copy identifier for a given encoded discriminator D.
static Optional< unsigned > getTag(const TargetRegisterInfo *TRI, const MachineInstr &MI, const LoadInfo &LI)
DITypeRef getType() const
Metadata * getRawElements() const
Metadata * getRawFile() const
StringRef getDisplayName() const
DebugEmissionKind getEmissionKind() const
unsigned getSourceLanguage() const
StringRef getLinkageName() const
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
Metadata * getRawFile() const
bool fragmentsOverlap(const DIExpression *Other) const
Check if fragments overlap between this DIExpression and Other.
A (clang) module that has been imported by the compile unit.
DIGlobalVariableExpressionArray getGlobalVariables() const
bool isBlockByrefStruct() const
Generic tagged DWARF-like metadata node.
unsigned getNumElements() const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Metadata * getRawFile() const
amdgpu Simplify well known AMD library false Value Value * Arg
Metadata * getRawBaseType() const
StringRef getIdentifier() const
MDString * getRawName() const
Type array for a subprogram.
static bool classof(const Metadata *MD)
StringRef getName() const
bool getSplitDebugInlining() const
MDString * getRawIdentifier() const
Macro Info DWARF-like metadata node.
unsigned getBaseDiscriminator() const
Returns the base discriminator stored in the discriminator.
static bool classof(const Metadata *MD)
bool isArtificial() const
Metadata * getRawEnumTypes() const
unsigned getEncoding() const
Metadata * getRawScope() const
MDString * getRawSplitDebugFilename() const
DIMacroNode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned MIType, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
static bool classof(const Metadata *MD)
MDString * getRawProducer() const
Optional< StringRef > getSource() const
MDString * getRawName() const
element_iterator elements_begin() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getMacinfoType() const
StringRef getValue() const
DITypeRefArray(const MDTuple *N)
MDString * getRawLinkageName() const
unsigned getNumDwarfOperands() const
Optional< StringRef > getSource() const
Metadata * getRawStaticDataMemberDeclaration() const
DIScopeArray getRetainedTypes() const
static bool classof(const Metadata *MD)
bool operator!=(const iterator &X) const
DITypeRef getType() const
DILocalScope * getScope() const
Get the local scope for this label.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint32_t getAlignInBits() const
uint32_t getAlignInBytes() const
LLVM Value Representation.
DIScopeRef getScope() const
static bool classof(const Metadata *MD)
const DILocation * cloneWithDiscriminator(unsigned Discriminator) const
Returns a new DILocation with updated Discriminator.
unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Metadata * getRawMacros() const
Metadata * getRawScope() const
DINodeRef getEntity() const
int fragmentCmp(const DIExpression *Other) const
Determine the relative position of the fragments described by this DIExpression and Other...
DIScope * getScope() const
bool operator==(const TypedDINodeRef< T > &X) const
bool operator!=(const ChecksumInfo< T > &X) const
expr_op_iterator getNext() const
Get the next iterator.
DITypeRefArray getTypeArray() const
bool isAppleBlockExtension() const
DIDerivedType * getDiscriminator() const
Metadata * getRawScope() const
An iterator for expression operands.
void replaceMacros(DIMacroNodeArray N)
TypedDINodeRef< DIScope > DIScopeRef
StringRef - Represent a constant reference to a string, i.e.
DILocalScope * getScope() const
MDString * getRawIncludePath() const
bool operator==(const iterator &X) const
bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
static bool classof(const Metadata *MD)
Metadata * getRawType() const
Metadata * getRawScope() const
TypedDINodeRef< DIType > DITypeRef
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
DILocalScope * getScope() const
Get the local scope for this variable.
unsigned getNumOperands() const
Return number of MDNode operands.
DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage, ArrayRef< Metadata *> Ops)
DEFINE_MDNODE_GET(DIExpression,(ArrayRef< uint64_t > Elements),(Elements)) TempDIExpression clone() const
void replaceElements(DINodeArray Elements)
Replace operands.
bool isFragment() const
Return whether this is a piece of an aggregate variable.
MDString * getRawName() const
MDString * getRawGetterName() const
StringRef getISysRoot() const
DILocalScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
StringRef getName() const
static bool classof(const Metadata *MD)
Metadata * getRawScope() const
void replaceElements(DIMacroNodeArray Elements)
static bool classof(const Metadata *MD)
bool isTypePassByReference() const
static bool classof(const Metadata *MD)
MDString * getRawFlags() const
void replaceImportedEntities(DIImportedEntityArray N)
StringRef getName() const
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...
Basic type, like 'int' or 'float'.
DIScopeRef getScope() const
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.