[PATCH] D141943: [NFC][DWARFLinker] Refactor address emitting code.
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 11:20:19 PST 2023
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.
LGTM modulo a few small nits.
================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1676-1677
+
+ uint64_t BaseAddress =
+ dwarf::toAddress(OrigUnitDie.find(dwarf::DW_AT_low_pc), 0);
+ AddressRanges LinkedRanges;
----------------
Can this be hoisted outside the loop?
================
Comment at: llvm/lib/DWARFLinker/DWARFStreamer.cpp:354-358
+ for (size_t Idx = 0; Idx < LinkedRanges.size(); Idx++) {
+ MS->emitIntValue(LinkedRanges[Idx].start(), AddressSize);
+ MS->emitIntValue(LinkedRanges[Idx].end() - LinkedRanges[Idx].start(),
+ AddressSize);
+ }
----------------
Do we need the index? IIRC `AddressRanges` class implemented iterators so we should be able to write:
```
for(AddressRange Range : LinkedRanges)
```
================
Comment at: llvm/lib/DWARFLinker/DWARFStreamer.cpp:377
+ BaseAddress = *LowPC;
+ for (size_t Idx = 0; Idx < LinkedRanges.size(); Idx++) {
+ MS->emitIntValue(LinkedRanges[Idx].start() - BaseAddress, AddressSize);
----------------
Similar comment here
================
Comment at: llvm/lib/DWARFLinker/DWARFStreamer.cpp:405
+ AddressRanges LinkedRanges;
+ for (size_t Idx = 0; Idx < FunctionRanges.size(); Idx++)
+ LinkedRanges.insert(
----------------
And here I think
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141943/new/
https://reviews.llvm.org/D141943
More information about the llvm-commits
mailing list