[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 16:40:09 PST 2023


================
@@ -562,36 +595,58 @@ void llvm::emitDWARF5AccelTable(
     default:
       continue;
     }
-    CUIndex[CU.index()] = Count++;
+    CUIndex[CU.index()] = CUCount++;
     assert(CU.index() == CU.value()->getUniqueID());
     const DwarfCompileUnit *MainCU =
         DD.useSplitDwarf() ? CU.value()->getSkeleton() : CU.value().get();
     CompUnits.push_back(MainCU->getLabelBegin());
   }
 
+  for (const auto &TU : TUSymbols) {
----------------
ayermolo wrote:

This goes back to my other comment on the counter. Because we can abandon constructing TUs and instead emit that information in CU the UniqueID for TU is not continuous. Because we set it's ID at DwarfTypeUnit creation in DwarfDebug::addDwarfTypeUnitType. 

```
auto OwnedUnit = std::make_unique<DwarfTypeUnit>(
      CU, Asm, this, &InfoHolder, NumTypeUnitsCreated++, getDwoLineTable(CU));
```
      
```
 // Types referencing entries in the address table cannot be placed in type
    // units.
    if (AddrPool.hasBeenUsed()) {
      AccelTypeUnitsDebugNames.clear();
      // Remove all the types built while building this type.
      // This is pessimistic as some of these types might not be dependent on
      // the type that used an address.
      for (const auto &TU : TypeUnitsToAdd)
        TypeSignatures.erase(TU.second);

      // Construct this type in the CU directly.
      // This is inefficient because all the dependent types will be rebuilt
      // from scratch, including building them in type units, discovering that
      // they depend on addresses, throwing them out and rebuilding them.
      setCurrentDWARF5AccelTable(DWARF5AccelTableKind::CU);
      CU.constructTypeDIE(RefDie, cast<DICompositeType>(CTy));
      return;
    }
```

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


More information about the llvm-commits mailing list