Go to the documentation of this file.
59 if (
auto *DII = dyn_cast<DbgVariableIntrinsic>(U))
60 if (DII->isAddressOfVariable())
70 if (
auto *DDI = dyn_cast<DbgDeclareInst>(DVI))
88 DbgValues.push_back(DVI);
94 if (EncounteredDbgValues.
insert(DVI).second)
95 DbgValues.push_back(DVI);
115 DbgUsers.push_back(DII);
117 for (
Metadata *
AL : L->getAllArgListUsers()) {
121 if (EncounteredDbgValues.
insert(DII).second)
122 DbgUsers.push_back(DII);
129 if (
auto *LocalScope = dyn_cast_or_null<DILocalScope>(
Scope))
148 for (
auto *
CU :
M.debug_compile_units())
149 processCompileUnit(
CU);
150 for (
auto &
F :
M.functions()) {
151 if (
auto *SP = cast_or_null<DISubprogram>(
F.getSubprogram()))
152 processSubprogram(SP);
157 processInstruction(
M,
I);
162 if (!addCompileUnit(
CU))
164 for (
auto DIG :
CU->getGlobalVariables()) {
165 if (!addGlobalVariable(DIG))
167 auto *GV = DIG->getVariable();
168 processScope(GV->getScope());
169 processType(GV->getType());
171 for (
auto *ET :
CU->getEnumTypes())
173 for (
auto *RT :
CU->getRetainedTypes())
174 if (
auto *
T = dyn_cast<DIType>(RT))
177 processSubprogram(cast<DISubprogram>(RT));
178 for (
auto *Import :
CU->getImportedEntities()) {
179 auto *Entity =
Import->getEntity();
180 if (
auto *
T = dyn_cast<DIType>(Entity))
182 else if (
auto *SP = dyn_cast<DISubprogram>(Entity))
183 processSubprogram(SP);
184 else if (
auto *NS = dyn_cast<DINamespace>(Entity))
185 processScope(NS->getScope());
186 else if (
auto *M = dyn_cast<DIModule>(Entity))
187 processScope(
M->getScope());
193 if (
auto *DVI = dyn_cast<DbgVariableIntrinsic>(&
I))
194 processVariable(
M, *DVI);
196 if (
auto DbgLoc =
I.getDebugLoc())
197 processLocation(
M, DbgLoc.get());
203 processScope(Loc->getScope());
204 processLocation(
M, Loc->getInlinedAt());
207 void DebugInfoFinder::processType(
DIType *DT) {
211 if (
auto *
ST = dyn_cast<DISubroutineType>(DT)) {
212 for (
DIType *Ref :
ST->getTypeArray())
216 if (
auto *DCT = dyn_cast<DICompositeType>(DT)) {
217 processType(DCT->getBaseType());
219 if (
auto *
T = dyn_cast<DIType>(
D))
221 else if (
auto *SP = dyn_cast<DISubprogram>(
D))
222 processSubprogram(SP);
226 if (
auto *DDT = dyn_cast<DIDerivedType>(DT)) {
227 processType(DDT->getBaseType());
234 if (
auto *Ty = dyn_cast<DIType>(
Scope)) {
238 if (
auto *
CU = dyn_cast<DICompileUnit>(
Scope)) {
242 if (
auto *SP = dyn_cast<DISubprogram>(
Scope)) {
243 processSubprogram(SP);
246 if (!addScope(
Scope))
248 if (
auto *LB = dyn_cast<DILexicalBlockBase>(
Scope)) {
249 processScope(LB->getScope());
250 }
else if (
auto *NS = dyn_cast<DINamespace>(
Scope)) {
251 processScope(NS->getScope());
252 }
else if (
auto *M = dyn_cast<DIModule>(
Scope)) {
253 processScope(
M->getScope());
258 if (!addSubprogram(SP))
269 processCompileUnit(SP->getUnit());
270 processType(SP->getType());
271 for (
auto *Element : SP->getTemplateParams()) {
272 if (
auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
273 processType(TType->getType());
274 }
else if (
auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
275 processType(TVal->getType());
286 auto *DV = dyn_cast<DILocalVariable>(
N);
290 if (!NodesSeen.insert(DV).second)
292 processScope(DV->getScope());
293 processType(DV->getType());
296 bool DebugInfoFinder::addType(
DIType *DT) {
300 if (!NodesSeen.insert(DT).second)
303 TYs.push_back(
const_cast<DIType *
>(DT));
310 if (!NodesSeen.insert(
CU).second)
318 if (!NodesSeen.insert(DIG).second)
329 if (!NodesSeen.insert(SP).second)
341 if (
Scope->getNumOperands() == 0)
343 if (!NodesSeen.insert(
Scope).second)
345 Scopes.push_back(
Scope);
352 "Loop ID needs at least one operand");
354 "Loop ID should refer to itself");
362 MDs.push_back(
nullptr);
363 else if (
Metadata *NewMD = Updater(MD))
364 MDs.push_back(NewMD);
375 MDNode *OrigLoopID =
I.getMetadata(LLVMContext::MD_loop);
379 I.setMetadata(LLVMContext::MD_loop, NewLoopID);
387 MDNode *
N = dyn_cast_or_null<MDNode>(MD);
390 if (isa<DILocation>(
N) || Reachable.
count(
N))
394 for (
auto &OpIt :
N->operands()) {
405 assert(!
N->operands().empty() &&
"Missing self reference?");
416 [&Visited, &DILocationReachable](
const MDOperand &
Op) {
417 return isDILocationReachable(
418 Visited, DILocationReachable, Op.get());
425 N->op_begin() + 1,
N->op_end(),
426 [&Visited, &DILocationReachable](
const MDOperand &
Op) {
427 return isDILocationReachable(Visited, DILocationReachable,
434 if (isa<DILocation>(MD) || DILocationReachable.
count(MD))
441 bool Changed =
false;
442 if (
F.hasMetadata(LLVMContext::MD_dbg)) {
444 F.setSubprogram(
nullptr);
450 if (isa<DbgInfoIntrinsic>(&
I)) {
455 if (
I.getDebugLoc()) {
459 if (
auto *LoopID =
I.getMetadata(LLVMContext::MD_loop)) {
460 auto *NewLoopID = LoopIDsMap.
lookup(LoopID);
463 if (NewLoopID != LoopID)
464 I.setMetadata(LLVMContext::MD_loop, NewLoopID);
467 if (
I.hasMetadataOtherThanDebugLoc())
468 I.setMetadata(
"heapallocsite",
nullptr);
475 bool Changed =
false;
480 if (NMD.getName().startswith(
"llvm.dbg.") ||
481 NMD.getName() ==
"llvm.gcov") {
482 NMD.eraseFromParent();
490 for (
auto &GV :
M.globals()) {
491 Changed |= GV.eraseMetadata(LLVMContext::MD_dbg);
495 Materializer->setStripDebugInfo();
503 class DebugTypeInfoRemoval {
508 MDNode *EmptySubroutineType;
532 auto Replacement = Replacements.find(M);
533 if (Replacement != Replacements.end())
534 return Replacement->second;
542 void traverseAndRemap(
MDNode *
N) { traverse(
N); }
547 auto *FileAndScope = cast_or_null<DIFile>(map(MDS->
getFile()));
550 auto *
Type = cast_or_null<DISubroutineType>(map(MDS->getType()));
552 cast_or_null<DIType>(map(MDS->getContainingType()));
553 auto *Unit = cast_or_null<DICompileUnit>(map(MDS->getUnit()));
554 auto Variables =
nullptr;
555 auto TemplateParams =
nullptr;
558 auto distinctMDSubprogram = [&]() {
561 FileAndScope, MDS->getLine(),
Type, MDS->getScopeLine(),
562 ContainingType, MDS->getVirtualIndex(), MDS->getThisAdjustment(),
563 MDS->getFlags(), MDS->getSPFlags(), Unit, TemplateParams, Declaration,
568 return distinctMDSubprogram();
572 FileAndScope, MDS->getLine(),
Type, MDS->getScopeLine(), ContainingType,
573 MDS->getVirtualIndex(), MDS->getThisAdjustment(), MDS->getFlags(),
574 MDS->getSPFlags(), Unit, TemplateParams, Declaration, Variables);
576 StringRef OldLinkageName = MDS->getLinkageName();
579 auto OrigLinkage = NewToLinkageName.find(NewMDS);
580 if (OrigLinkage != NewToLinkageName.end()) {
581 if (OrigLinkage->second == OldLinkageName)
587 return distinctMDSubprogram();
590 NewToLinkageName.insert({NewMDS, MDS->getLinkageName()});
600 auto *
File = cast_or_null<DIFile>(map(
CU->getFile()));
602 MDTuple *RetainedTypes =
nullptr;
603 MDTuple *GlobalVariables =
nullptr;
604 MDTuple *ImportedEntities =
nullptr;
606 CU->getContext(),
CU->getSourceLanguage(), File,
CU->getProducer(),
607 CU->isOptimized(),
CU->getFlags(),
CU->getRuntimeVersion(),
609 RetainedTypes, GlobalVariables, ImportedEntities,
CU->getMacros(),
610 CU->getDWOId(),
CU->getSplitDebugInlining(),
611 CU->getDebugInfoForProfiling(),
CU->getNameTableKind(),
612 CU->getRangesBaseAddress(),
CU->getSysRoot(),
CU->getSDK());
616 auto *
Scope = map(MLD->getScope());
617 auto *InlinedAt = map(MLD->getInlinedAt());
620 MLD->getColumn(),
Scope, InlinedAt);
629 for (
auto &
I :
N->operands())
631 Ops.push_back(map(
I));
638 if (Replacements.count(
N))
644 if (
auto *MDSub = dyn_cast<DISubprogram>(
N)) {
645 remap(MDSub->getUnit());
646 return getReplacementSubprogram(MDSub);
648 if (isa<DISubroutineType>(
N))
649 return EmptySubroutineType;
650 if (
auto *
CU = dyn_cast<DICompileUnit>(
N))
651 return getReplacementCU(
CU);
654 if (
auto *MDLB = dyn_cast<DILexicalBlockBase>(
N))
656 return mapNode(MDLB->getScope());
657 if (
auto *MLD = dyn_cast<DILocation>(
N))
658 return getReplacementMDLocation(MLD);
665 return getReplacementMDNode(
N);
667 Replacements[
N] = doRemap(
N);
676 void DebugTypeInfoRemoval::traverse(
MDNode *
N) {
677 if (!
N || Replacements.count(
N))
683 if (
auto *MDS = dyn_cast<DISubprogram>(Parent))
684 return Child == MDS->getRetainedNodes().
get();
692 ToVisit.push_back(
N);
693 while (!ToVisit.empty()) {
694 auto *
N = ToVisit.back();
695 if (!Opened.
insert(
N).second) {
701 for (
auto &
I :
N->operands())
702 if (
auto *MDN = dyn_cast_or_null<MDNode>(
I))
703 if (!Opened.
count(MDN) && !Replacements.count(MDN) && !
prune(
N, MDN) &&
704 !isa<DICompileUnit>(MDN))
705 ToVisit.push_back(MDN);
710 bool Changed =
false;
714 if (
auto *DbgVal =
M.getFunction(
Name)) {
715 while (!DbgVal->use_empty())
716 cast<Instruction>(DbgVal->user_back())->eraseFromParent();
717 DbgVal->eraseFromParent();
721 RemoveUses(
"llvm.dbg.addr");
722 RemoveUses(
"llvm.dbg.declare");
723 RemoveUses(
"llvm.dbg.label");
724 RemoveUses(
"llvm.dbg.value");
727 for (
auto NMI =
M.named_metadata_begin(), NME =
M.named_metadata_end();
732 if (NMD->
getName() ==
"llvm.dbg.cu")
737 for (
auto &GV :
M.globals())
738 GV.eraseMetadata(LLVMContext::MD_dbg);
740 DebugTypeInfoRemoval Mapper(
M.getContext());
744 Mapper.traverseAndRemap(Node);
745 auto *NewNode = Mapper.mapNode(Node);
746 Changed |= Node != NewNode;
754 if (
auto *SP =
F.getSubprogram()) {
755 Mapper.traverseAndRemap(SP);
756 auto *NewSP = cast<DISubprogram>(Mapper.mapNode(SP));
757 Changed |= SP != NewSP;
758 F.setSubprogram(NewSP);
764 MDNode *InlinedAt =
DL.getInlinedAt();
766 InlinedAt = remap(InlinedAt);
772 I.setDebugLoc(remapDebugLoc(
I.getDebugLoc()));
776 if (
auto *Loc = dyn_cast_or_null<DILocation>(MD))
777 return remapDebugLoc(Loc).
get();
782 if (
I.hasMetadataOtherThanDebugLoc())
783 I.setMetadata(
"heapallocsite",
nullptr);
790 for (
auto &NMD :
M.getNamedMDList()) {
793 Ops.push_back(remap(
Op));
807 if (
auto *Val = mdconst::dyn_extract_or_null<ConstantInt>(
808 M.getModuleFlag(
"Debug Info Version")))
809 return Val->getZExtValue();
827 if (!isa<CallBase>(
this)) {
856 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
857 case LLVMDWARFSourceLanguage##NAME: \
859 #include "llvm/BinaryFormat/Dwarf.def"
860 #undef HANDLE_DW_LANG
866 return (DIT *)(
Ref ? unwrap<MDNode>(
Ref) :
nullptr);
912 unwrap(
Builder)->finalizeSubprogram(unwrapDI<DISubprogram>(subprogram));
918 LLVMBool isOptimized,
const char *Flags,
size_t FlagsLen,
919 unsigned RuntimeVer,
const char *SplitName,
size_t SplitNameLen,
921 LLVMBool DebugInfoForProfiling,
const char *SysRoot,
size_t SysRootLen,
922 const char *SDK,
size_t SDKLen) {
923 auto File = unwrapDI<DIFile>(FileRef);
928 RuntimeVer,
StringRef(SplitName, SplitNameLen),
930 SplitDebugInlining, DebugInfoForProfiling,
937 size_t FilenameLen,
const char *Directory,
938 size_t DirectoryLen) {
945 const char *
Name,
size_t NameLen,
946 const char *ConfigMacros,
size_t ConfigMacrosLen,
947 const char *IncludePath,
size_t IncludePathLen,
948 const char *APINotesFile,
size_t APINotesFileLen) {
951 StringRef(ConfigMacros, ConfigMacrosLen),
953 StringRef(APINotesFile, APINotesFileLen)));
958 const char *
Name,
size_t NameLen,
961 unwrapDI<DIScope>(ParentScope),
StringRef(
Name, NameLen), ExportSymbols));
966 size_t NameLen,
const char *LinkageName,
size_t LinkageNameLen,
972 unwrapDI<DIFile>(File), LineNo, unwrapDI<DISubroutineType>(Ty), ScopeLine,
983 unwrapDI<DIFile>(File),
991 unsigned Discriminator) {
993 unwrapDI<DIFile>(File),
1004 unwrapDI<DINamespace>(NS),
1005 unwrapDI<DIFile>(File),
1018 unwrapDI<DIScope>(
Scope), unwrapDI<DIImportedEntity>(ImportedEntity),
1019 unwrapDI<DIFile>(File), Line, Elts));
1025 unsigned NumElements) {
1031 unwrapDI<DIScope>(
Scope), unwrapDI<DIModule>(
M), unwrapDI<DIFile>(File),
1044 unwrapDI<DIScope>(
Scope), unwrapDI<DINode>(Decl), unwrapDI<DIFile>(File),
1045 Line, {
Name, NameLen}, Elts));
1057 return unwrapDI<DILocation>(Location)->getLine();
1061 return unwrapDI<DILocation>(Location)->getColumn();
1065 return wrap(unwrapDI<DILocation>(Location)->
getScope());
1069 return wrap(unwrapDI<DILocation>(Location)->getInlinedAt());
1073 return wrap(unwrapDI<DIScope>(
Scope)->getFile());
1077 auto Dir = unwrapDI<DIFile>(File)->getDirectory();
1083 auto Name = unwrapDI<DIFile>(File)->getFilename();
1089 if (
auto Src = unwrapDI<DIFile>(File)->getSource()) {
1101 const char *
Name,
size_t NameLen,
1102 const char *
Value,
size_t ValueLen) {
1104 unwrap(
Builder)->createMacro(unwrapDI<DIMacroFile>(ParentMacroFile), Line,
1114 unwrapDI<DIMacroFile>(ParentMacroFile), Line, unwrapDI<DIFile>(File)));
1118 const char *
Name,
size_t NameLen,
1133 unwrapDI<DIScope>(
Scope), {
Name, NameLen}, unwrapDI<DIFile>(File),
1134 LineNumber, SizeInBits, AlignInBits, Elts, unwrapDI<DIType>(ClassTy)));
1141 LLVMMetadataRef *Elements,
unsigned NumElements,
unsigned RunTimeLang,
1142 const char *UniqueId,
size_t UniqueIdLen) {
1146 unwrapDI<DIScope>(
Scope), {
Name, NameLen}, unwrapDI<DIFile>(File),
1148 Elts, RunTimeLang, {UniqueId, UniqueIdLen}));
1156 unsigned NumSubscripts) {
1160 unwrapDI<DIType>(Ty), Subs));
1167 unsigned NumSubscripts) {
1171 unwrapDI<DIType>(Ty), Subs));
1176 size_t NameLen,
uint64_t SizeInBits,
1180 SizeInBits, Encoding,
1187 const char *
Name,
size_t NameLen) {
1189 SizeInBits, AlignInBits,
1198 unsigned NumElements,
unsigned RunTimeLang,
LLVMMetadataRef VTableHolder,
1199 const char *UniqueId,
size_t UniqueIdLen) {
1203 unwrapDI<DIScope>(
Scope), {
Name, NameLen}, unwrapDI<DIFile>(File),
1205 unwrapDI<DIType>(DerivedFrom), Elts, RunTimeLang,
1206 unwrapDI<DIType>(VTableHolder), {UniqueId, UniqueIdLen}));
1215 {
Name, NameLen}, unwrapDI<DIFile>(File), LineNo, SizeInBits, AlignInBits,
1232 unwrapDI<DIScope>(
Scope), {
Name, NameLen},
1233 unwrapDI<DIFile>(File), LineNumber, unwrapDI<DIType>(
Type),
1240 const char *
Name,
size_t NameLen,
1246 {
Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
1247 SizeInBits, AlignInBits, OffsetInBits,
1249 unwrapDI<MDNode>(PropertyNode)));
1254 const char *
Name,
size_t NameLen,
1256 const char *GetterName,
size_t GetterNameLen,
1257 const char *SetterName,
size_t SetterNameLen,
1258 unsigned PropertyAttributes,
1261 {
Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
1262 {GetterName, GetterNameLen}, {SetterName, SetterNameLen},
1263 PropertyAttributes, unwrapDI<DIType>(Ty)));
1274 const char *
Name,
size_t NameLen,
1278 unwrapDI<DIType>(
Type), {
Name, NameLen}, unwrapDI<DIFile>(File), LineNo,
1279 unwrapDI<DIScope>(
Scope), AlignInBits));
1288 unwrapDI<DIType>(Ty), unwrapDI<DIType>(BaseTy),
1297 const char *UniqueIdentifier,
size_t UniqueIdentifierLen) {
1300 unwrapDI<DIFile>(File), Line, RuntimeLang, SizeInBits,
1301 AlignInBits, {UniqueIdentifier, UniqueIdentifierLen}));
1310 size_t UniqueIdentifierLen) {
1313 unwrapDI<DIFile>(File), Line, RuntimeLang, SizeInBits,
1315 {UniqueIdentifier, UniqueIdentifierLen}));
1322 unwrapDI<DIType>(
Type)));
1329 unwrapDI<DIType>(
Type)));
1345 unwrapDI<DIType>(PointeeType),
1346 unwrapDI<DIType>(ClassType), AlignInBits, SizeInBits,
1353 const char *
Name,
size_t NameLen,
1360 unwrapDI<DIScope>(
Scope), {
Name, NameLen},
1361 unwrapDI<DIFile>(File), LineNumber,
1362 SizeInBits, OffsetInBits, StorageOffsetInBits,
1373 const char *UniqueIdentifier,
size_t UniqueIdentifierLen) {
1377 unwrapDI<DIScope>(
Scope), {
Name, NameLen},
1378 unwrapDI<DIFile>(File), LineNumber,
1379 SizeInBits, AlignInBits, OffsetInBits,
1381 Elts, unwrapDI<DIType>(VTableHolder),
1382 unwrapDI<MDNode>(TemplateParamsNode),
1383 {UniqueIdentifier, UniqueIdentifierLen}));
1393 StringRef Str = unwrap<DIType>(DType)->getName();
1394 *Length = Str.size();
1399 return unwrapDI<DIType>(DType)->getSizeInBits();
1403 return unwrapDI<DIType>(DType)->getOffsetInBits();
1407 return unwrapDI<DIType>(DType)->getAlignInBits();
1411 return unwrapDI<DIType>(DType)->getLine();
1429 unsigned NumParameterTypes,
1432 NumParameterTypes});
1451 size_t NameLen,
const char *Linkage,
size_t LinkLen,
LLVMMetadataRef File,
1455 unwrapDI<DIScope>(
Scope), {
Name, NameLen}, {Linkage, LinkLen},
1456 unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1457 true, unwrap<DIExpression>(Expr), unwrapDI<MDNode>(Decl),
1458 nullptr, AlignInBits));
1462 return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getVariable());
1467 return wrap(unwrapDI<DIGlobalVariableExpression>(GVE)->getExpression());
1471 return wrap(unwrapDI<DIVariable>(Var)->getFile());
1479 return unwrapDI<DIVariable>(Var)->getLine();
1494 auto *Node = unwrapDI<MDNode>(TargetMetadata);
1495 Node->replaceAllUsesWith(unwrap<Metadata>(Replacement));
1501 size_t NameLen,
const char *Linkage,
size_t LnkLen,
LLVMMetadataRef File,
1505 unwrapDI<DIScope>(
Scope), {
Name, NameLen}, {Linkage, LnkLen},
1506 unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1507 unwrapDI<MDNode>(Decl),
nullptr, AlignInBits));
1515 unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
1516 unwrap<DIExpression>(Expr), unwrap<DILocation>(
DL),
1517 unwrap<Instruction>(Instr)));
1524 unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
1525 unwrap<DIExpression>(Expr), unwrap<DILocation>(
DL),
1536 unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1537 unwrap<DIExpression>(Expr), unwrap<DILocation>(
DebugLoc),
1538 unwrap<Instruction>(Instr)));
1548 unwrap(Val), unwrap<DILocalVariable>(VarInfo),
1549 unwrap<DIExpression>(Expr), unwrap<DILocation>(
DebugLoc),
1558 unwrap<DIScope>(
Scope), {
Name, NameLen}, unwrap<DIFile>(File),
1559 LineNo, unwrap<DIType>(Ty), AlwaysPreserve,
1565 size_t NameLen,
unsigned ArgNo,
LLVMMetadataRef File,
unsigned LineNo,
1568 unwrap<DIScope>(
Scope), {
Name, NameLen}, ArgNo, unwrap<DIFile>(File),
1569 LineNo, unwrap<DIType>(Ty), AlwaysPreserve,
1574 int64_t Lo, int64_t Count) {
1590 unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP));
1594 return unwrapDI<DISubprogram>(Subprogram)->getLine();
1603 unwrap<Instruction>(Inst)->setDebugLoc(
DebugLoc(unwrap<MDNode>(Loc)));
1605 unwrap<Instruction>(Inst)->setDebugLoc(
DebugLoc());
1610 #define HANDLE_METADATA_LEAF(CLASS) \
1611 case Metadata::CLASS##Kind: \
1612 return (LLVMMetadataKind)LLVM##CLASS##MetadataKind;
1613 #include "llvm/IR/Metadata.def"
unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location)
Get the column number of this debug location.
DIScope * getScope() const
uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType)
Get the offset of this DIType in bits.
@ LLVMGenericDINodeMetadataKind
LLVMMetadataRef LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentMacroFile, unsigned Line, LLVMMetadataRef File)
Create debugging information temporary entry for a macro 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.
bool StripDebugInfo(Module &M)
Strip debug info in the module if it exists.
This is an optimization pass for GlobalISel generic memory operations.
LLVMDWARFSourceLanguage
Source languages known by DWARF.
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope)
Get the metadata of the file associated with a given scope.
LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, unsigned Col)
Create a descriptor for a lexical block with the specified parent context.
uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType)
Get the alignment of this DIType in bits.
void reset()
Clear all lists.
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...
static Function * getFunction(Constant *C)
LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, LLVMMetadataRef Type)
Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
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...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...
DISubprogram * getSubprogram() const
Get the attached subprogram.
void findDbgUsers(SmallVectorImpl< DbgVariableIntrinsic * > &DbgInsts, Value *V)
Finds the debug info intrinsics describing a value.
LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst)
Get the debug location for the given instruction.
StringRef getName() const
LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, size_t Count)
Create a new temporary MDNode.
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression(LLVMMetadataRef GVE)
Retrieves the DIExpression associated with this global variable expression.
LLVMMetadataRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Discriminator)
Create a descriptor for a lexical block with a new file attached.
LLVMMetadataRef LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts)
Create debugging information entry for a vector type.
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements, unsigned NumElements)
Create a descriptor for an imported module that aliases another imported entity descriptor.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
The instances of the Type class are immutable: once they are created, they are never changed.
void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder)
Deallocates the DIBuilder and everything it owns.
void prune(LinkGraph &G)
Removes dead symbols/blocks/addressables.
DILocalVariable * getVariable() const
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.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
TinyPtrVector< DbgVariableIntrinsic * > FindDbgAddrUses(Value *V)
Finds all intrinsics declaring local variables as living in the memory that 'V' points to.
static unsigned map_from_llvmDWARFsourcelanguage(LLVMDWARFSourceLanguage lang)
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func)
Get the metadata of the subprogram attached to a function.
LLVMMetadataRef LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder, LLVMMetadataRef Type)
Create a uniqued DIType* clone with FlagArtificial set.
LLVM Basic Block Representation.
unsigned getNumOperands() const
Return number of MDNode operands.
LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef M)
Strip debug info in the module if it exists.
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef NS, LLVMMetadataRef File, unsigned Line)
Create a descriptor for an imported namespace.
LLVMMetadataRef LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type)
Create debugging information entry for a c++ style reference or rvalue reference type.
void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP)
Set the subprogram attached to a function.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts)
Create debugging information entry for an array.
@ Ref
The access may reference the value stored in memory.
This represents the llvm.dbg.value instruction.
unsigned LLVMDebugMetadataVersion()
The current debug metadata version number.
(vector float) vec_cmpeq(*A, *B) C
StringRef getName() const
LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder, LLVMMetadataRef *Types, size_t Length)
Create a type array.
unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram)
Get the line associated with a given subprogram.
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE)
Retrieves the DIVariable associated with this global variable expression.
void push_back(EltTy NewVal)
DISPFlags
Debug info subprogram flags.
struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef
Represents a basic block of instructions in LLVM IR.
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.
void applyMergedLocation(const DILocation *LocA, const DILocation *LocB)
Merge 2 debug locations and apply it to the Instruction.
void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TargetMetadata, LLVMMetadataRef Replacement)
Replace all uses of temporary metadata.
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.
static LLVMDIFlags map_to_llvmDIFlags(DINode::DIFlags Flags)
LLVMDIFlags
Debug info flags.
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.
LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, int64_t Value, LLVMBool IsUnsigned)
Create debugging information entry for an enumerator.
TinyPtrVector< DbgDeclareInst * > FindDbgDeclareUses(Value *V)
Like FindDbgAddrUses, but only returns dbg.declare intrinsics, not dbg.addr.
LLVMMetadataRef LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder, LLVMMetadataRef File, LLVMMetadataRef *ParameterTypes, unsigned NumParameterTypes, LLVMDIFlags Flags)
Create subroutine type.
Attribute unwrap(LLVMAttributeRef Attr)
bool stripDebugInfo(Function &F)
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.
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.
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.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, DINodeArray Elements, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
static MDNode * stripDebugLocFromLoopID(MDNode *N)
@ Import
Import information from summary.
uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType)
Get the size of this DIType in bits.
unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef M)
The version of debug metadata that's present in the provided Module.
DIT * unwrapDI(LLVMMetadataRef Ref)
LLVMMetadataRef LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name, size_t NameLen)
Create a DWARF unspecified type.
An efficient, type-erasing, non-owning reference to a callable.
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.
void processSubprogram(DISubprogram *SP)
Process subprogram.
const MDOperand & getOperand(unsigned I) const
Implements a dense probed hash-table based set.
LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location)
Get the "inline at" location associated with this debug location.
This is the common base class for debug info intrinsics for variables.
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, const char *SysRoot, size_t SysRootLen, const char *SDK, size_t SDKLen)
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
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 *APINotesFile, size_t APINotesFileLen)
Creates a new descriptor for a module with the specified parent scope.
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.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
LLVMDWARFEmissionKind
The amount of debug information to emit.
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
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.
const char * LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len)
Get the source of a given file.
LLVMMetadataRef LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type)
Create debugging information entry for a qualified type, e.g.
LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo, int64_t Count)
Create a descriptor for a value range.
unsigned LLVMDILocationGetLine(LLVMMetadataRef Location)
Get the line number of this debug location.
LLVMDWARFMacinfoRecordType
Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro.
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.
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.
This is an important class for using LLVM in a threaded context.
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.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
void findDbgValues(SmallVectorImpl< DbgValueInst * > &DbgValues, Value *V)
Finds the llvm.dbg.value intrinsics describing a value.
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
void updateLocationAfterHoist()
Updates the debug location given that the instruction has been hoisted from a block to a predecessor ...
void dropLocation()
Drop the instruction's debug location.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void processModule(const Module &M)
Process entire module and collect debug info anchors.
LLVMMetadataRef LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line, unsigned Column, LLVMMetadataRef Scope, LLVMMetadataRef InlinedAt)
Creates a new DebugLocation that describes a source location.
unsigned LLVMDITypeGetLine(LLVMMetadataRef DType)
Get the source line where this DIType is declared.
LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M)
Construct a builder for a module and collect unresolved nodes attached to the module in order to reso...
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.
unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var)
Get the source line where this DIVariable is declared.
A Module instance is used to store all the information related to an LLVM module.
LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl, LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen, LLVMMetadataRef *Elements, unsigned NumElements)
Create a descriptor for an imported function, type, or variable.
LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType)
Get the flags associated with this DIType.
LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder, LLVMMetadataRef *Data, size_t Length)
Create an array of DI Nodes.
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.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
void processLocation(const Module &M, const DILocation *Loc)
Process debug info location.
static bool isDILocationReachable(SmallPtrSetImpl< Metadata * > &Visited, SmallPtrSetImpl< Metadata * > &Reachable, Metadata *MD)
Return true if a node is a DILocation or if a DILocation is indirectly referenced by one of the node'...
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.
Type array for a subprogram.
LLVMAttributeRef wrap(Attribute Attr)
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.
DIScope * getScope() const
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
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.
StringRef - Represent a constant reference to a string, i.e.
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.
Tagged DWARF-like metadata node.
const char * LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len)
Get the directory of a given file.
static MDNode * updateLoopMetadataDebugLocationsImpl(MDNode *OrigLoopID, function_ref< Metadata *(Metadata *)> Updater)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void processVariable(const Module &M, const DbgVariableIntrinsic &DVI)
Process DbgVariableIntrinsic.
const char * LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length)
Get the name of this DIType.
LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var)
Get the metadata of the file associated with a given variable.
LLVMContext & getContext() const
All values hold a context through their type.
LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata)
Obtain the enumerated type of a Metadata instance.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
void updateLoopMetadataDebugLocations(Instruction &I, function_ref< Metadata *(Metadata *)> Updater)
Update the debug locations contained within the MD_loop metadata attached to the instruction I,...
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
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.
static DISubprogram::DISPFlags pack_into_DISPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized)
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.
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.
LLVMContext & getContext() const
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements, unsigned NumElements)
Create a descriptor for an imported module.
const char * LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len)
Get the name of a given file.
void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder)
Construct any deferred debug info descriptors.
Base class for scope-like contexts.
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.
Should compile to something r4 addze r3 instead we get
static uint32_t getFlags(const Symbol *Sym)
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.
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.
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.
static void deleteTemporary(MDNode *N)
Deallocate a node created by getTemporary.
A pair of DIGlobalVariable and DIExpression.
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
unsigned LLVMMetadataKind
struct LLVMOpaqueDIBuilder * LLVMDIBuilderRef
Represents an LLVM debug info builder.
LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var)
Get the metadata of the scope associated with a given variable.
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.
bool isUsedByMetadata() const
Return true if there is metadata referencing this value.
LLVMMetadataRef LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder)
Create C++11 nullptr type.
void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder, LLVMMetadataRef subprogram)
Finalize a specific subprogram.
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.
bool stripNonLineTableDebugInfo(Module &M)
Downgrade the debug info in a module to contain only line table information.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
LLVMMetadataRef LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder, uint64_t Value)
Create a new descriptor for the specified variable that does not have an address, but does have a con...
unsigned getDebugMetadataVersionFromModule(const Module &M)
Return Debug Info Metadata Version by checking module flags.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
unsigned LLVMDWARFTypeEncoding
An LLVM DWARF type encoding.
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
void processInstruction(const Module &M, const Instruction &I)
Process a single instruction and collect debug info anchors.
LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M)
Construct a builder for a module, and do not allow for unresolved nodes attached to the module.
void reserve(size_type N)
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder, uint64_t *Addr, size_t Length)
Create a new descriptor for the specified variable which has a complex address expression for its add...
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
static DINode::DIFlags map_from_llvmDIFlags(LLVMDIFlags Flags)
LLVM Value Representation.
iterator_range< user_iterator > users()
LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location)
Get the local scope associated with this debug location.
static SPIRV::Scope getScope(SyncScope::ID Ord)
void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode)
Deallocate a temporary node.
Tracking metadata reference owned by Metadata.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc)
Set the debug location for the given instruction.