59 #define DEBUG_TYPE "dwarfdebug"
63 cl::desc(
"Disable debug info printing"));
67 cl::desc(
"Generate GNU-style pubnames and pubtypes"),
81 cl::desc(
"Make an absence of debug location information explicit."),
88 cl::desc(
"Output prototype dwarf accelerator tables."),
96 cl::desc(
"Output DWARF5 split debug info."),
104 cl::desc(
"Generate DWARF pubnames and pubtypes sections"),
117 cl::desc(
"Which DWARF linkage-name attributes to emit."),
119 "Default for platform"),
122 "Abstract subprograms")),
145 unsigned MachineReg) {
153 assert(Var &&
"Invalid complex DbgVariable!");
187 uint16_t tag = Ty->
getTag();
189 if (tag == dwarf::DW_TAG_pointer_type)
190 subType = resolve(cast<DIDerivedType>(Ty)->getBaseType());
192 auto Elements = cast<DICompositeType>(subType)->getElements();
193 for (
unsigned i = 0,
N = Elements.size();
i <
N; ++
i) {
194 auto *DT = cast<DIDerivedType>(Elements[
i]);
195 if (
getName() == DT->getName())
196 return resolve(DT->getBaseType());
203 std::sort(FrameIndexExprs.
begin(), FrameIndexExprs.
end(),
204 [](
const FrameIndexExpr &
A,
const FrameIndexExpr &
B) ->
bool {
205 return A.Expr->getFragmentInfo()->OffsetInBits <
206 B.Expr->getFragmentInfo()->OffsetInBits;
208 return FrameIndexExprs;
218 InfoHolder(A,
"info_string", DIEValueAllocator),
219 SkeletonHolder(A,
"skel_string", DIEValueAllocator),
220 IsDarwin(A->
TM.getTargetTriple().isOSDarwin()),
222 dwarf::DW_FORM_data4)),
224 dwarf::DW_FORM_data4)),
226 dwarf::DW_FORM_data4)),
245 HasDwarfAccelTables = tuneForLLDB();
249 HasAppleExtensionAttributes = tuneForLLDB();
253 HasSplitDwarf =
false;
259 HasDwarfPubSections = tuneForGDB();
265 UseAllLinkageNames = !tuneForSCE();
270 unsigned DwarfVersion = DwarfVersionNumber ? DwarfVersionNumber
280 UseGNUTLSOpcode = tuneForGDB() || DwarfVersion < 3;
283 UseDWARF2Bitfields = (DwarfVersion < 4) || tuneForGDB();
323 if (!SP->isDefinition())
329 if (SP->getLinkageName() !=
"" && SP->
getName() != SP->getLinkageName())
356 if (Ranges.
size() > 1)
371 void DwarfDebug::constructAbstractSubprogramScopeDIE(
LexicalScope *Scope) {
378 ProcessedSPNodes.insert(SP);
382 auto &CU = *CUMap.lookup(SP->getUnit());
388 void DwarfDebug::addGnuPubAttributes(
DwarfUnit &U,
DIE &
D)
const {
392 U.
addFlag(D, dwarf::DW_AT_GNU_pubnames);
398 DwarfDebug::constructDwarfCompileUnit(
const DICompileUnit *DIUnit) {
402 auto OwnedUnit = make_unique<DwarfCompileUnit>(
403 InfoHolder.
getUnits().size(), DIUnit,
Asm,
this, &InfoHolder);
406 InfoHolder.
addUnit(std::move(OwnedUnit));
408 NewCU.setSkeleton(constructSkeletonCU(NewCU));
409 NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
417 if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU)
418 Asm->OutStreamer->getContext().setMCLineTableCompilationDir(
419 NewCU.getUniqueID(), CompilationDir);
421 NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit->
getProducer());
422 NewCU.addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
424 NewCU.addString(Die, dwarf::DW_AT_name, FN);
427 NewCU.initStmtList();
431 if (!CompilationDir.
empty())
432 NewCU.addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
434 addGnuPubAttributes(NewCU, Die);
439 NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
443 NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
446 NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
447 dwarf::DW_FORM_data1, RVer);
451 NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());
453 NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
457 NewCU.addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8,
461 NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
465 CUMap.insert({DIUnit, &NewCU});
466 CUDieMap.insert({&Die, &NewCU});
483 auto FragmentB =
B.Expr->getFragmentInfo();
484 if (FragmentA && FragmentB)
485 return FragmentA->OffsetInBits < FragmentB->OffsetInBits;
492 return A.
Expr ==
B.Expr;
513 SingleCU = NumDebugCUs == 1;
518 Global.getDebugInfo(GVs);
519 for (
auto *GVE : GVs)
520 GVMap[GVE->getVariable()].push_back({&Global, GVE->getExpression()});
525 for (
auto *
IE : CUNode->getImportedEntities())
529 for (
auto *GVE : CUNode->getGlobalVariables())
530 GVMap[GVE->getVariable()].push_back({
nullptr, GVE->getExpression()});
532 for (
auto *GVE : CUNode->getGlobalVariables()) {
534 if (Processed.
insert(GV).second)
538 for (
auto *Ty : CUNode->getEnumTypes()) {
543 for (
auto *Ty : CUNode->getRetainedTypes()) {
546 if (
DIType *RT = dyn_cast<DIType>(Ty))
547 if (!RT->isExternalTypeRef())
553 for (
auto *
IE : CUNode->getImportedEntities())
554 constructAndAddImportedEntityDIE(CU,
IE);
558 void DwarfDebug::finishVariableDefinitions() {
559 for (
const auto &Var : ConcreteVariables) {
560 DIE *VariableDie = Var->getDIE();
568 InlinedVariable(Var->getVariable(), Var->getInlinedAt()));
569 if (AbsVar && AbsVar->
getDIE()) {
570 Unit->
addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin,
577 void DwarfDebug::finishSubprogramDefinitions() {
585 void DwarfDebug::finalizeModuleInfo() {
588 finishSubprogramDefinitions();
590 finishVariableDefinitions();
594 for (
const auto &
P : CUMap) {
595 auto &TheCU = *
P.second;
608 dwarf::DW_FORM_data8,
ID);
609 SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
610 dwarf::DW_FORM_data8,
ID);
616 SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
619 if (!SkCU->getRangeLists().empty()) {
621 SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
633 if (
unsigned NumRanges = TheCU.
getRanges().size()) {
645 auto *CUNode = cast<DICompileUnit>(
P.first);
647 if (CUNode->getMacros())
671 finalizeModuleInfo();
700 emitDebugAbbrevDWO();
703 AddrPool.
emit(*Asm, Asm->getObjFileLowering().getDwarfAddrSection());
710 emitAccelNamespaces();
715 if (HasDwarfPubSections) {
721 AbstractVariables.clear();
726 DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
730 auto I = AbstractVariables.find(Cleansed);
731 if (
I != AbstractVariables.end())
732 return I->second.get();
736 DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
738 return getExistingAbstractVariable(IV, Cleansed);
743 auto AbsDbgVariable = make_unique<DbgVariable>(Var,
nullptr);
745 AbstractVariables[Var] = std::move(AbsDbgVariable);
748 void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
749 const MDNode *ScopeNode) {
751 if (getExistingAbstractVariable(IV, Cleansed))
755 cast<DILocalScope>(ScopeNode)));
758 void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
759 InlinedVariable IV,
const MDNode *ScopeNode) {
761 if (getExistingAbstractVariable(IV, Cleansed))
766 createAbstractVariable(Cleansed, Scope);
770 void DwarfDebug::collectVariableInfoFromMFTable(
772 for (
const auto &
VI : Asm->MF->getVariableDbgInfo()) {
775 assert(
VI.Var->isValidLocationForIntrinsic(
VI.Loc) &&
776 "Expected inlined-at fields to agree");
778 InlinedVariable Var(
VI.Var,
VI.Loc->getInlinedAt());
786 ensureAbstractVariableIsCreatedIfScoped(Var, Scope->
getScopeNode());
787 auto RegVar = make_unique<DbgVariable>(Var.first, Var.second);
788 RegVar->initializeMMI(
VI.Expr,
VI.Slot);
790 ConcreteVariables.push_back(std::move(RegVar));
824 if (Begin == Next.Begin) {
825 auto *FirstExpr = cast<DIExpression>(Values[0].Expression);
826 auto *FirstNextExpr = cast<DIExpression>(Next.Values[0].Expression);
827 if (!FirstExpr->isFragment() || !FirstNextExpr->isFragment())
833 for (
unsigned i = 0, j = 0;
i < Values.size(); ++
i) {
834 for (; j < Next.Values.size(); ++j) {
836 cast<DIExpression>(Values[
i].Expression),
837 cast<DIExpression>(Next.Values[j].Expression));
884 for (
auto I = Ranges.
begin(),
E = Ranges.
end();
I !=
E; ++
I) {
901 OpenRanges.
erase(Last, OpenRanges.
end());
904 assert(StartLabel &&
"Forgot label before DBG_VALUE starting a range!");
909 else if (std::next(
I) == Ranges.
end())
910 EndLabel = Asm->getFunctionEnd();
913 assert(EndLabel &&
"Forgot label after instruction ending a range!");
915 DEBUG(
dbgs() <<
"DotDebugLoc: " << *Begin <<
"\n");
919 bool couldMerge =
false;
927 if (!DebugLoc.
empty())
935 if (OpenRanges.
size())
936 Loc.addValues(OpenRanges);
943 auto CurEntry = DebugLoc.
rbegin();
945 dbgs() << CurEntry->getValues().size() <<
" Values:\n";
946 for (
auto &
Value : CurEntry->getValues())
951 auto PrevEntry = std::next(CurEntry);
952 if (PrevEntry != DebugLoc.
rend() && PrevEntry->MergeRanges(*CurEntry))
958 InlinedVariable IV) {
959 ensureAbstractVariableIsCreatedIfScoped(IV, Scope.
getScopeNode());
960 ConcreteVariables.push_back(make_unique<DbgVariable>(IV.first, IV.second));
962 return ConcreteVariables.back().get();
982 collectVariableInfoFromMFTable(Processed);
985 InlinedVariable IV =
I.first;
986 if (Processed.
count(IV))
990 const auto &Ranges =
I.second;
1004 DbgVariable *RegVar = createConcreteVariable(*Scope, IV);
1011 if (Ranges.
size() == 1 &&
1023 buildLocationList(Entries, Ranges);
1029 static_cast<const Metadata *
>(IV.first->getType()));
1032 for (
auto &Entry : Entries)
1033 Entry.finalize(*Asm,
List, BT);
1038 if (Processed.
insert(InlinedVariable(DV,
nullptr)).second)
1040 createConcreteVariable(*Scope, InlinedVariable(DV,
nullptr));
1055 unsigned LastAsmLine =
1056 Asm->OutStreamer->
getContext().getCurrentDwarfLoc().getLine();
1064 if (LastAsmLine == 0 && DL.
getLine() != 0) {
1075 if (LastAsmLine == 0)
1092 const MDNode *Scope =
nullptr;
1093 unsigned Column = 0;
1098 recordSourceLine(0, Column, Scope, 0);
1130 for (
const auto &
MBB : *MF)
1131 for (
const auto &
MI :
MBB)
1134 return MI.getDebugLoc();
1169 auto *SP = cast<DISubprogram>(FnScope->
getScopeNode());
1173 "DICompileUnit missing from llvm.dbg.cu?");
1176 if (Asm->OutStreamer->hasRawTextSupport())
1178 Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
1180 Asm->OutStreamer->getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
1187 auto *SP =
L->getInlinedAtScope()->getSubprogram();
1195 "endFunction should be called with the same function as beginFunction");
1210 Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
1217 collectVariableInfo(TheCU, SP, ProcessedVars);
1220 TheCU.addRange(
RangeSpan(Asm->getFunctionBegin(), Asm->getFunctionEnd()));
1227 assert(DbgValues.empty());
1230 assert(AbstractVariables.empty());
1242 auto *SP = cast<DISubprogram>(AScope->getScopeNode());
1245 if (!ProcessedVars.
insert(InlinedVariable(DV,
nullptr)).second)
1247 ensureAbstractVariableIsCreated(InlinedVariable(DV,
nullptr),
1250 &&
"ensureAbstractVariableIsCreated inserted abstract scopes");
1252 constructAbstractSubprogramScopeDIE(AScope);
1255 ProcessedSPNodes.insert(SP);
1256 TheCU.constructSubprogramScopeDIE(SP, FnScope);
1257 if (
auto *SkelCU = TheCU.getSkeleton())
1259 TheCU.getCUNode()->getSplitDebugInlining())
1260 SkelCU->constructSubprogramScopeDIE(SP, FnScope);
1274 void DwarfDebug::recordSourceLine(
unsigned Line,
unsigned Col,
const MDNode *S,
1279 unsigned Discriminator = 0;
1280 if (
auto *Scope = cast_or_null<DIScope>(S)) {
1281 Fn = Scope->getFilename();
1282 Dir = Scope->getDirectory();
1283 if (
auto *LBF = dyn_cast<DILexicalBlockFile>(Scope))
1285 Discriminator = LBF->getDiscriminator();
1287 unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();
1289 .getOrCreateSourceID(Fn, Dir);
1291 Asm->OutStreamer->EmitDwarfLocDirective(Src, Line, Col, Flags, 0,
1300 void DwarfDebug::emitDebugInfo() {
1306 void DwarfDebug::emitAbbreviations() {
1309 Holder.
emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
1315 Asm->OutStreamer->SwitchSection(Section);
1322 void DwarfDebug::emitAccelNames() {
1323 emitAccel(AccelNames, Asm->getObjFileLowering().getDwarfAccelNamesSection(),
1329 void DwarfDebug::emitAccelObjC() {
1330 emitAccel(AccelObjC, Asm->getObjFileLowering().getDwarfAccelObjCSection(),
1335 void DwarfDebug::emitAccelNamespaces() {
1336 emitAccel(AccelNamespace,
1337 Asm->getObjFileLowering().getDwarfAccelNamespaceSection(),
1342 void DwarfDebug::emitAccelTypes() {
1343 emitAccel(AccelTypes, Asm->getObjFileLowering().getDwarfAccelTypesSection(),
1369 DIE &SpecDIE = SpecVal.getDIEEntry().getEntry();
1376 case dwarf::DW_TAG_class_type:
1377 case dwarf::DW_TAG_structure_type:
1378 case dwarf::DW_TAG_union_type:
1379 case dwarf::DW_TAG_enumeration_type:
1384 case dwarf::DW_TAG_typedef:
1385 case dwarf::DW_TAG_base_type:
1386 case dwarf::DW_TAG_subrange_type:
1388 case dwarf::DW_TAG_namespace:
1390 case dwarf::DW_TAG_subprogram:
1392 case dwarf::DW_TAG_variable:
1394 case dwarf::DW_TAG_enumerator:
1404 void DwarfDebug::emitDebugPubNames(
bool GnuStyle) {
1406 ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
1407 : Asm->getObjFileLowering().getDwarfPubNamesSection();
1409 emitDebugPubSection(GnuStyle, PSec,
"Names",
1413 void DwarfDebug::emitDebugPubSection(
1416 for (
const auto &NU : CUMap) {
1419 const auto &Globals = (TheU->*Accessor)();
1421 if (Globals.empty())
1428 Asm->OutStreamer->SwitchSection(PSec);
1431 Asm->OutStreamer->AddComment(
"Length of Public " + Name +
" Info");
1432 MCSymbol *BeginLabel = Asm->createTempSymbol(
"pub" + Name +
"_begin");
1433 MCSymbol *EndLabel = Asm->createTempSymbol(
"pub" + Name +
"_end");
1434 Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
1436 Asm->OutStreamer->EmitLabel(BeginLabel);
1438 Asm->OutStreamer->AddComment(
"DWARF Version");
1441 Asm->OutStreamer->AddComment(
"Offset of Compilation Unit Info");
1444 Asm->OutStreamer->AddComment(
"Compilation Unit Length");
1448 for (
const auto &GI : Globals) {
1449 const char *Name = GI.getKeyData();
1450 const DIE *Entity = GI.second;
1452 Asm->OutStreamer->AddComment(
"DIE offset");
1457 Asm->OutStreamer->AddComment(
1460 Asm->EmitInt8(Desc.
toBits());
1463 Asm->OutStreamer->AddComment(
"External Name");
1464 Asm->OutStreamer->EmitBytes(
StringRef(Name, GI.getKeyLength() + 1));
1467 Asm->OutStreamer->AddComment(
"End Mark");
1469 Asm->OutStreamer->EmitLabel(EndLabel);
1473 void DwarfDebug::emitDebugPubTypes(
bool GnuStyle) {
1475 ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
1476 : Asm->getObjFileLowering().getDwarfPubTypesSection();
1478 emitDebugPubSection(GnuStyle, PSec,
"Types",
1483 void DwarfDebug::emitDebugStr() {
1485 Holder.
emitStrings(Asm->getObjFileLowering().getDwarfStrSection());
1491 auto Comment = Comments.begin();
1492 auto End = Comments.end();
1493 for (uint8_t Byte : DebugLocs.
getBytes(Entry))
1494 Streamer.
EmitInt8(Byte, Comment != End ? *(Comment++) :
"");
1504 if (Value.
isInt()) {
1505 if (BT && (BT->
getEncoding() == dwarf::DW_ATE_signed ||
1531 if (Value.isFragment()) {
1535 }) &&
"all values are expected to be fragments");
1536 assert(std::is_sorted(Values.begin(), Values.end()) &&
1537 "fragments are expected to be sorted");
1539 for (
auto Fragment : Values)
1543 assert(Values.size() == 1 &&
"only fragments may have >1 value");
1546 DwarfExpr.finalize();
1551 Asm->OutStreamer->AddComment(
"Loc expr size");
1552 Asm->EmitInt16(DebugLocs.
getBytes(Entry).size());
1560 void DwarfDebug::emitDebugLoc() {
1562 Asm->OutStreamer->SwitchSection(
1563 Asm->getObjFileLowering().getDwarfLocSection());
1564 unsigned char Size = Asm->getDataLayout().getPointerSize();
1566 Asm->OutStreamer->EmitLabel(
List.Label);
1573 Asm->EmitLabelDifference(Entry.BeginSym, Base, Size);
1574 Asm->EmitLabelDifference(Entry.EndSym, Base, Size);
1576 Asm->OutStreamer->EmitSymbolValue(Entry.BeginSym, Size);
1577 Asm->OutStreamer->EmitSymbolValue(Entry.EndSym, Size);
1582 Asm->OutStreamer->EmitIntValue(0, Size);
1583 Asm->OutStreamer->EmitIntValue(0, Size);
1587 void DwarfDebug::emitDebugLocDWO() {
1588 Asm->OutStreamer->SwitchSection(
1589 Asm->getObjFileLowering().getDwarfLocDWOSection());
1591 Asm->OutStreamer->EmitLabel(
List.Label);
1598 unsigned idx = AddrPool.
getIndex(Entry.BeginSym);
1599 Asm->EmitULEB128(idx);
1600 Asm->EmitLabelDifference(Entry.EndSym, Entry.BeginSym, 4);
1614 void DwarfDebug::emitDebugARanges() {
1619 for (
const SymbolCU &SCU : ArangeLabels) {
1620 if (SCU.Sym->isInSection()) {
1622 MCSection *Section = &SCU.Sym->getSection();
1624 SectionMap[Section].push_back(SCU);
1629 SectionMap[
nullptr].push_back(SCU);
1635 for (
auto &
I : SectionMap) {
1638 if (List.
size() < 1)
1646 Span.
Start = Cur.Sym;
1649 Spans[Cur.CU].push_back(Span);
1657 unsigned IA = A.
Sym ? Asm->OutStreamer->GetSymbolOrder(A.
Sym) : 0;
1658 unsigned IB =
B.Sym ? Asm->OutStreamer->GetSymbolOrder(
B.Sym) : 0;
1670 List.push_back(
SymbolCU(
nullptr, Asm->OutStreamer->endSection(Section)));
1673 const MCSymbol *StartSym = List[0].Sym;
1674 for (
size_t n = 1, e = List.size(); n < e; n++) {
1675 const SymbolCU &Prev = List[n - 1];
1679 if (Cur.
CU != Prev.
CU) {
1681 Span.
Start = StartSym;
1684 Spans[Prev.
CU].push_back(Span);
1691 Asm->OutStreamer->SwitchSection(
1692 Asm->getObjFileLowering().getDwarfARangesSection());
1694 unsigned PtrSize = Asm->getDataLayout().getPointerSize();
1697 std::vector<DwarfCompileUnit *> CUs;
1698 for (
const auto &it : Spans) {
1704 std::sort(CUs.begin(), CUs.end(),
1711 std::vector<ArangeSpan> &List = Spans[CU];
1718 unsigned ContentSize =
1724 unsigned TupleSize = PtrSize * 2;
1730 ContentSize += Padding;
1731 ContentSize += (List.size() + 1) * TupleSize;
1734 Asm->OutStreamer->AddComment(
"Length of ARange Set");
1735 Asm->EmitInt32(ContentSize);
1736 Asm->OutStreamer->AddComment(
"DWARF Arange version number");
1738 Asm->OutStreamer->AddComment(
"Offset Into Debug Info Section");
1740 Asm->OutStreamer->AddComment(
"Address Size (in bytes)");
1741 Asm->EmitInt8(PtrSize);
1742 Asm->OutStreamer->AddComment(
"Segment Size (in bytes)");
1745 Asm->OutStreamer->emitFill(Padding, 0xff);
1748 Asm->EmitLabelReference(Span.Start, PtrSize);
1752 Asm->EmitLabelDifference(Span.End, Span.Start, PtrSize);
1756 uint64_t Size = SymSize[Span.Start];
1760 Asm->OutStreamer->EmitIntValue(Size, PtrSize);
1764 Asm->OutStreamer->AddComment(
"ARange terminator");
1765 Asm->OutStreamer->EmitIntValue(0, PtrSize);
1766 Asm->OutStreamer->EmitIntValue(0, PtrSize);
1771 void DwarfDebug::emitDebugRanges() {
1773 Asm->OutStreamer->SwitchSection(
1774 Asm->getObjFileLowering().getDwarfRangesSection());
1777 unsigned char Size = Asm->getDataLayout().getPointerSize();
1780 for (
const auto &
I : CUMap) {
1789 Asm->OutStreamer->EmitLabel(List.getSym());
1791 for (
const RangeSpan &Range : List.getRanges()) {
1792 const MCSymbol *Begin = Range.getStart();
1793 const MCSymbol *End = Range.getEnd();
1794 assert(Begin &&
"Range without a begin symbol?");
1795 assert(End &&
"Range without an end symbol?");
1797 Asm->EmitLabelDifference(Begin, Base, Size);
1798 Asm->EmitLabelDifference(End, Base, Size);
1800 Asm->OutStreamer->EmitSymbolValue(Begin, Size);
1801 Asm->OutStreamer->EmitSymbolValue(End, Size);
1806 Asm->OutStreamer->EmitIntValue(0, Size);
1807 Asm->OutStreamer->EmitIntValue(0, Size);
1812 void DwarfDebug::handleMacroNodes(DIMacroNodeArray Nodes,
DwarfCompileUnit &U) {
1813 for (
auto *MN : Nodes) {
1814 if (
auto *M = dyn_cast<DIMacro>(MN))
1816 else if (
auto *
F = dyn_cast<DIMacroFile>(MN))
1817 emitMacroFile(*
F, U);
1823 void DwarfDebug::emitMacro(
DIMacro &M) {
1825 Asm->EmitULEB128(M.
getLine());
1828 Asm->OutStreamer->EmitBytes(Name);
1829 if (!Value.
empty()) {
1832 Asm->OutStreamer->EmitBytes(Value);
1834 Asm->EmitInt8(
'\0');
1840 Asm->EmitULEB128(F.
getLine());
1844 Asm->EmitULEB128(FID);
1850 void DwarfDebug::emitDebugMacinfo() {
1852 Asm->OutStreamer->SwitchSection(
1853 Asm->getObjFileLowering().getDwarfMacinfoSection());
1855 for (
const auto &
P : CUMap) {
1856 auto &TheCU = *
P.second;
1859 auto *CUNode = cast<DICompileUnit>(
P.first);
1861 handleMacroNodes(CUNode->getMacros(), U);
1863 Asm->OutStreamer->AddComment(
"End Of Macro List Mark");
1869 void DwarfDebug::initSkeletonUnit(
const DwarfUnit &U,
DIE &Die,
1870 std::unique_ptr<DwarfCompileUnit> NewU) {
1871 NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
1874 if (!CompilationDir.
empty())
1875 NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
1877 addGnuPubAttributes(*NewU, Die);
1879 SkeletonHolder.
addUnit(std::move(NewU));
1887 auto OwnedUnit = make_unique<DwarfCompileUnit>(
1890 NewCU.
setSection(Asm->getObjFileLowering().getDwarfInfoSection());
1892 NewCU.initStmtList();
1894 initSkeletonUnit(CU, NewCU.
getUnitDie(), std::move(OwnedUnit));
1901 void DwarfDebug::emitDebugInfoDWO() {
1909 void DwarfDebug::emitDebugAbbrevDWO() {
1911 InfoHolder.
emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection());
1914 void DwarfDebug::emitDebugLineDWO() {
1916 Asm->OutStreamer->SwitchSection(
1917 Asm->getObjFileLowering().getDwarfLineDWOSection());
1924 void DwarfDebug::emitDebugStrDWO() {
1926 MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
1927 InfoHolder.
emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
1936 return &SplitTypeUnitFileTable;
1956 if (!TypeUnitsUnderConstruction.empty() && AddrPool.
hasBeenUsed())
1959 auto Ins = TypeSignatures.insert(std::make_pair(CTy, 0));
1965 bool TopLevelType = TypeUnitsUnderConstruction.empty();
1968 auto OwnedUnit = make_unique<DwarfTypeUnit>(CU,
Asm,
this, &InfoHolder,
1969 getDwoLineTable(CU));
1972 TypeUnitsUnderConstruction.emplace_back(std::move(OwnedUnit), CTy);
1974 NewTU.addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
1978 NewTU.setTypeSignature(Signature);
1979 Ins.first->second = Signature;
1982 NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesDWOSection());
1984 CU.applyStmtList(UnitDie);
1985 NewTU.setSection(Asm->getObjFileLowering().getDwarfTypesSection(Signature));
1988 NewTU.setType(NewTU.createTypeDIE(CTy));
1991 auto TypeUnitsToAdd = std::move(TypeUnitsUnderConstruction);
1992 TypeUnitsUnderConstruction.clear();
2001 for (
const auto &TU : TypeUnitsToAdd)
2002 TypeSignatures.erase(TU.second);
2008 CU.constructTypeDIE(RefDie, cast<DICompositeType>(CTy));
2014 for (
auto &TU : TypeUnitsToAdd) {
2015 InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
2019 CU.addDIETypeSignature(RefDie, Signature);
2051 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)
An object containing the capability of hashing and adding hash attributes onto a DIE.
uint64_t computeCUSignature(const DIE &Die)
Computes the CU signature.
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 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 bool validAtEntry(const MachineInstr *MInsn)
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
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
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.
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
DIMacroNodeArray getElements() const
void AddExpression(DIExpressionCursor &&Expr, unsigned FragmentOffsetInBits=0)
Emit all remaining operations in the DIExpressionCursor.
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 ...
bool AddMachineRegIndirect(const TargetRegisterInfo &TRI, unsigned MachineReg, int Offset=0)
Emit an indirect dwarf register operation for the given machine register.
SmallVectorImpl< InsnRange > & getRanges()
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
bool isCFIInstruction() const
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg) override
Return whether the given machine register is the frame register in the current function.
StringRef getName() const
static cl::opt< DefaultOnOff > SplitDwarf("split-dwarf", cl::Hidden, cl::desc("Output DWARF5 split debug info."), cl::values(clEnumVal(Default,"Default for platform"), clEnumVal(Enable,"Enabled"), clEnumVal(Disable,"Disabled")), cl::init(Default))
debug_compile_units_iterator debug_compile_units_end() const
LexicalScope - This class is used to track scope information.
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.
struct fuzzer::@269 Flags
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 applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
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.
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
const Module * getModule() const
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
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. ...
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.
#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.
void EmitSigned(int64_t Value) override
Emit a raw signed value.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
This class is used to track local variable information.
void setBaseAddress(const MCSymbol *Base)
void FinalizeTable(AsmPrinter *, StringRef)
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).
void EmitOp(uint8_t Op, const char *Comment=nullptr) override
Output a dwarf operand and an optional assembler comment.
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.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
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()
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
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
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
ArrayRef< char > getBytes(const Entry &E) const
const MachineBasicBlock * getParent() 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)
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)
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)
DwarfDebug(AsmPrinter *A, Module *M)
void endFunction(const MachineFunction *MF) override
Gather and emit post-function debug information.
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
void endFunction(const MachineFunction *MF) override
Gather post-function debug information.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
GDBIndexEntryLinkage Linkage
DIE::value_iterator addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
addSectionLabel - Add a Dwarf section label attribute data and value.
A pair of GlobalVariable and DIExpression.
DIE * constructImportedEntityDIE(const DIImportedEntity *Module)
Construct import_module DIE.
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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).
void dump() const
Support for debugging, callable in GDB: V->dump()
StringRef getDirectory() const
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 beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
void setDebugInfoAvailability(bool avail)
SectionKind getKind() const
uint16_t getLanguage() const
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)
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
void AddUnsignedConstant(uint64_t Value)
Emit an unsigned constant.
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 addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
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.
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var)
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
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 EmitUnsigned(uint64_t Value) override
Emit a raw unsigned value.
void addImportedEntity(const DIImportedEntity *IE)
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.
uint64_t read64le(const void *P)
void AddSignedConstant(int64_t Value)
Emit a signed constant.
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
size_type count(const ValueT &V) const
Return 1 if the specified key is in the set, 0 otherwise.
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
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 emitStrings(MCSection *StrSection, MCSection *OffsetSection=nullptr)
Emit all of the strings to the section given.
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.
bool AddMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, unsigned MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
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 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.
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.
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)
Builder for DebugLocStream entries.
bool isConstantFP() const
void addValues(ArrayRef< DebugLocEntry::Value > Vals)
debug_compile_units_iterator debug_compile_units_begin() const
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
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 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