[llvm] [BOLT][DWARF][NFC] Refactor address writers (PR #98094)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 15:07:36 PDT 2024
================
@@ -613,27 +613,33 @@ void DWARFRewriter::updateDebugInfo() {
}
if (BC.isDWARF5Used()) {
- AddrWriter = std::make_unique<DebugAddrWriterDwarf5>(&BC);
+ FinalAddrWriter = std::make_unique<DebugAddrWriterDwarf5>(&BC);
RangeListsSectionWriter = std::make_unique<DebugRangeListsSectionWriter>();
- DebugRangeListsSectionWriter::setAddressWriter(AddrWriter.get());
} else {
- AddrWriter = std::make_unique<DebugAddrWriter>(&BC);
+ FinalAddrWriter = std::make_unique<DebugAddrWriter>(&BC);
}
if (BC.isDWARFLegacyUsed())
LegacyRangesSectionWriter = std::make_unique<DebugRangesSectionWriter>();
- DebugLoclistWriter::setAddressWriter(AddrWriter.get());
-
uint32_t CUIndex = 0;
std::mutex AccessMutex;
// Needs to be invoked in the same order as CUs are processed.
auto createRangeLocList = [&](DWARFUnit &CU) -> DebugLocWriter * {
std::lock_guard<std::mutex> Lock(AccessMutex);
const uint16_t DwarfVersion = CU.getVersion();
if (DwarfVersion >= 5) {
- LocListWritersByCU[CUIndex] =
- std::make_unique<DebugLoclistWriter>(CU, DwarfVersion, false);
+ auto AddrW = std::make_unique<DebugAddrWriterDwarf5>(&BC);
+ std::unique_ptr<DebugAddrWriter> &AddressWriterIterator =
+ AddressWritersByCU.insert({CU.getOffset(), std::move(AddrW)})
+ .first->second;
+ DebugRangeListsSectionWriter::setAddressWriter(
----------------
ayermolo wrote:
This seems off. Inside DebugRangeListsSectionWriter is still static. Probably happens to work because it's all processed serially right now.
https://github.com/llvm/llvm-project/pull/98094
More information about the llvm-commits
mailing list