58 #define DEBUG_TYPE "dwarfdebug"
62 cl::desc(
"Disable debug info printing"));
66 cl::desc(
"Generate GNU-style pubnames and pubtypes"),
84 cl::desc(
"Make an absence of debug location information explicit."),
91 cl::desc(
"Output prototype dwarf accelerator tables."),
99 cl::desc(
"Generate DWARF pubnames and pubtypes sections"),
112 cl::desc(
"Which DWARF linkage-name attributes to emit."),
114 "Default for platform"),
117 "Abstract subprograms")),
125 void DebugLocDwarfExpression::emitOp(uint8_t
Op,
const char *Comment) {
131 void DebugLocDwarfExpression::emitSigned(int64_t
Value) {
135 void DebugLocDwarfExpression::emitUnsigned(uint64_t Value) {
140 unsigned MachineReg) {
148 assert(Var &&
"Invalid complex DbgVariable!");
182 uint16_t tag = Ty->
getTag();
184 if (tag == dwarf::DW_TAG_pointer_type)
185 subType = resolve(cast<DIDerivedType>(Ty)->
getBaseType());
187 auto Elements = cast<DICompositeType>(subType)->getElements();
188 for (
unsigned i = 0,
N = Elements.size(); i <
N; ++i) {
189 auto *DT = cast<DIDerivedType>(Elements[i]);
190 if (
getName() == DT->getName())
191 return resolve(DT->getBaseType());
198 if (FrameIndexExprs.
size() == 1)
199 return FrameIndexExprs;
202 [](
const FrameIndexExpr &
A) {
return A.Expr->isFragment(); }) &&
203 "multiple FI expressions without DW_OP_LLVM_fragment");
205 [](
const FrameIndexExpr &
A,
const FrameIndexExpr &
B) ->
bool {
206 return A.Expr->getFragmentInfo()->OffsetInBits <
207 B.Expr->getFragmentInfo()->OffsetInBits;
209 return FrameIndexExprs;
219 InfoHolder(A,
"info_string", DIEValueAllocator),
220 SkeletonHolder(A,
"skel_string", DIEValueAllocator),
221 IsDarwin(A->
TM.getTargetTriple().isOSDarwin()),
223 dwarf::DW_FORM_data4)),
225 dwarf::DW_FORM_data4)),
227 dwarf::DW_FORM_data4)),
246 HasDwarfAccelTables = tuneForLLDB();
250 HasAppleExtensionAttributes = tuneForLLDB();
257 UseAllLinkageNames = !tuneForSCE();
262 unsigned DwarfVersion = DwarfVersionNumber ? DwarfVersionNumber
272 UseGNUTLSOpcode = tuneForGDB() || DwarfVersion < 3;
275 UseDWARF2Bitfields = (DwarfVersion < 4) || tuneForGDB();
315 if (!SP->isDefinition())
321 if (SP->getLinkageName() !=
"" && SP->
getName() != SP->getLinkageName())
348 if (Ranges.
size() > 1)
367 void DwarfDebug::constructAbstractSubprogramScopeDIE(
DwarfCompileUnit &SrcCU,
381 auto &CU = getOrCreateDwarfCompileUnit(SP->getUnit());
382 if (
auto *SkelCU = CU.getSkeleton()) {
384 .constructAbstractSubprogramScopeDIE(Scope);
385 if (CU.getCUNode()->getSplitDebugInlining())
386 SkelCU->constructAbstractSubprogramScopeDIE(Scope);
388 CU.constructAbstractSubprogramScopeDIE(Scope);
399 return tuneForGDB() && !includeMinimalInlineScopes;
408 U.
addFlag(D, dwarf::DW_AT_GNU_pubnames);
414 DwarfDebug::getOrCreateDwarfCompileUnit(
const DICompileUnit *DIUnit) {
415 if (
auto *CU = CUMap.lookup(DIUnit))
420 auto OwnedUnit = make_unique<DwarfCompileUnit>(
421 InfoHolder.
getUnits().size(), DIUnit,
Asm,
this, &InfoHolder);
424 InfoHolder.
addUnit(std::move(OwnedUnit));
426 NewCU.setSkeleton(constructSkeletonCU(NewCU));
427 NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
428 Asm->TM.Options.MCOptions.SplitDwarfFile);
435 if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU)
436 Asm->OutStreamer->getContext().setMCLineTableCompilationDir(
437 NewCU.getUniqueID(), CompilationDir);
441 if (!Flags.
empty()) {
442 std::string ProducerWithFlags = Producer.
str() +
" " + Flags.
str();
443 NewCU.addString(Die, dwarf::DW_AT_producer, ProducerWithFlags);
445 NewCU.addString(Die, dwarf::DW_AT_producer, Producer);
447 NewCU.addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
449 NewCU.addString(Die, dwarf::DW_AT_name, FN);
452 NewCU.initStmtList();
456 if (!CompilationDir.
empty())
457 NewCU.addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
459 addGnuPubAttributes(NewCU, Die);
464 NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
468 NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
471 NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
472 dwarf::DW_FORM_data1, RVer);
476 NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());
478 NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
482 NewCU.addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8,
486 NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
490 CUMap.insert({DIUnit, &NewCU});
491 CUDieMap.insert({&Die, &NewCU});
508 auto FragmentB =
B.Expr->getFragmentInfo();
509 if (FragmentA && FragmentB)
510 return FragmentA->OffsetInBits < FragmentB->OffsetInBits;
517 return A.
Expr ==
B.Expr;
538 SingleCU = NumDebugCUs == 1;
543 Global.getDebugInfo(GVs);
544 for (
auto *GVE : GVs)
545 GVMap[GVE->getVariable()].push_back({&Global, GVE->getExpression()});
549 if (CUNode->getEnumTypes().empty() && CUNode->getRetainedTypes().empty() &&
550 CUNode->getGlobalVariables().empty() &&
551 CUNode->getImportedEntities().empty() && CUNode->getMacros().empty())
555 for (
auto *
IE : CUNode->getImportedEntities())
559 for (
auto *GVE : CUNode->getGlobalVariables())
560 GVMap[GVE->getVariable()].push_back({
nullptr, GVE->getExpression()});
562 for (
auto *GVE : CUNode->getGlobalVariables()) {
564 if (Processed.
insert(GV).second)
568 for (
auto *Ty : CUNode->getEnumTypes()) {
573 for (
auto *Ty : CUNode->getRetainedTypes()) {
576 if (
DIType *RT = dyn_cast<DIType>(Ty))
582 for (
auto *
IE : CUNode->getImportedEntities())
583 constructAndAddImportedEntityDIE(CU,
IE);
587 void DwarfDebug::finishVariableDefinitions() {
588 for (
const auto &Var : ConcreteVariables) {
589 DIE *VariableDie = Var->getDIE();
600 void DwarfDebug::finishSubprogramDefinitions() {
604 getOrCreateDwarfCompileUnit(SP->getUnit()),
609 void DwarfDebug::finalizeModuleInfo() {
612 finishSubprogramDefinitions();
614 finishVariableDefinitions();
620 if (CUMap.size() > 1)
621 DWOName = Asm->TM.Options.MCOptions.SplitDwarfFile;
625 for (
const auto &
P : CUMap) {
626 auto &TheCU = *
P.second;
640 dwarf::DW_FORM_data8,
ID);
641 SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
642 dwarf::DW_FORM_data8,
ID);
648 SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
651 if (!SkCU->getRangeLists().empty()) {
653 SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
665 if (
unsigned NumRanges = TheCU.
getRanges().size()) {
677 auto *CUNode = cast<DICompileUnit>(
P.first);
679 if (CUNode->getMacros())
703 finalizeModuleInfo();
732 emitDebugAbbrevDWO();
735 AddrPool.
emit(*Asm, Asm->getObjFileLowering().getDwarfAddrSection());
742 emitAccelNamespaces();
758 void DwarfDebug::ensureAbstractVariableIsCreated(
DwarfCompileUnit &CU, InlinedVariable IV,
759 const MDNode *ScopeNode) {
765 cast<DILocalScope>(ScopeNode)));
768 void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
DwarfCompileUnit &CU,
769 InlinedVariable IV,
const MDNode *ScopeNode) {
779 void DwarfDebug::collectVariableInfoFromMFTable(
781 for (
const auto &
VI : Asm->MF->getVariableDbgInfo()) {
784 assert(
VI.Var->isValidLocationForIntrinsic(
VI.Loc) &&
785 "Expected inlined-at fields to agree");
787 InlinedVariable Var(
VI.Var,
VI.Loc->getInlinedAt());
795 ensureAbstractVariableIsCreatedIfScoped(TheCU, Var, Scope->
getScopeNode());
796 auto RegVar = make_unique<DbgVariable>(Var.first, Var.second);
797 RegVar->initializeMMI(
VI.Expr,
VI.Slot);
799 ConcreteVariables.push_back(std::move(RegVar));
833 if (Begin == Next.Begin) {
834 auto *FirstExpr = cast<DIExpression>(Values[0].Expression);
835 auto *FirstNextExpr = cast<DIExpression>(Next.Values[0].Expression);
836 if (!FirstExpr->isFragment() || !FirstNextExpr->isFragment())
842 for (
unsigned i = 0, j = 0; i < Values.size(); ++i) {
843 for (; j < Next.Values.size(); ++j) {
845 cast<DIExpression>(Values[i].Expression),
846 cast<DIExpression>(Next.Values[j].Expression));
893 for (
auto I = Ranges.
begin(),
E = Ranges.
end();
I !=
E; ++
I) {
910 OpenRanges.
erase(Last, OpenRanges.
end());
913 assert(StartLabel &&
"Forgot label before DBG_VALUE starting a range!");
918 else if (std::next(
I) == Ranges.
end())
919 EndLabel = Asm->getFunctionEnd();
922 assert(EndLabel &&
"Forgot label after instruction ending a range!");
924 DEBUG(
dbgs() <<
"DotDebugLoc: " << *Begin <<
"\n");
928 bool couldMerge =
false;
936 if (!DebugLoc.
empty())
944 if (OpenRanges.
size())
945 Loc.addValues(OpenRanges);
952 auto CurEntry = DebugLoc.
rbegin();
954 dbgs() << CurEntry->getValues().size() <<
" Values:\n";
955 for (
auto &Value : CurEntry->getValues())
960 auto PrevEntry = std::next(CurEntry);
961 if (PrevEntry != DebugLoc.
rend() && PrevEntry->MergeRanges(*CurEntry))
968 InlinedVariable IV) {
969 ensureAbstractVariableIsCreatedIfScoped(TheCU, IV, Scope.
getScopeNode());
970 ConcreteVariables.push_back(make_unique<DbgVariable>(IV.first, IV.second));
972 return ConcreteVariables.back().get();
990 if (LSRange.size() == 0)
994 const MachineInstr *LScopeBegin = LSRange.front().first;
999 for (++Pred; Pred != MBB->rend(); ++Pred) {
1002 auto PredDL = Pred->getDebugLoc();
1003 if (!PredDL || Pred->isMetaInstruction())
1007 if (
DL->getScope() == PredDL->getScope())
1010 if (!PredScope || LScope->dominates(PredScope))
1038 collectVariableInfoFromMFTable(TheCU, Processed);
1041 InlinedVariable IV =
I.first;
1042 if (Processed.
count(IV))
1046 const auto &Ranges =
I.second;
1060 DbgVariable *RegVar = createConcreteVariable(TheCU, *Scope, IV);
1066 if (Ranges.
size() == 1 &&
1077 buildLocationList(Entries, Ranges);
1083 static_cast<const Metadata *
>(IV.first->getType()));
1086 for (
auto &Entry : Entries)
1087 Entry.finalize(*Asm,
List, BT);
1092 if (Processed.
insert(InlinedVariable(DV,
nullptr)).second)
1094 createConcreteVariable(TheCU, *Scope, InlinedVariable(DV,
nullptr));
1113 unsigned LastAsmLine =
1114 Asm->OutStreamer->
getContext().getCurrentDwarfLoc().getLine();
1122 if (LastAsmLine == 0 && DL.
getLine() != 0) {
1133 if (LastAsmLine == 0)
1150 const MDNode *Scope =
nullptr;
1151 unsigned Column = 0;
1156 recordSourceLine(0, Column, Scope, 0);
1188 for (
const auto &MBB : *MF)
1189 for (
const auto &
MI : MBB)
1192 return MI.getDebugLoc();
1211 if (Asm->OutStreamer->hasRawTextSupport())
1213 Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
1215 Asm->OutStreamer->getContext().setDwarfCompileUnitID(CU.
getUniqueID());
1222 auto *SP =
PrologEndLoc->getInlinedAtScope()->getSubprogram();
1240 "endFunction should be called with the same function as beginFunction");
1243 Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
1250 collectVariableInfo(TheCU, SP, ProcessedVars);
1253 TheCU.addRange(
RangeSpan(Asm->getFunctionBegin(), Asm->getFunctionEnd()));
1258 if (!TheCU.getCUNode()->getDebugInfoForProfiling() &&
1272 auto *SP = cast<DISubprogram>(AScope->getScopeNode());
1275 if (!ProcessedVars.
insert(InlinedVariable(DV,
nullptr)).second)
1277 ensureAbstractVariableIsCreated(TheCU, InlinedVariable(DV,
nullptr),
1280 &&
"ensureAbstractVariableIsCreated inserted abstract scopes");
1282 constructAbstractSubprogramScopeDIE(TheCU, AScope);
1285 ProcessedSPNodes.insert(SP);
1286 TheCU.constructSubprogramScopeDIE(SP, FnScope);
1287 if (
auto *SkelCU = TheCU.getSkeleton())
1289 TheCU.getCUNode()->getSplitDebugInlining())
1290 SkelCU->constructSubprogramScopeDIE(SP, FnScope);
1303 void DwarfDebug::recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *S,
1308 unsigned Discriminator = 0;
1309 if (
auto *Scope = cast_or_null<DIScope>(S)) {
1310 Fn = Scope->getFilename();
1311 Dir = Scope->getDirectory();
1312 if (
auto *LBF = dyn_cast<DILexicalBlockFile>(Scope))
1314 Discriminator = LBF->getDiscriminator();
1316 unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();
1318 .getOrCreateSourceID(Fn, Dir);
1320 Asm->OutStreamer->EmitDwarfLocDirective(Src, Line, Col, Flags, 0,
1329 void DwarfDebug::emitDebugInfo() {
1335 void DwarfDebug::emitAbbreviations() {
1338 Holder.
emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
1344 Asm->OutStreamer->SwitchSection(Section);
1351 void DwarfDebug::emitAccelNames() {
1352 emitAccel(AccelNames, Asm->getObjFileLowering().getDwarfAccelNamesSection(),
1358 void DwarfDebug::emitAccelObjC() {
1359 emitAccel(AccelObjC, Asm->getObjFileLowering().getDwarfAccelObjCSection(),
1364 void DwarfDebug::emitAccelNamespaces() {
1365 emitAccel(AccelNamespace,
1366 Asm->getObjFileLowering().getDwarfAccelNamespaceSection(),
1371 void DwarfDebug::emitAccelTypes() {
1372 emitAccel(AccelTypes, Asm->getObjFileLowering().getDwarfAccelTypesSection(),
1402 if (Die->
getTag() == dwarf::DW_TAG_compile_unit)
1410 DIE &SpecDIE = SpecVal.getDIEEntry().getEntry();
1417 case dwarf::DW_TAG_class_type:
1418 case dwarf::DW_TAG_structure_type:
1419 case dwarf::DW_TAG_union_type:
1420 case dwarf::DW_TAG_enumeration_type:
1425 case dwarf::DW_TAG_typedef:
1426 case dwarf::DW_TAG_base_type:
1427 case dwarf::DW_TAG_subrange_type:
1429 case dwarf::DW_TAG_namespace:
1431 case dwarf::DW_TAG_subprogram:
1433 case dwarf::DW_TAG_variable:
1435 case dwarf::DW_TAG_enumerator:
1445 void DwarfDebug::emitDebugPubNames(
bool GnuStyle) {
1447 ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
1448 : Asm->getObjFileLowering().getDwarfPubNamesSection();
1450 emitDebugPubSection(GnuStyle, PSec,
"Names",
1454 void DwarfDebug::emitDebugPubSection(
1457 for (
const auto &NU : CUMap) {
1460 const auto &Globals = (TheU->*Accessor)();
1469 Asm->OutStreamer->SwitchSection(PSec);
1472 Asm->OutStreamer->AddComment(
"Length of Public " + Name +
" Info");
1473 MCSymbol *BeginLabel = Asm->createTempSymbol(
"pub" + Name +
"_begin");
1474 MCSymbol *EndLabel = Asm->createTempSymbol(
"pub" + Name +
"_end");
1475 Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
1477 Asm->OutStreamer->EmitLabel(BeginLabel);
1479 Asm->OutStreamer->AddComment(
"DWARF Version");
1482 Asm->OutStreamer->AddComment(
"Offset of Compilation Unit Info");
1485 Asm->OutStreamer->AddComment(
"Compilation Unit Length");
1489 for (
const auto &GI : Globals) {
1490 const char *Name = GI.getKeyData();
1491 const DIE *Entity = GI.second;
1493 Asm->OutStreamer->AddComment(
"DIE offset");
1498 Asm->OutStreamer->AddComment(
1501 Asm->EmitInt8(Desc.
toBits());
1504 Asm->OutStreamer->AddComment(
"External Name");
1505 Asm->OutStreamer->EmitBytes(
StringRef(Name, GI.getKeyLength() + 1));
1508 Asm->OutStreamer->AddComment(
"End Mark");
1510 Asm->OutStreamer->EmitLabel(EndLabel);
1514 void DwarfDebug::emitDebugPubTypes(
bool GnuStyle) {
1516 ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
1517 : Asm->getObjFileLowering().getDwarfPubTypesSection();
1519 emitDebugPubSection(GnuStyle, PSec,
"Types",
1524 void DwarfDebug::emitDebugStr() {
1526 Holder.
emitStrings(Asm->getObjFileLowering().getDwarfStrSection());
1532 auto Comment = Comments.begin();
1533 auto End = Comments.end();
1534 for (uint8_t Byte : DebugLocs.
getBytes(Entry))
1535 Streamer.
EmitInt8(Byte, Comment != End ? *(Comment++) :
"");
1546 if (Value.
isInt()) {
1547 if (BT && (BT->
getEncoding() == dwarf::DW_ATE_signed ||
1558 Ops.
push_back(dwarf::DW_OP_plus_uconst);
1581 if (Value.isFragment()) {
1585 }) &&
"all values are expected to be fragments");
1586 assert(std::is_sorted(Values.begin(), Values.end()) &&
1587 "fragments are expected to be sorted");
1589 for (
auto Fragment : Values)
1593 assert(Values.size() == 1 &&
"only fragments may have >1 value");
1596 DwarfExpr.finalize();
1601 Asm->OutStreamer->AddComment(
"Loc expr size");
1602 Asm->EmitInt16(DebugLocs.
getBytes(Entry).size());
1610 void DwarfDebug::emitDebugLoc() {
1615 Asm->OutStreamer->SwitchSection(
1616 Asm->getObjFileLowering().getDwarfLocSection());
1617 unsigned char Size = Asm->MAI->getCodePointerSize();
1619 Asm->OutStreamer->EmitLabel(
List.Label);
1626 Asm->EmitLabelDifference(Entry.BeginSym,
Base, Size);
1627 Asm->EmitLabelDifference(Entry.EndSym,
Base, Size);
1629 Asm->OutStreamer->EmitSymbolValue(Entry.BeginSym, Size);
1630 Asm->OutStreamer->EmitSymbolValue(Entry.EndSym, Size);
1635 Asm->OutStreamer->EmitIntValue(0, Size);
1636 Asm->OutStreamer->EmitIntValue(0, Size);
1640 void DwarfDebug::emitDebugLocDWO() {
1641 Asm->OutStreamer->SwitchSection(
1642 Asm->getObjFileLowering().getDwarfLocDWOSection());
1644 Asm->OutStreamer->EmitLabel(
List.Label);
1651 unsigned idx = AddrPool.
getIndex(Entry.BeginSym);
1652 Asm->EmitULEB128(idx);
1653 Asm->EmitLabelDifference(Entry.EndSym, Entry.BeginSym, 4);
1667 void DwarfDebug::emitDebugARanges() {
1672 for (
const SymbolCU &SCU : ArangeLabels) {
1673 if (SCU.Sym->isInSection()) {
1675 MCSection *Section = &SCU.Sym->getSection();
1677 SectionMap[Section].push_back(SCU);
1682 SectionMap[
nullptr].push_back(SCU);
1688 for (
auto &
I : SectionMap) {
1691 if (List.
size() < 1)
1699 Span.
Start = Cur.Sym;
1702 Spans[Cur.CU].push_back(Span);
1710 unsigned IA = A.
Sym ? Asm->OutStreamer->GetSymbolOrder(A.
Sym) : 0;
1711 unsigned IB =
B.Sym ? Asm->OutStreamer->GetSymbolOrder(
B.Sym) : 0;
1723 List.push_back(
SymbolCU(
nullptr, Asm->OutStreamer->endSection(Section)));
1726 const MCSymbol *StartSym = List[0].Sym;
1727 for (
size_t n = 1, e = List.size(); n < e; n++) {
1728 const SymbolCU &Prev = List[n - 1];
1732 if (Cur.
CU != Prev.
CU) {
1734 Span.
Start = StartSym;
1737 Spans[Prev.
CU].push_back(Span);
1744 Asm->OutStreamer->SwitchSection(
1745 Asm->getObjFileLowering().getDwarfARangesSection());
1747 unsigned PtrSize = Asm->MAI->getCodePointerSize();
1750 std::vector<DwarfCompileUnit *> CUs;
1751 for (
const auto &it : Spans) {
1764 std::vector<ArangeSpan> &List = Spans[CU];
1771 unsigned ContentSize =
1777 unsigned TupleSize = PtrSize * 2;
1783 ContentSize += Padding;
1784 ContentSize += (List.size() + 1) * TupleSize;
1787 Asm->OutStreamer->AddComment(
"Length of ARange Set");
1788 Asm->EmitInt32(ContentSize);
1789 Asm->OutStreamer->AddComment(
"DWARF Arange version number");
1791 Asm->OutStreamer->AddComment(
"Offset Into Debug Info Section");
1793 Asm->OutStreamer->AddComment(
"Address Size (in bytes)");
1794 Asm->EmitInt8(PtrSize);
1795 Asm->OutStreamer->AddComment(
"Segment Size (in bytes)");
1798 Asm->OutStreamer->emitFill(Padding, 0xff);
1801 Asm->EmitLabelReference(Span.Start, PtrSize);
1805 Asm->EmitLabelDifference(Span.End, Span.Start, PtrSize);
1809 uint64_t Size = SymSize[Span.Start];
1813 Asm->OutStreamer->EmitIntValue(Size, PtrSize);
1817 Asm->OutStreamer->AddComment(
"ARange terminator");
1818 Asm->OutStreamer->EmitIntValue(0, PtrSize);
1819 Asm->OutStreamer->EmitIntValue(0, PtrSize);
1824 void DwarfDebug::emitDebugRanges() {
1829 Asm->OutStreamer->SwitchSection(
1830 Asm->getObjFileLowering().getDwarfRangesSection());
1833 unsigned char Size = Asm->MAI->getCodePointerSize();
1836 for (
const auto &
I : CUMap) {
1845 Asm->OutStreamer->EmitLabel(List.getSym());
1847 for (
const RangeSpan &Range : List.getRanges()) {
1848 const MCSymbol *Begin = Range.getStart();
1849 const MCSymbol *End = Range.getEnd();
1850 assert(Begin &&
"Range without a begin symbol?");
1851 assert(End &&
"Range without an end symbol?");
1853 Asm->EmitLabelDifference(Begin,
Base, Size);
1854 Asm->EmitLabelDifference(End,
Base, Size);
1856 Asm->OutStreamer->EmitSymbolValue(Begin, Size);
1857 Asm->OutStreamer->EmitSymbolValue(End, Size);
1862 Asm->OutStreamer->EmitIntValue(0, Size);
1863 Asm->OutStreamer->EmitIntValue(0, Size);
1868 void DwarfDebug::handleMacroNodes(DIMacroNodeArray Nodes,
DwarfCompileUnit &U) {
1869 for (
auto *MN : Nodes) {
1870 if (
auto *M = dyn_cast<DIMacro>(MN))
1872 else if (
auto *
F = dyn_cast<DIMacroFile>(MN))
1873 emitMacroFile(*
F, U);
1879 void DwarfDebug::emitMacro(
DIMacro &M) {
1881 Asm->EmitULEB128(M.
getLine());
1884 Asm->OutStreamer->EmitBytes(Name);
1885 if (!Value.
empty()) {
1888 Asm->OutStreamer->EmitBytes(Value);
1890 Asm->EmitInt8(
'\0');
1896 Asm->EmitULEB128(F.
getLine());
1900 Asm->EmitULEB128(FID);
1906 void DwarfDebug::emitDebugMacinfo() {
1911 Asm->OutStreamer->SwitchSection(
1912 Asm->getObjFileLowering().getDwarfMacinfoSection());
1914 for (
const auto &
P : CUMap) {
1915 auto &TheCU = *
P.second;
1918 auto *CUNode = cast<DICompileUnit>(
P.first);
1920 handleMacroNodes(CUNode->getMacros(), U);
1922 Asm->OutStreamer->AddComment(
"End Of Macro List Mark");
1928 void DwarfDebug::initSkeletonUnit(
const DwarfUnit &U,
DIE &Die,
1929 std::unique_ptr<DwarfCompileUnit> NewU) {
1930 NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
1931 Asm->TM.Options.MCOptions.SplitDwarfFile);
1933 if (!CompilationDir.
empty())
1934 NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
1936 addGnuPubAttributes(*NewU, Die);
1938 SkeletonHolder.
addUnit(std::move(NewU));
1946 auto OwnedUnit = make_unique<DwarfCompileUnit>(
1949 NewCU.
setSection(Asm->getObjFileLowering().getDwarfInfoSection());
1951 NewCU.initStmtList();
1953 initSkeletonUnit(CU, NewCU.
getUnitDie(), std::move(OwnedUnit));
1960 void DwarfDebug::emitDebugInfoDWO() {
1968 void DwarfDebug::emitDebugAbbrevDWO() {
1970 InfoHolder.
emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection());
1973 void DwarfDebug::emitDebugLineDWO() {
1975 Asm->OutStreamer->SwitchSection(
1976 Asm->getObjFileLowering().getDwarfLineDWOSection());
1983 void DwarfDebug::emitDebugStrDWO() {
1985 MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
1986 InfoHolder.
emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
1995 return &SplitTypeUnitFileTable;
2006 return Result.
high();
2015 if (!TypeUnitsUnderConstruction.empty() && AddrPool.
hasBeenUsed())
2018 auto Ins = TypeSignatures.insert(std::make_pair(CTy, 0));
2024 bool TopLevelType = TypeUnitsUnderConstruction.empty();
2027 auto OwnedUnit = make_unique<DwarfTypeUnit>(CU,
Asm,
this, &InfoHolder,
2028 getDwoLineTable(CU));
2031 TypeUnitsUnderConstruction.emplace_back(std::move(OwnedUnit), CTy);
2033 NewTU.addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
2037 NewTU.setTypeSignature(Signature);
2038 Ins.first->second = Signature;
2041 NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesDWOSection());
2043 CU.applyStmtList(UnitDie);
2044 NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesSection(Signature));
2047 NewTU.setType(NewTU.createTypeDIE(CTy));
2050 auto TypeUnitsToAdd = std::move(TypeUnitsUnderConstruction);
2051 TypeUnitsUnderConstruction.clear();
2060 for (
const auto &TU : TypeUnitsToAdd)
2061 TypeSignatures.erase(TU.second);
2067 CU.constructTypeDIE(RefDie, cast<DICompositeType>(CTy));
2073 for (
auto &TU : TypeUnitsToAdd) {
2074 InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
2078 CU.addDIETypeSignature(RefDie, Signature);
2110 return Asm->OutStreamer->getContext().getDwarfVersion();
MachineLocation getLoc() const
void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry)
Emit the location for a debug loc entry, including the size header.
ArrayRef< Entry > getEntries(const List &L) const
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
An object containing the capability of hashing and adding hash attributes onto a DIE.
Builder for DebugLocStream lists.
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
const DILocalScope * getScopeNode() const
static cl::opt< bool > SplitDwarfCrossCuReferences("split-dwarf-cross-cu-references", cl::Hidden, cl::desc("Enable cross-cu references in DWO files"), cl::init(false))
static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU, const DIE *Die)
computeIndexValue - Compute the gdb index value for the DIE and CU.
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
static cl::opt< bool > GenerateGnuPubSections("generate-gnu-dwarf-pub-sections", cl::Hidden, cl::desc("Generate GNU-style pubnames and pubtypes"), cl::init(false))
static cl::opt< DefaultOnOff > DwarfAccelTables("dwarf-accel-tables", cl::Hidden, cl::desc("Output prototype dwarf accelerator tables."), cl::values(clEnumVal(Default,"Default for platform"), clEnumVal(Enable,"Enabled"), clEnumVal(Disable,"Disabled")), cl::init(Default))
static cl::opt< bool > DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden, cl::desc("Disable debug info printing"))
This struct describes location entries emitted in the .debug_loc section.
const DICompileUnit * getCUNode() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSection * getDwarfAddrSection() const
#define DWARF2_FLAG_PROLOGUE_END
MCTargetOptions MCOptions
Machine level options.
static SmallVectorImpl< DwarfCompileUnit::GlobalExpr > & sortGlobalExprs(SmallVectorImpl< DwarfCompileUnit::GlobalExpr > &GVEs)
Sort and unique GVEs by comparing their fragment offset.
MDNode * getScope() const
bool useAppleExtensionAttributes() const
void addUnsignedConstant(uint64_t Value)
Emit an unsigned constant.
const ConstantFP * getFPImm() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
StringRef getFlags() const
void setMemoryLocationKind()
Lock this down to become a memory location description.
auto remove_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly...
const ConstantFP * getConstantFP() const
BufferByteStreamer getStreamer()
Implements a dense probed hash-table based set.
std::string SplitDwarfFile
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
DIMacroNodeArray getElements() const
static cl::opt< DefaultOnOff > UnknownLocations("use-unknown-locations", cl::Hidden, cl::desc("Make an absence of debug location information explicit."), cl::values(clEnumVal(Default,"At top of block or after label"), clEnumVal(Enable,"In all cases"), clEnumVal(Disable,"Never")), cl::init(Default))
ArrayRef< std::string > getComments(const Entry &E) const
bool useDwarfAccelTables() const
Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup.
const MachineFunction * MF
The current machine function.
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
SmallVectorImpl< InsnRange > & getRanges()
static enum BaseType getBaseType(const Value *Val)
Return the baseType for Val which states whether Val is exclusively derived from constant/null, or not exclusively derived from constant.
void emit(AsmPrinter *, const MCSymbol *, DwarfDebug *)
DenseMap< LexicalScope *, SmallVector< DbgVariable *, 8 > > & getScopeVariables()
This class implements a map that also provides access to all stored values in a deterministic order...
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
static const char *const DbgTimerName
bool getSplitDebugInlining() const
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
StringRef getName() const
debug_compile_units_iterator debug_compile_units_end() const
LexicalScope - This class is used to track scope information.
DIE::value_iterator addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
const DILocation * getInlinedAt() const
const MachineInstr * CurMI
If nonnull, stores the current machine instruction we're processing.
MCSymbol * getMacroLabelBegin() const
DebuggerKind
Identify a debugger for "tuning" the debug info.
DIE * getOrCreateTypeDIE(const MDNode *N)
Find existing DIE or create new DIE for the given type.
void addAccelNamespace(StringRef Name, const DIE &Die)
uint64_t getDWOId() const
void initializeDbgValue(const MachineInstr *DbgValue)
Initialize from a DBG_VALUE instruction.
static const char *const DbgTimerDescription
const DIE * getUnitDie() const
Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to...
static cl::opt< DefaultOnOff > DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden, cl::desc("Generate DWARF pubnames and pubtypes sections"), cl::values(clEnumVal(Default,"Default for platform"), clEnumVal(Enable,"Enabled"), clEnumVal(Disable,"Disabled")), cl::init(Default))
const Triple & getTargetTriple() const
static cl::opt< bool > GenerateARangeSection("generate-arange-section", cl::Hidden, cl::desc("Generate dwarf aranges"), cl::init(false))
ArrayRef< FrameIndexExpr > getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
const StringMap< const DIE * > & getGlobalTypes() const
virtual void EmitULEB128(uint64_t DWord, const Twine &Comment="")=0
const DIExpression * getExpression() const
DebugLoc PrevInstLoc
Previous instruction's location information.
ArrayRef< LexicalScope * > getAbstractScopesList() const
getAbstractScopesList - Return a reference to list of abstract scopes.
#define DWARF2_FLAG_IS_STMT
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
LexicalScope * getOrCreateAbstractScope(const DILocalScope *Scope)
getOrCreateAbstractScope - Find or create an abstract lexical scope.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
DbgValueHistoryMap DbgValues
History of DBG_VALUE and clobber instructions for each user variable.
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
This class is basically a combination of TimeRegion and Timer.
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
const Module * getModule() const
APInt bitcastToAPInt() const
DwarfCompileUnit * getSkeleton() const
bool isLexicalScopeDIENull(LexicalScope *Scope)
A helper function to check whether the DIE for a given Scope is going to be null. ...
void finishVariableDefinition(const DbgVariable &Var)
StringRef getFilename() const
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
uint16_t getDwarfVersion() const
unsigned getMacinfoType() const
bool hasDebugInfo() const
Returns true if valid debug info is present.
virtual void EmitInt8(uint8_t Byte, const Twine &Comment="")=0
Holds a DIExpression and keeps track of how many operands have been consumed so far.
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die)
Computes the CU signature.
#define clEnumVal(ENUMVAL, DESC)
DwarfExpression implementation for .debug_loc entries.
LLVM_NODISCARD bool empty() const
LexicalScope * getCurrentFunctionScope() const
getCurrentFunctionScope - Return lexical scope for the current function.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
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...
Decsribes an entry of the various gnu_pub* debug sections.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static bool validThroughout(LexicalScopes &LScopes, const MachineInstr *DbgValue, const MachineInstr *RangeEnd)
Determine whether a singular DBG_VALUE is valid for the entirety of its enclosing lexical scope...
This class is used to track local variable information.
void setBaseAddress(const MCSymbol *Base)
void FinalizeTable(AsmPrinter *, StringRef)
bool isMetaInstruction() const
Return true if this instruction doesn't produce any output in the form of executable instructions...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void AddName(DwarfStringPoolEntryRef Name, const DIE *Die, char Flags=0)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
bool MergeValues(const DebugLocEntry &Next)
If this and Next are describing different pieces of the same variable, merge them by appending Next's...
static Optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
LexicalScope * findLexicalScope(const DILocation *DL)
findLexicalScope - Find lexical scope, either regular or inlined, for the given DebugLoc.
MCSection * getDwarfMacinfoSection() const
MCSymbol * getLabelBegin() const
const SmallVectorImpl< std::unique_ptr< DwarfCompileUnit > > & getUnits()
bool shareAcrossDWOCUs() const
element_iterator elements_begin() const
DIE & addChild(DIE *Child)
Add a child to the DIE.
dwarf::Tag getTag() const
bool isFragment() const
Return whether this is a piece of an aggregate variable.
const DIExpression * Expr
DIScope * getScope() const
ArrayRef< char > getBytes(const Entry &E) const
const MachineBasicBlock * getParent() const
bool includeMinimalInlineScopes() const
LexicalScope * findAbstractScope(const DILocalScope *N)
findAbstractScope - Find an abstract scope or return null.
static void forBothCUs(DwarfCompileUnit &CU, Func F)
bool isDebugValue() const
unsigned getRuntimeVersion() const
void addUnit(std::unique_ptr< DwarfCompileUnit > U)
Add a unit to the list of CUs.
ValuesClass values(OptsTy...Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
DebuggerKind DebuggerTuning
Which debugger to tune for.
This dwarf writer support class manages information associated with a source file.
DwarfStringPool & getStringPool()
Returns the string pool.
initializer< Ty > init(const Ty &Val)
element_iterator elements_end() const
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind)
void endModule() override
Emit all Dwarf sections that should come after the content.
const DIType * getType() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
StringRef getName() const
static bool fragmentsOverlap(const DIExpression *P1, const DIExpression *P2)
Determine whether two variable fragments overlap.
const MachineBasicBlock * PrevInstBB
static void getObjCClassCategory(StringRef In, StringRef &Class, StringRef &Category)
DbgVariable * getExistingAbstractVariable(InlinedVariable IV, const DILocalVariable *&Cleansed)
const SmallVectorImpl< RangeSpanList > & getRangeLists() const
getRangeLists - Get the vector of range lists.
void emit(AsmPrinter &Asm, MCSection *AddrSection)
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
DIEValue findAttribute(dwarf::Attribute Attribute) const
Find a value in the DIE with the attribute given.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
A structured debug information entry.
AsmPrinter * Asm
Target of debug info emission.
const MCSymbol * getBaseAddress() const
std::pair< iterator, bool > insert(const ValueT &V)
unsigned getSourceLanguage() const
TargetMachine & TM
Target machine description.
bool isCImm() const
isCImm - Test if this is a MO_CImmediate operand.
This class is intended to be used as a driving class for all asm writers.
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy)
Add a DIE to the set of types that we're going to pull into type units.
void emitUnits(bool UseOffsets)
Emit all of the units to the section listed with the given abbreviation section.
cl::opt< int > DwarfVersion("dwarf-version", cl::desc("Dwarf version"), cl::init(0))
void setCompilationDir(StringRef CompilationDir)
static const unsigned End
void addAccelType(StringRef Name, const DIE &Die, char Flags)
for(unsigned i=0, e=MI->getNumOperands();i!=e;++i)
DwarfDebug(AsmPrinter *A, Module *M)
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
unsigned getEncoding() const
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage)
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
bool isAbstractScope() const
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
GDBIndexEntryLinkage Linkage
bool hasDwarfPubSections(bool includeMinimalInlineScopes) const
A pair of GlobalVariable and DIExpression.
DIE * constructImportedEntityDIE(const DIImportedEntity *Module)
Construct import_module DIE.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Helper used to pair up a symbol and its DWARF compile unit.
iterator erase(const_iterator CI)
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned getDwarfVersion() const
Returns the Dwarf Version by checking module flags.
ArrayRef< List > getLists() const
StringRef OperationEncodingString(unsigned Encoding)
static const char *const DWARFGroupDescription
Triple - Helper class for working with autoconf configuration names.
DITypeRef getType() const
An imported module (C++ using directive or similar).
StringRef getDirectory() const
void addExpression(DIExpressionCursor &&Expr, unsigned FragmentOffsetInBits=0)
Emit all remaining operations in the DIExpressionCursor.
SmallVector< RangeSpan, 2 > takeRanges()
unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override
Look up the source ID with the given directory and source file names.
static DebugLoc findPrologueEndLoc(const MachineFunction *MF)
LexicalScope * findInlinedScope(const DILocalScope *N, const DILocation *IA)
findInlinedScope - Find an inlined scope for the given scope/inlined-at.
static bool hasObjCCategory(StringRef Name)
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
void setDebugInfoAvailability(bool avail)
SectionKind getKind() const
uint16_t getLanguage() const
void createAbstractVariable(const DILocalVariable *DV, LexicalScope *Scope)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual void EmitSLEB128(uint64_t DWord, const Twine &Comment="")=0
Module.h This file contains the declarations for the Module class.
void computeSizeAndOffsets()
Compute the size and offset of all the DIEs.
void beginModule()
Emit all Dwarf sections that should come prior to the content.
const SmallVectorImpl< RangeSpan > & getRanges() const
getRanges - Get the list of ranges for this unit.
static ManagedStatic< CodeViewErrorCategory > Category
unsigned getOffset() const
Get the compile/type unit relative offset of this DIE.
StringRef getName() const
MCSymbol * getBeginSymbol()
void addAccelName(StringRef Name, const DIE &Die)
const StringMap< const DIE * > & getGlobalNames() const
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry)
Emit an entry for the debug loc section.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
const ConstantInt * getCImm() const
bool isBlockByrefStruct() const
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Class for arbitrary precision integers.
DISubprogram * getSubprogram() const
Get the attached subprogram.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
void emitAbbrevs(MCSection *)
Emit a set of abbreviations to the specific section.
DebugLoc PrologEndLoc
This location indicates end of function prologue and beginning of function body.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
llvm_unreachable("Unknown RegBank!")
A single location or constant.
void finalize(const AsmPrinter &AP, DebugLocStream::ListBuilder &List, const DIBasicType *BT)
Lower this entry into a DWARF expression.
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
void addImportedEntity(const DIImportedEntity *IE)
static std::vector< std::string > Flags
Representation of each machine instruction.
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const
static StringRef getObjCMethodName(StringRef In)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void setSection(MCSection *Section)
Set the section that this DIEUnit will be emitted into.
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
LexicalScopes - This class provides interface to collect and use lexical scoping information from mac...
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
void endFunctionImpl(const MachineFunction *MF) override
Gather and emit post-function debug information.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool isPS4CPU() const
Tests whether the target is the PS4 CPU.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Base class for debug information backends.
static uint64_t makeTypeSignature(StringRef Identifier)
Perform an MD5 checksum of Identifier and return the lower 64 bits.
LLVMContext & getContext() const
void skippedNonDebugFunction() override
void emitStrings(MCSection *StrSection, MCSection *OffsetSection=nullptr)
Emit all of the strings to the section given.
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
void addDIETypeSignature(DIE &Die, uint64_t Signature)
Add a type's DW_AT_signature and set the declaration flag.
const APFloat & getValueAPF() const
void set(unsigned R)
Make this location a direct register location.
void addSubprogramNames(const DISubprogram *SP, DIE &Die)
std::vector< uint8_t > Unit
void addFragmentOffset(const DIExpression *Expr)
If applicable, emit an empty DW_OP_piece / DW_OP_bit_piece to advance to the fragment described by Ex...
unsigned getReg() const
getReg - Returns the register number.
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
reverse_iterator rbegin()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const char *const DWARFGroupName
bool isBlockByrefVariable() const
static int fragmentCmp(const DIExpression *P1, const DIExpression *P2)
Determine the relative position of the fragments described by P1 and P2.
LLVM Value Representation.
MCSection * getDwarfRangesSection() const
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, ByteStreamer &Streamer, const DebugLocEntry::Value &Value, DwarfExpression &DwarfExpr)
uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
static const DwarfAccelTable::Atom TypeAtoms[]
void addSignedConstant(int64_t Value)
Emit a signed constant.
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
std::string Hash(const Unit &U)
MachineModuleInfo * MMI
Collected machine module information.
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
iterator_range< global_iterator > globals()
void addAccelObjC(StringRef Name, const DIE &Die)
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
unsigned getUniqueID() const
bool TimePassesIsEnabled
If the user specifies the -time-passes argument on an LLVM tool command line then the value of this b...
static bool isObjCClass(StringRef Name)
void beginFunctionImpl(const MachineFunction *MF) override
Gather pre-function debug information.
Builder for DebugLocStream entries.
bool isConstantFP() const
void addValues(ArrayRef< DebugLocEntry::Value > Vals)
debug_compile_units_iterator debug_compile_units_begin() const
StringRef getProducer() const
void finishSubprogramDefinition(const DISubprogram *SP)
static cl::opt< LinkageNameOption > DwarfLinkageNames("dwarf-linkage-names", cl::Hidden, cl::desc("Which DWARF linkage-name attributes to emit."), cl::values(clEnumValN(DefaultLinkageNames,"Default","Default for platform"), clEnumValN(AllLinkageNames,"All","All"), clEnumValN(AbstractLinkageNames,"Abstract","Abstract subprograms")), cl::init(DefaultLinkageNames))
bool addMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, unsigned MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
bool empty()
empty - Return true if there is any lexical scope information available.
StringRef getValue() const
Basic type, like 'int' or 'float'.
unsigned getIndex(const MCSymbol *Sym, bool TLS=false)
Returns the index into the address pool with the given label/symbol.
StringRef getSplitDebugFilename() const