[llvm] [AsmPrinter][DebugNames] Implement DW_IDX_parent entries (PR #77457)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 12:19:53 PST 2024


================
@@ -496,15 +549,32 @@ void Dwarf5AccelTableWriter::emitAbbrevs() const {
 }
 
 void Dwarf5AccelTableWriter::emitEntry(
-    const DWARF5AccelTableData &Entry) const {
+    const DWARF5AccelTableData &Entry,
+    const DenseMap<uint64_t, MCSymbol *> &DIEOffsetToAccelEntryLabel,
+    DenseSet<MCSymbol *> &EmittedAccelEntrySymbols) const {
   std::optional<DWARF5AccelTable::UnitIndexAndEncoding> EntryRet =
       getIndexForEntry(Entry);
-  uint32_t AbbrvTag = constructAbbreviationTag(Entry.getDieTag(), EntryRet);
+  std::optional<uint64_t> MaybeParentOffset = Entry.getParentDieOffset();
+  std::optional<dwarf::Form> MaybeParentForm =
+      getFormForIdxParent(IndexedOffsets, MaybeParentOffset);
+  uint32_t AbbrvTag =
+      constructAbbreviationTag(Entry.getDieTag(), EntryRet, MaybeParentForm);
   auto AbbrevIt = Abbreviations.find(AbbrvTag);
   assert(AbbrevIt != Abbreviations.end() &&
          "Why wasn't this abbrev generated?");
   assert(getTagFromAbbreviationTag(AbbrevIt->first) == Entry.getDieTag() &&
          "Invalid Tag");
+
+  auto EntrySymbolIt = DIEOffsetToAccelEntryLabel.find(Entry.getDieOffset());
----------------
ayermolo wrote:

Actually never mind. This will work for split-dwarf. Since there should be only one CU per module.
But I think collision is still possible with CU/TUs since offsets are relative to CU/TU, or with lto. I think multiple CUs can be in one module with that. 
Yeah I think UnitID should be combined with DIEOffset.

BTW there is a code that suppose to unique things, but I don't think it's working right now:
https://github.com/llvm/llvm-project/pull/74391
Need to circle back to it.

https://github.com/llvm/llvm-project/pull/77457


More information about the llvm-commits mailing list