This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] - Refactoring of DWARFContextInMemory implementation.
ClosedPublic

Authored by grimar on Apr 6 2017, 2:26 AM.

Details

Summary

This change is basically relative to D31136, where I initially wanted to
implement some relocations handling optimization which shows it can give
significant boost. Though even without any caching algorithm looks
code can have some cleanup at first.

Refactoring separates out code for taking symbol address, used in relocations
computation. That itself IMO reasonable cleanup.

Diff Detail

Event Timeline

grimar created this revision.Apr 6 2017, 2:26 AM
grimar updated this revision to Diff 94335.Apr 6 2017, 2:31 AM
  • Removed unrelative clang-format changes (file is not clang-formated, I think we want to format it separatelly).
aprantl added inline comments.Apr 6 2017, 9:02 AM
lib/DebugInfo/DWARF/DWARFContext.cpp
626

///

635

nitpick: LLVM coding guidelines want full sentences in comments -> .

659

if (L && RSec != Obj.section_end())

664

if (uint64_t SectionLoadAddress = L->getSectionLoadAddress(*RSec))

grimar updated this revision to Diff 94590.Apr 8 2017, 12:15 AM
  • Addressed review comments.
lib/DebugInfo/DWARF/DWARFContext.cpp
626

Fixed.

635

Fixed, thanks ! (btw, it was original comment. It looks whole file needs to be reviewed, formatted and corrected to match LLVM coding style)

659

Fixed.

664

Fixed.

echristo resigned from this revision.Apr 11 2017, 3:24 PM

Looks like Adrian has this review, removing myself.

One last comment in line 664 otherwise looks fine to me.

lib/DebugInfo/DWARF/DWARFContext.cpp
674

dyn_cast only makes sense if the result is checked for nullptr later on. Otherwise this should be just a cast.

aprantl accepted this revision.Apr 11 2017, 4:55 PM
This revision is now accepted and ready to land.Apr 11 2017, 4:55 PM
This revision was automatically updated to reflect the committed changes.

Thanks for review, Adrian !

dblaikie added inline comments.Apr 12 2017, 8:34 AM
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
670–674 ↗(On Diff #94943)

isa + cast, prefer a single dyn_cast instead:

const auto *MachObj = dyn_cast<MachOObjectFile>(&Obj);
if (!MachObj)
  return false;
...
grimar added inline comments.Apr 12 2017, 8:36 AM
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
670–674 ↗(On Diff #94943)

Right. I'll fix.