[llvm] [RFC][BOLT] Add a new parallel DWARF processing(2/2) (PR #197859)
Jinjie Huang via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 00:46:52 PDT 2026
================
@@ -610,45 +718,146 @@ getDWONameMap(DWARFContext &DwCtx) {
}
return DWOIDToNameMap;
}
-void DWARFRewriter::updateDebugInfo() {
- ErrorOr<BinarySection &> DebugInfo = BC.getUniqueSectionByName(".debug_info");
- if (!DebugInfo)
+
+void DWARFRewriter::finalizeSkeletonAndStrSection(
+ DIEBuilder &PartDIEBlder, DWARFUnit &CU,
+ const std::unordered_map<uint64_t, std::string> &DWOToNameMap) {
+ const std::optional<uint64_t> DWOId = CU.getDWOId();
+ std::optional<DWARFUnit *> DWOCU = DWOId ? BC.getDWOCU(*DWOId) : std::nullopt;
+ const bool HasSplitCU = DWOCU && *DWOCU != nullptr;
+ const unsigned Version = CU.getVersion();
+
+ if (HasSplitCU) {
+ auto It = DWOToNameMap.find(*DWOId);
+ if (It != DWOToNameMap.end()) {
+ PartDIEBlder.updateDWONameCompDir(*StrOffstsWriter, *StrWriter, CU,
+ opts::DwarfOutputPath,
+ StringRef(It->second));
+ if (Version >= 5 && StrOffstsWriter->isStrOffsetsSectionModified())
+ StrOffstsWriter->finalizeSection(CU, PartDIEBlder);
+ }
+ // split CU were just finalized above when the
+ // .debug_str_offsets section was modified;
return;
+ }
- ARangesSectionWriter = std::make_unique<DebugARangesSectionWriter>();
- StrWriter = std::make_unique<DebugStrWriter>(*BC.DwCtx, false);
- StrOffstsWriter = std::make_unique<DebugStrOffsetsWriter>(BC);
+ if (Version >= 5)
+ StrOffstsWriter->finalizeSection(CU, PartDIEBlder);
+}
- /// Stores and serializes information that will be put into the
- /// .debug_addr DWARF section.
- std::unique_ptr<DebugAddrWriter> FinalAddrWriter;
+/// Merge: compute per-CU loclist/legacy-loc bases and in the
+/// same loop apply DWARF5 rnglists/loclists base fixups and legacy
+/// .debug_loc base fixups.
+void DWARFRewriter::mergePerBucketLocsAndRanges(
----------------
Jinjie-Huang wrote:
It seems like this function could be better organized. Perhaps we could break mergePerBucketLocsAndRanges down into:
- processCUOrders
- processLocBases
- processRanges
https://github.com/llvm/llvm-project/pull/197859
More information about the llvm-commits
mailing list