[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 11:53:11 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) {
+ TUIndex[TU.UniqueID] = TUCount++;
+ TypeUnits.push_back(TU.Label);
+ }
+
if (CompUnits.empty())
return;
Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfDebugNamesSection());
Contents.finalize(Asm, "names");
+ dwarf::Form CUIndexForm =
+ DIEInteger::BestForm(/*IsSigned*/ false, CompUnits.size() - 1);
+ dwarf::Form TUIndexForm =
+ DIEInteger::BestForm(/*IsSigned*/ false, TypeUnits.size() - 1);
Dwarf5AccelTableWriter<DWARF5AccelTableData>(
- Asm, Contents, CompUnits,
- [&](const DWARF5AccelTableData &Entry) {
- return CUIndex[Entry.getUnitID()];
+ Asm, Contents, CompUnits, TypeUnits,
+ [&](const DWARF5AccelTableData &Entry)
+ -> DWARF5AccelTableEntryReturnType {
+ if (Entry.isTU())
+ return {{TUIndex[Entry.getUnitID()],
+ {dwarf::DW_IDX_type_unit, TUIndexForm}}};
+ if (CUIndex.size() > 1)
----------------
dwblaikie wrote:
Should this just be `else`? Under what conditions does this code map neither a TU or a CU, and instead return nullopt? (is that codeptah tested? I would've thought every entry was either a CU or a TU and would get mapped - like we couldn't have a CU index entry while simultaneously having zero entries in CUIndex, right? That certainly seems to be how the old code worked, I think?)
https://github.com/llvm/llvm-project/pull/70515
More information about the llvm-commits
mailing list