44 if (
auto *LocalScope = dyn_cast_or_null<DILocalScope>(Scope))
64 processCompileUnit(
CU);
66 if (
auto *
SP = cast_or_null<DISubprogram>(
F.getSubprogram()))
67 processSubprogram(
SP);
72 processInstruction(M,
I);
77 if (!addCompileUnit(CU))
80 if (!addGlobalVariable(DIG))
82 auto *GV = DIG->getVariable();
83 processScope(GV->getScope());
84 processType(GV->getType());
89 if (
auto *
T = dyn_cast<DIType>(RT))
92 processSubprogram(cast<DISubprogram>(RT));
94 auto *Entity =
Import->getEntity();
95 if (
auto *
T = dyn_cast<DIType>(Entity))
97 else if (
auto *
SP = dyn_cast<DISubprogram>(Entity))
98 processSubprogram(
SP);
99 else if (
auto *NS = dyn_cast<DINamespace>(Entity))
100 processScope(NS->getScope());
101 else if (
auto *M = dyn_cast<DIModule>(Entity))
102 processScope(M->getScope());
108 if (
auto *DDI = dyn_cast<DbgDeclareInst>(&I))
109 processDeclare(M, DDI);
110 else if (
auto *DVI = dyn_cast<DbgValueInst>(&I))
111 processValue(M, DVI);
114 processLocation(M, DbgLoc.get());
120 processScope(Loc->getScope());
121 processLocation(M, Loc->getInlinedAt());
124 void DebugInfoFinder::processType(
DIType *DT) {
128 if (
auto *
ST = dyn_cast<DISubroutineType>(DT)) {
133 if (
auto *DCT = dyn_cast<DICompositeType>(DT)) {
134 processType(DCT->getBaseType());
136 if (
auto *
T = dyn_cast<DIType>(
D))
138 else if (
auto *
SP = dyn_cast<DISubprogram>(
D))
139 processSubprogram(
SP);
143 if (
auto *DDT = dyn_cast<DIDerivedType>(DT)) {
144 processType(DDT->getBaseType());
151 if (
auto *Ty = dyn_cast<DIType>(Scope)) {
155 if (
auto *CU = dyn_cast<DICompileUnit>(Scope)) {
159 if (
auto *
SP = dyn_cast<DISubprogram>(Scope)) {
160 processSubprogram(
SP);
163 if (!addScope(Scope))
165 if (
auto *LB = dyn_cast<DILexicalBlockBase>(Scope)) {
166 processScope(LB->getScope());
167 }
else if (
auto *NS = dyn_cast<DINamespace>(Scope)) {
168 processScope(NS->getScope());
169 }
else if (
auto *M = dyn_cast<DIModule>(Scope)) {
170 processScope(M->getScope());
175 if (!addSubprogram(SP))
186 processCompileUnit(SP->getUnit());
187 processType(SP->getType());
188 for (
auto *Element : SP->getTemplateParams()) {
189 if (
auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
190 processType(TType->getType());
191 }
else if (
auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
192 processType(TVal->getType());
207 if (!NodesSeen.insert(DV).second)
209 processScope(DV->getScope());
210 processType(DV->getType());
222 if (!NodesSeen.insert(DV).second)
224 processScope(DV->getScope());
225 processType(DV->getType());
228 bool DebugInfoFinder::addType(
DIType *DT) {
232 if (!NodesSeen.insert(DT).second)
235 TYs.push_back(const_cast<DIType *>(DT));
242 if (!NodesSeen.insert(CU).second)
250 if (!NodesSeen.insert(DIG).second)
261 if (!NodesSeen.insert(SP).second)
268 bool DebugInfoFinder::addScope(
DIScope *Scope) {
275 if (!NodesSeen.insert(Scope).second)
277 Scopes.push_back(Scope);
286 return isa<DILocation>(
Op.get());
293 return !isa<DILocation>(
Op.get());
303 if (!isa<DILocation>(*
Op))
314 bool Changed =
false;
322 for (
auto II = BB.begin(), End = BB.end(); II != End;) {
324 if (isa<DbgInfoIntrinsic>(&I)) {
335 auto *TermInst = BB.getTerminator();
339 if (
auto *LoopID = TermInst->getMetadata(LLVMContext::MD_loop)) {
340 auto *NewLoopID = LoopIDsMap.
lookup(LoopID);
343 if (NewLoopID != LoopID)
344 TermInst->setMetadata(LLVMContext::MD_loop, NewLoopID);
351 bool Changed =
false;
361 NMD->
getName() ==
"llvm.gcov") {
370 for (
auto &GV : M.globals()) {
371 Changed |= GV.eraseMetadata(LLVMContext::MD_dbg);
375 Materializer->setStripDebugInfo();
383 class DebugTypeInfoRemoval {
388 MDNode *EmptySubroutineType;
412 auto Replacement = Replacements.
find(M);
413 if (Replacement != Replacements.
end())
414 return Replacement->second;
418 MDNode *mapNode(
Metadata *
N) {
return dyn_cast_or_null<MDNode>(map(N)); }
422 void traverseAndRemap(
MDNode *N) { traverse(N); }
427 auto *FileAndScope = cast_or_null<DIFile>(map(MDS->
getFile()));
430 auto *
Type = cast_or_null<DISubroutineType>(map(MDS->getType()));
432 cast_or_null<DIType>(map(MDS->getContainingType()));
433 auto *Unit = cast_or_null<DICompileUnit>(map(MDS->getUnit()));
434 auto Variables =
nullptr;
435 auto TemplateParams =
nullptr;
438 auto distinctMDSubprogram = [&]() {
441 FileAndScope, MDS->getLine(),
Type, MDS->getScopeLine(),
442 ContainingType, MDS->getVirtualIndex(), MDS->getThisAdjustment(),
443 MDS->getFlags(), MDS->getSPFlags(), Unit, TemplateParams, Declaration,
448 return distinctMDSubprogram();
452 FileAndScope, MDS->getLine(),
Type, MDS->getScopeLine(), ContainingType,
453 MDS->getVirtualIndex(), MDS->getThisAdjustment(), MDS->getFlags(),
454 MDS->getSPFlags(), Unit, TemplateParams, Declaration, Variables);
456 StringRef OldLinkageName = MDS->getLinkageName();
459 auto OrigLinkage = NewToLinkageName.
find(NewMDS);
460 if (OrigLinkage != NewToLinkageName.
end()) {
461 if (OrigLinkage->second == OldLinkageName)
467 return distinctMDSubprogram();
470 NewToLinkageName.
insert({NewMDS, MDS->getLinkageName()});
480 auto *
File = cast_or_null<DIFile>(map(CU->
getFile()));
482 MDTuple *RetainedTypes =
nullptr;
483 MDTuple *GlobalVariables =
nullptr;
484 MDTuple *ImportedEntities =
nullptr;
489 RetainedTypes, GlobalVariables, ImportedEntities, CU->
getMacros(),
496 auto *Scope = map(MLD->getScope());
497 auto *InlinedAt = map(MLD->getInlinedAt());
500 MLD->getColumn(),
Scope, InlinedAt);
518 if (Replacements.
count(N))
524 if (
auto *MDSub = dyn_cast<DISubprogram>(N)) {
525 remap(MDSub->getUnit());
526 return getReplacementSubprogram(MDSub);
528 if (isa<DISubroutineType>(N))
529 return EmptySubroutineType;
530 if (
auto *CU = dyn_cast<DICompileUnit>(N))
531 return getReplacementCU(CU);
534 if (
auto *MDLB = dyn_cast<DILexicalBlockBase>(N))
536 return mapNode(MDLB->getScope());
537 if (
auto *MLD = dyn_cast<DILocation>(N))
538 return getReplacementMDLocation(MLD);
545 return getReplacementMDNode(N);
547 Replacements[
N] = doRemap(N);
556 void DebugTypeInfoRemoval::traverse(
MDNode *
N) {
557 if (!N || Replacements.count(N))
563 if (
auto *MDS = dyn_cast<DISubprogram>(Parent))
564 return Child == MDS->getRetainedNodes().get();
573 while (!ToVisit.
empty()) {
574 auto *N = ToVisit.
back();
575 if (!Opened.
insert(N).second) {
582 if (
auto *MDN = dyn_cast_or_null<MDNode>(
I))
583 if (!Opened.
count(MDN) && !Replacements.count(MDN) && !
prune(N, MDN) &&
584 !isa<DICompileUnit>(MDN))
590 bool Changed =
false;
595 while (!DbgVal->use_empty())
596 cast<Instruction>(DbgVal->user_back())->eraseFromParent();
597 DbgVal->eraseFromParent();
601 RemoveUses(
"llvm.dbg.declare");
602 RemoveUses(
"llvm.dbg.value");
610 if (NMD->
getName() ==
"llvm.dbg.cu")
616 GV.eraseMetadata(LLVMContext::MD_dbg);
622 Mapper.traverseAndRemap(Node);
623 auto *NewNode = Mapper.mapNode(Node);
624 Changed |= Node != NewNode;
632 if (
auto *SP =
F.getSubprogram()) {
633 Mapper.traverseAndRemap(SP);
634 auto *NewSP = cast<DISubprogram>(Mapper.mapNode(SP));
635 Changed |= SP != NewSP;
636 F.setSubprogram(NewSP);
642 MDNode *InlinedAt = DL.getInlinedAt();
643 Scope = remap(Scope);
644 InlinedAt = remap(InlinedAt);
649 I.setDebugLoc(remapDebugLoc(
I.getDebugLoc()));
653 I.getAllMetadata(MDs);
654 for (
auto Attachment : MDs)
655 if (
auto *
T = dyn_cast_or_null<MDTuple>(Attachment.second))
656 for (
unsigned N = 0; N <
T->getNumOperands(); ++
N)
657 if (
auto *Loc = dyn_cast_or_null<DILocation>(
T->getOperand(N)))
659 T->replaceOperandWith(N, remapDebugLoc(Loc));
666 for (
auto &NMD : M.getNamedMDList()) {
683 if (
auto *Val = mdconst::dyn_extract_or_null<ConstantInt>(
685 return Val->getZExtValue();
700 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \ 701 case LLVMDWARFSourceLanguage##NAME: \ 703 #include "llvm/BinaryFormat/Dwarf.def" 704 #undef HANDLE_DW_LANG 710 return (DIT *)(Ref ? unwrap<MDNode>(Ref) :
nullptr);
751 unwrap(Builder)->finalize();
757 LLVMBool isOptimized,
const char *Flags,
size_t FlagsLen,
758 unsigned RuntimeVer,
const char *SplitName,
size_t SplitNameLen,
761 auto File = unwrapDI<DIFile>(FileRef);
763 return wrap(
unwrap(Builder)->createCompileUnit(
765 StringRef(Producer, ProducerLen), isOptimized,
768 static_cast<DICompileUnit::DebugEmissionKind>(Kind), DWOId,
769 SplitDebugInlining, DebugInfoForProfiling));
774 size_t FilenameLen,
const char *Directory,
775 size_t DirectoryLen) {
782 const char *
Name,
size_t NameLen,
783 const char *ConfigMacros,
size_t ConfigMacrosLen,
784 const char *IncludePath,
size_t IncludePathLen,
785 const char *SysRoot,
size_t SysRootLen) {
787 unwrapDI<DIScope>(ParentScope),
StringRef(Name, NameLen),
788 StringRef(ConfigMacros, ConfigMacrosLen),
795 const char *
Name,
size_t NameLen,
798 unwrapDI<DIScope>(ParentScope),
StringRef(Name, NameLen), ExportSymbols));
803 size_t NameLen,
const char *LinkageName,
size_t LinkageNameLen,
808 unwrapDI<DIScope>(Scope), {
Name, NameLen}, {LinkageName, LinkageNameLen},
809 unwrapDI<DIFile>(
File), LineNo, unwrapDI<DISubroutineType>(Ty), ScopeLine,
819 return wrap(
unwrap(Builder)->createLexicalBlock(unwrapDI<DIScope>(Scope),
820 unwrapDI<DIFile>(File),
828 unsigned Discriminator) {
829 return wrap(
unwrap(Builder)->createLexicalBlockFile(unwrapDI<DIScope>(Scope),
830 unwrapDI<DIFile>(File),
841 unwrapDI<DINamespace>(NS),
842 unwrapDI<DIFile>(File),
853 unwrapDI<DIScope>(Scope),
854 unwrapDI<DIImportedEntity>(ImportedEntity),
855 unwrapDI<DIFile>(File), Line));
865 unwrapDI<DIModule>(M),
866 unwrapDI<DIFile>(File),
876 const char *
Name,
size_t NameLen) {
877 return wrap(
unwrap(Builder)->createImportedDeclaration(
878 unwrapDI<DIScope>(Scope),
879 unwrapDI<DINode>(Decl),
880 unwrapDI<DIFile>(File), Line, {
Name, NameLen}));
892 return unwrapDI<DILocation>(Location)->getLine();
896 return unwrapDI<DILocation>(Location)->getColumn();
900 return wrap(unwrapDI<DILocation>(Location)->getScope());
904 return wrap(unwrapDI<DILocation>(Location)->getInlinedAt());
908 return wrap(unwrapDI<DIScope>(Scope)->getFile());
912 auto Dir = unwrapDI<DIFile>(
File)->getDirectory();
924 if (
auto Src = unwrapDI<DIFile>(File)->getSource()) {
936 const char *
Name,
size_t NameLen,
937 const char *
Value,
size_t ValueLen) {
939 unwrap(Builder)->createMacro(unwrapDI<DIMacroFile>(ParentMacroFile), Line,
940 static_cast<MacinfoRecordType>(RecordType),
948 return wrap(
unwrap(Builder)->createTempMacroFile(
949 unwrapDI<DIMacroFile>(ParentMacroFile), Line, unwrapDI<DIFile>(File)));
953 const char *
Name,
size_t NameLen,
965 auto Elts =
unwrap(Builder)->getOrCreateArray({
unwrap(Elements),
967 return wrap(
unwrap(Builder)->createEnumerationType(
968 unwrapDI<DIScope>(Scope), {
Name, NameLen}, unwrapDI<DIFile>(
File),
969 LineNumber, SizeInBits, AlignInBits, Elts, unwrapDI<DIType>(ClassTy)));
977 const char *UniqueId,
size_t UniqueIdLen) {
978 auto Elts =
unwrap(Builder)->getOrCreateArray({
unwrap(Elements),
981 unwrapDI<DIScope>(Scope), {
Name, NameLen}, unwrapDI<DIFile>(
File),
983 Elts, RunTimeLang, {UniqueId, UniqueIdLen}));
991 unsigned NumSubscripts) {
992 auto Subs =
unwrap(Builder)->getOrCreateArray({
unwrap(Subscripts),
994 return wrap(
unwrap(Builder)->createArrayType(Size, AlignInBits,
995 unwrapDI<DIType>(Ty), Subs));
1002 unsigned NumSubscripts) {
1003 auto Subs =
unwrap(Builder)->getOrCreateArray({
unwrap(Subscripts),
1005 return wrap(
unwrap(Builder)->createVectorType(Size, AlignInBits,
1006 unwrapDI<DIType>(Ty), Subs));
1011 size_t NameLen, uint64_t SizeInBits,
1015 SizeInBits, Encoding,
1022 const char *
Name,
size_t NameLen) {
1023 return wrap(
unwrap(Builder)->createPointerType(unwrapDI<DIType>(PointeeTy),
1024 SizeInBits, AlignInBits,
1025 AddressSpace, {
Name, NameLen}));
1033 unsigned NumElements,
unsigned RunTimeLang,
LLVMMetadataRef VTableHolder,
1034 const char *UniqueId,
size_t UniqueIdLen) {
1035 auto Elts =
unwrap(Builder)->getOrCreateArray({
unwrap(Elements),
1037 return wrap(
unwrap(Builder)->createStructType(
1038 unwrapDI<DIScope>(Scope), {
Name, NameLen}, unwrapDI<DIFile>(
File),
1040 unwrapDI<DIType>(DerivedFrom), Elts, RunTimeLang,
1041 unwrapDI<DIType>(VTableHolder), {UniqueId, UniqueIdLen}));
1049 return wrap(
unwrap(Builder)->createMemberType(unwrapDI<DIScope>(Scope),
1050 {
Name, NameLen}, unwrapDI<DIFile>(
File), LineNo, SizeInBits, AlignInBits,
1057 return wrap(
unwrap(Builder)->createUnspecifiedType({
Name, NameLen}));
1066 return wrap(
unwrap(Builder)->createStaticMemberType(
1067 unwrapDI<DIScope>(Scope), {
Name, NameLen},
1068 unwrapDI<DIFile>(
File), LineNumber, unwrapDI<DIType>(Type),
1075 const char *
Name,
size_t NameLen,
1077 uint64_t SizeInBits,
uint32_t AlignInBits,
1081 {
Name, NameLen}, unwrapDI<DIFile>(
File), LineNo,
1082 SizeInBits, AlignInBits, OffsetInBits,
1084 unwrapDI<MDNode>(PropertyNode)));
1089 const char *
Name,
size_t NameLen,
1091 const char *GetterName,
size_t GetterNameLen,
1092 const char *SetterName,
size_t SetterNameLen,
1093 unsigned PropertyAttributes,
1095 return wrap(
unwrap(Builder)->createObjCProperty(
1096 {
Name, NameLen}, unwrapDI<DIFile>(
File), LineNo,
1097 {GetterName, GetterNameLen}, {SetterName, SetterNameLen},
1098 PropertyAttributes, unwrapDI<DIType>(Ty)));
1104 return wrap(
unwrap(Builder)->createObjectPointerType(unwrapDI<DIType>(Type)));
1109 const char *
Name,
size_t NameLen,
1113 unwrapDI<DIType>(Type), {
Name, NameLen}, unwrapDI<DIFile>(
File), LineNo,
1114 unwrapDI<DIScope>(Scope), AlignInBits));
1120 uint64_t BaseOffset,
uint32_t VBPtrOffset,
1122 return wrap(
unwrap(Builder)->createInheritance(
1123 unwrapDI<DIType>(Ty), unwrapDI<DIType>(BaseTy),
1131 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
1132 const char *UniqueIdentifier,
size_t UniqueIdentifierLen) {
1133 return wrap(
unwrap(Builder)->createForwardDecl(
1134 Tag, {
Name, NameLen}, unwrapDI<DIScope>(
Scope),
1135 unwrapDI<DIFile>(File), Line, RuntimeLang, SizeInBits,
1136 AlignInBits, {UniqueIdentifier, UniqueIdentifierLen}));
1143 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
1145 size_t UniqueIdentifierLen) {
1146 return wrap(
unwrap(Builder)->createReplaceableCompositeType(
1147 Tag, {
Name, NameLen}, unwrapDI<DIScope>(
Scope),
1148 unwrapDI<DIFile>(File), Line, RuntimeLang, SizeInBits,
1150 {UniqueIdentifier, UniqueIdentifierLen}));
1156 return wrap(
unwrap(Builder)->createQualifiedType(Tag,
1157 unwrapDI<DIType>(Type)));
1163 return wrap(
unwrap(Builder)->createReferenceType(Tag,
1164 unwrapDI<DIType>(Type)));
1169 return wrap(
unwrap(Builder)->createNullPtrType());
1176 uint64_t SizeInBits,
1179 return wrap(
unwrap(Builder)->createMemberPointerType(
1180 unwrapDI<DIType>(PointeeType),
1181 unwrapDI<DIType>(ClassType), AlignInBits, SizeInBits,
1188 const char *
Name,
size_t NameLen,
1190 uint64_t SizeInBits,
1191 uint64_t OffsetInBits,
1192 uint64_t StorageOffsetInBits,
1194 return wrap(
unwrap(Builder)->createBitFieldMemberType(
1195 unwrapDI<DIScope>(Scope), {
Name, NameLen},
1196 unwrapDI<DIFile>(
File), LineNumber,
1197 SizeInBits, OffsetInBits, StorageOffsetInBits,
1208 const char *UniqueIdentifier,
size_t UniqueIdentifierLen) {
1209 auto Elts =
unwrap(Builder)->getOrCreateArray({
unwrap(Elements),
1211 return wrap(
unwrap(Builder)->createClassType(
1212 unwrapDI<DIScope>(Scope), {
Name, NameLen},
1213 unwrapDI<DIFile>(
File), LineNumber,
1214 SizeInBits, AlignInBits, OffsetInBits,
1216 Elts, unwrapDI<DIType>(VTableHolder),
1217 unwrapDI<MDNode>(TemplateParamsNode),
1218 {UniqueIdentifier, UniqueIdentifierLen}));
1224 return wrap(
unwrap(Builder)->createArtificialType(unwrapDI<DIType>(Type)));
1229 *Length = Str.
size();
1238 return unwrapDI<DIType>(DType)->getOffsetInBits();
1242 return unwrapDI<DIType>(DType)->getAlignInBits();
1246 return unwrapDI<DIType>(DType)->getLine();
1257 unwrap(Builder)->getOrCreateTypeArray({
unwrap(Types), Length}).
get());
1264 unsigned NumParameterTypes,
1266 auto Elts =
unwrap(Builder)->getOrCreateTypeArray({
unwrap(ParameterTypes),
1267 NumParameterTypes});
1268 return wrap(
unwrap(Builder)->createSubroutineType(
1273 int64_t *Addr,
size_t Length) {
1281 return wrap(
unwrap(Builder)->createConstantValueExpression(Value));
1289 return wrap(
unwrap(Builder)->createGlobalVariableExpression(
1290 unwrapDI<DIScope>(Scope), {
Name, NameLen}, {
Linkage, LinkLen},
1291 unwrapDI<DIFile>(
File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1292 true, unwrap<DIExpression>(Expr), unwrapDI<MDNode>(Decl),
1293 nullptr, AlignInBits));
1297 return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getVariable());
1302 return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getExpression());
1306 return wrap(unwrapDI<DIVariable>(Var)->getFile());
1310 return wrap(unwrapDI<DIVariable>(Var)->getScope());
1314 return unwrapDI<DIVariable>(Var)->getLine();
1329 auto *Node = unwrapDI<MDNode>(TargetMetadata);
1330 Node->replaceAllUsesWith(unwrap<Metadata>(Replacement));
1339 return wrap(
unwrap(Builder)->createTempGlobalVariableFwdDecl(
1340 unwrapDI<DIScope>(Scope), {
Name, NameLen}, {
Linkage, LnkLen},
1341 unwrapDI<DIFile>(
File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1342 unwrapDI<MDNode>(Decl),
nullptr, AlignInBits));
1350 unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
1351 unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
1352 unwrap<Instruction>(Instr)));
1359 unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
1360 unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
1370 return wrap(
unwrap(Builder)->insertDbgValueIntrinsic(
1371 unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1372 unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
1373 unwrap<Instruction>(Instr)));
1382 return wrap(
unwrap(Builder)->insertDbgValueIntrinsic(
1383 unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1384 unwrap<DIExpression>(Expr), unwrap<DILocation>(DebugLoc),
1392 return wrap(
unwrap(Builder)->createAutoVariable(
1393 unwrap<DIScope>(Scope), {
Name, NameLen}, unwrap<DIFile>(
File),
1394 LineNo, unwrap<DIType>(Ty), AlwaysPreserve,
1402 return wrap(
unwrap(Builder)->createParameterVariable(
1403 unwrap<DIScope>(Scope), {
Name, NameLen}, ArgNo, unwrap<DIFile>(
File),
1404 LineNo, unwrap<DIType>(Ty), AlwaysPreserve,
1409 int64_t
Lo, int64_t Count) {
1410 return wrap(
unwrap(Builder)->getOrCreateSubrange(Lo, Count));
1417 return wrap(
unwrap(Builder)->getOrCreateArray({DataValue, Length}).
get());
1425 unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP));
1429 return unwrapDI<DISubprogram>(Subprogram)->getLine();
1438 unwrap<Instruction>(Inst)->setDebugLoc(
DebugLoc(unwrap<MDNode>(Loc)));
1440 unwrap<Instruction>(Inst)->setDebugLoc(
DebugLoc());
1444 switch(
unwrap(Metadata)->getMetadataID()) {
1445 #define HANDLE_METADATA_LEAF(CLASS) \ 1446 case Metadata::CLASS##Kind: \ 1447 return (LLVMMetadataKind)LLVM##CLASS##MetadataKind; 1448 #include "llvm/IR/Metadata.def" Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
void processLocation(const Module &M, const DILocation *Loc)
Process debug info location.
LLVMMetadataRef LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen)
Create a DWARF unspecified type.
static void deleteTemporary(MDNode *N)
Deallocate a node created by getTemporary.
Tracking metadata reference owned by Metadata.
LLVMMetadataRef LLVMDIBuilderCreateUnionType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang, const char *UniqueId, size_t UniqueIdLen)
Create debugging information entry for a union.
LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, LLVMMetadataRef Type)
Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
DILocation * get() const
Get the underlying DILocation.
LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, LLVMMetadataRef Decl, uint32_t AlignInBits)
Create a new descriptor for the specified global variable that is temporary and meant to be RAUWed...
LLVMDWARFMacinfoRecordType
Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro.
LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts)
Create debugging information entry for an array.
This class represents lattice values for constants.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
unsigned getRuntimeVersion() const
A Module instance is used to store all the information related to an LLVM module. ...
LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder, LLVMMetadataRef *Types, size_t Length)
Create a type array.
unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef M)
The version of debug metadata that's present in the provided Module.
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...
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
unsigned getSizeInBits(Register Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode)
Deallocate a temporary node.
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Implements a dense probed hash-table based set.
void push_back(const T &Elt)
LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata)
Obtain the enumerated type of a Metadata instance.
static SmallString< 128 > getFilename(const DISubprogram *SP)
Extract a filename for a DISubprogram.
named_metadata_iterator named_metadata_end()
static DINode::DIFlags map_from_llvmDIFlags(LLVMDIFlags Flags)
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
LLVMMetadataRef LLVMDIBuilderCreateFunction(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool IsLocalToUnit, LLVMBool IsDefinition, unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized)
Create a new descriptor for the specified subprogram.
unsigned getDebugMetadataVersionFromModule(const Module &M)
Return Debug Info Metadata Version by checking module flags.
DICompositeTypeArray getEnumTypes() const
void reset()
Clear all lists.
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line)
Create a descriptor for an imported module that aliases another imported entity descriptor.
uint64_t getDWOId() const
struct LLVMOpaqueDIBuilder * LLVMDIBuilderRef
Represents an LLVM debug info builder.
LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block)
Insert a new llvm.dbg.value intrinsic call at the end of the given basic block.
bool stripDebugInfo(Function &F)
uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType)
Get the offset of this DIType in bits.
StringRef getProducer() const
void reserve(size_type N)
bool getDebugInfoForProfiling() const
LLVMMetadataRef LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentMacroFile, unsigned Line, LLVMMetadataRef File)
Create debugging information temporary entry for a macro file.
LLVMMetadataRef LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, LLVMMetadataRef Ty)
Create debugging information entry for a member.
op_iterator op_end() const
LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, uint64_t SizeInBits, LLVMDWARFTypeEncoding Encoding, LLVMDIFlags Flags)
Create debugging information entry for a basic type.
void processModule(const Module &M)
Process entire module and collect debug info anchors.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen, LLVMBool isOptimized, const char *Flags, size_t FlagsLen, unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, LLVMBool DebugInfoForProfiling)
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location)
Get the column number of this debug location.
LLVMMetadataRef LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo, const char *GetterName, size_t GetterNameLen, const char *SetterName, size_t SetterNameLen, unsigned PropertyAttributes, LLVMMetadataRef Ty)
Create debugging information entry for Objective-C property.
LLVMDWARFEmissionKind
The amount of debug information to emit.
LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements, unsigned NumElements, LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode, const char *UniqueIdentifier, size_t UniqueIdentifierLen)
Create debugging information entry for a class.
StringRef getSplitDebugFilename() const
StringRef getFlags() const
unsigned LLVMDWARFTypeEncoding
An LLVM DWARF type encoding.
Attribute unwrap(LLVMAttributeRef Attr)
LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements, unsigned NumElements, LLVMMetadataRef ClassTy)
Create debugging information entry for an enumeration.
LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags)
Create a new descriptor for a function parameter variable.
LLVMContext & getContext() const
Get the global data context.
void eraseFromParent()
Drop all references and remove the node from parent module.
LLVMMetadataRef LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder, int64_t Value)
Create a new descriptor for the specified variable that does not have an address, but does have a con...
The access may reference the value stored in memory.
LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location)
Get the "inline at" location associated with this debug location.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
static StringRef getName(Value *V)
unsigned LLVMDILocationGetLine(LLVMMetadataRef Location)
Get the line number of this debug location.
LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentMacroFile, unsigned Line, LLVMDWARFMacinfoRecordType RecordType, const char *Name, size_t NameLen, const char *Value, size_t ValueLen)
Create debugging information entry for a macro.
bool getRangesBaseAddress() const
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool stripNonLineTableDebugInfo(Module &M)
Downgrade the debug info in a module to contain only line table information.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Scope, uint32_t AlignInBits)
Create debugging information entry for a typedef.
op_iterator op_begin() const
static Optional< DebugNameTableKind > getNameTableKind(StringRef Str)
LLVMMetadataRef LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, LLVMDIFlags Flags, LLVMMetadataRef Type)
Create debugging information entry for a bit field member.
LLVMMetadataRef LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, const char *Name, size_t NameLen, LLVMBool ExportSymbols)
Creates a new descriptor for a namespace with the specified parent scope.
LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M)
Construct a builder for a module and collect unresolved nodes attached to the module in order to reso...
LLVMMetadataRef LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type)
Create debugging information entry for a c++ style reference or rvalue reference type.
op_range operands() const
LLVMContext & getContext() const
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
bool StripDebugInfo(Module &M)
Strip debug info in the module if it exists.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD size_t size() const
size - Get the string size.
LLVMMetadataRef LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder, LLVMMetadataRef Type)
Create a uniqued DIType* clone with FlagArtificial set.
LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace, const char *Name, size_t NameLen)
Create debugging information entry for a pointer.
LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M)
Construct a builder for a module, and do not allow for unresolved nodes attached to the module...
void prune(LinkGraph &G)
Removes dead symbols/blocks/addressables.
iterator find(const_arg_type_t< KeyT > Val)
DIMacroNodeArray getMacros() const
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Return a temporary node.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
void setSubprogram(DISubprogram *SP)
Set the attached subprogram.
LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType)
Get the flags associated with this DIType.
iterator_range< iterator > functions()
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
LLVMMetadataRef LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line, unsigned Column, LLVMMetadataRef Scope, LLVMMetadataRef InlinedAt)
Creates a new DebugLocation that describes a source location.
LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMBasicBlockRef Block)
Insert a new llvm.dbg.declare intrinsic call at the end of the given basic block. ...
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef NS, LLVMMetadataRef File, unsigned Line)
Create a descriptor for an imported namespace.
Import information from summary.
LLVM Basic Block Representation.
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.
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
Instrumentation for Order File
LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, const char *UniqueIdentifier, size_t UniqueIdentifierLen)
Create a temporary forward-declared type.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata *> MDs)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
unsigned LLVMDebugMetadataVersion()
The current debug metadata version number.
std::pair< iterator, bool > insert(const ValueT &V)
LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func)
Get the metadata of the subprogram attached to a function.
LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, unsigned Col)
Create a descriptor for a lexical block with the specified parent context.
LLVMMetadataRef LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, const char *Name, size_t NameLen, const char *ConfigMacros, size_t ConfigMacrosLen, const char *IncludePath, size_t IncludePathLen, const char *SysRoot, size_t SysRootLen)
Creates a new descriptor for a module with the specified parent scope.
unsigned LLVMDITypeGetLine(LLVMMetadataRef DType)
Get the source line where this DIType is declared.
A pair of DIGlobalVariable and DIExpression.
DIImportedEntityArray getImportedEntities() const
LLVMDWARFSourceLanguage
Source languages known by DWARF.
void processValue(const Module &M, const DbgValueInst *DVI)
Process DbgValueInst.
LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo, int64_t Count)
Create a descriptor for a value range.
DIScope * getScope() const
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, size_t Count)
Create a new temporary MDNode.
static DISubprogram::DISPFlags pack_into_DISPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMValueRef LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr)
Insert a new llvm.dbg.declare intrinsic call before the given instruction.
void processInstruction(const Module &M, const Instruction &I)
Process a single instruction and collect debug info anchors.
Base class for scope-like contexts.
void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TargetMetadata, LLVMMetadataRef Replacement)
Replace all uses of temporary metadata.
LLVMMetadataRef LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeType, LLVMMetadataRef ClassType, uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags)
Create debugging information entry for a pointer to member.
const char * LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len)
Get the directory of a given file.
LLVMMetadataRef LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder)
Create C++11 nullptr type.
LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var)
Get the metadata of the file associated with a given variable.
const char * LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len)
Get the source of a given file.
unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram)
Get the line associated with a given subprogram.
DIT * unwrapDI(LLVMMetadataRef Ref)
Iterator for intrusive lists based on ilist_node.
LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, size_t FilenameLen, const char *Directory, size_t DirectoryLen)
Create a file descriptor to hold debugging information for a file.
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M, LLVMMetadataRef File, unsigned Line)
Create a descriptor for an imported module.
StringRef getName() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr)
Insert a new llvm.dbg.value intrinsic call before the given instruction.
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
DIScope * getScope() const
LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits)
Create a new descriptor for a local auto variable.
static uint32_t getFlags(const Symbol *Sym)
LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst)
Get the debug location for the given instruction.
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE)
Retrieves the DIVariable associated with this global variable expression.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
void applyMergedLocation(const DILocation *LocA, const DILocation *LocB)
Merge 2 debug locations and apply it to the Instruction.
LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location)
Get the local scope associated with this debug location.
LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder, LLVMMetadataRef *Data, size_t Length)
Create an array of DI Nodes.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
unsigned getSourceLanguage() const
void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder)
Construct any deferred debug info descriptors.
uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType)
Get the alignment of this DIType in bits.
StringRef getName() const
DIGlobalVariableExpressionArray getGlobalVariables() const
LLVMMetadataRef LLVMDIBuilderCreateStructType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder, const char *UniqueId, size_t UniqueIdLen)
Create debugging information entry for a struct.
uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType)
Get the size of this DIType in bits.
bool getSplitDebugInlining() const
static LLVMDIFlags map_to_llvmDIFlags(DINode::DIFlags Flags)
void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc)
Set the debug location for the given instruction.
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression(LLVMMetadataRef GVE)
Retrieves the DIExpression associated with this global variable expression.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
LLVMAttributeRef wrap(Attribute Attr)
LLVMMetadataRef LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder, LLVMMetadataRef File, LLVMMetadataRef *ParameterTypes, unsigned NumParameterTypes, LLVMDIFlags Flags)
Create subroutine type.
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.
LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, int64_t Value, LLVMBool IsUnsigned)
Create debugging information entry for an enumerator.
Linkage
Describes symbol linkage.
LLVM_NODISCARD bool empty() const
void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder)
Deallocates the DIBuilder and everything it owns.
This represents the llvm.dbg.value instruction.
void processDeclare(const Module &M, const DbgDeclareInst *DDI)
Process DbgDeclareInst.
void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP)
Set the subprogram attached to a function.
iterator_range< debug_compile_units_iterator > debug_compile_units() const
Return an iterator for all DICompileUnits listed in this Module's llvm.dbg.cu named metadata node and...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static unsigned map_from_llvmDWARFsourcelanguage(LLVMDWARFSourceLanguage lang)
DILocalVariable * getVariable() const
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef M)
Strip debug info in the module if it exists.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
DISPFlags
Debug info subprogram flags.
LLVMMetadataRef LLVMDIBuilderCreateStaticMemberType(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal, uint32_t AlignInBits)
Create debugging information entry for a C++ static data member.
LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits)
Create a new descriptor for the specified variable.
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
LLVMDIFlags
This file declares the C API endpoints for generating DWARF Debug Info.
LLVMMetadataRef LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder, LLVMMetadataRef Ty, LLVMMetadataRef BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, LLVMDIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types...
DIScopeArray getRetainedTypes() const
LLVMMetadataRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Discriminator)
Create a descriptor for a lexical block with a new file attached.
LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope)
Get the metadata of the file associated with a given scope.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static MDNode * stripDebugLocFromLoopID(MDNode *N)
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder, int64_t *Addr, size_t Length)
Create a new descriptor for the specified variable which has a complex address expression for its add...
LLVM Value Representation.
bool hasMetadata() const
Check if this has any metadata.
LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var)
Get the metadata of the scope associated with a given variable.
LLVMMetadataRef LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode)
Create debugging information entry for Objective-C instance variable.
iterator_range< global_iterator > globals()
StringRef - Represent a constant reference to a string, i.e.
LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, const char *UniqueIdentifier, size_t UniqueIdentifierLen)
Create a permanent forward-declared type.
unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var)
Get the source line where this DIVariable is declared.
unsigned getNumOperands() const
Return number of MDNode operands.
const char * LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length)
Get the name of this DIType.
const char * LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len)
Get the name of a given file.
LLVMMetadataRef LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts)
Create debugging information entry for a vector type.
This represents the llvm.dbg.declare instruction.
unsigned LLVMMetadataKind
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
LLVMMetadataRef LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type)
Create debugging information entry for a qualified type, e.g.
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
named_metadata_iterator named_metadata_begin()
LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl, LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen)
Create a descriptor for an imported function, type, or variable.