This is an archive of the discontinued LLVM Phabricator instance.

[NFC][DWARFLinker] Refactor address emitting code.
ClosedPublic

Authored by avl on Jan 17 2023, 8:38 AM.

Details

Summary

As a preparation for implementing DWARFv5 address ranges generation,
this patch refactors existing address ranges generation code:
Split emitUnitRangesEntries into two functions emitDwarfDebugArangesTable
and emitDwarfDebugRangesTableFragment. Use AddressRanges to prepare linked
address ranges. Refactor Unit.getLowPc(), to use std::nullopt as undefined value.

Diff Detail

Event Timeline

avl created this revision.Jan 17 2023, 8:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 8:38 AM
avl requested review of this revision.Jan 17 2023, 8:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 8:38 AM
JDevlieghere accepted this revision.Jan 17 2023, 11:20 AM

LGTM modulo a few small nits.

llvm/lib/DWARFLinker/DWARFLinker.cpp
1678–1679

Can this be hoisted outside the loop?

llvm/lib/DWARFLinker/DWARFStreamer.cpp
354–358

Do we need the index? IIRC AddressRanges class implemented iterators so we should be able to write:

for(AddressRange Range : LinkedRanges)
376

Similar comment here

415

And here I think

This revision is now accepted and ready to land.Jan 17 2023, 11:20 AM
avl updated this revision to Diff 490487.Jan 19 2023, 6:10 AM

addressed comments.

avl added inline comments.Jan 19 2023, 6:13 AM
llvm/lib/DWARFLinker/DWARFStreamer.cpp
415

In this place we need index as AddressRangesMap(FunctionRanges) does not have iterators.

This revision was landed with ongoing or failed builds.Jan 20 2023, 8:48 AM
This revision was automatically updated to reflect the committed changes.