[PATCH] D42334: [NFC] Refactor Apple Accelerator Tables
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 20 08:04:07 PST 2018
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, friss, echristo, dblaikie, labath.
JDevlieghere added a project: debug-info.
[NFC] Refactor Apple Accelerator Tables
This patch completely overhauls the accelerator table and makes them
truly generic. There have been several attempts to do this in the past:
- https://reviews.llvm.org/D8215 & https://reviews.llvm.org/D8216: Using a union and partial hardcoding.
- https://reviews.llvm.org/D11805: Using inheritance.
- https://reviews.llvm.org/D42246: Using a callback.
In the end I didn't like either of them, because for some reason or
another parts of it felt hacky or decreased runtime performance. I
didn't want to completely rewrite them as I was hoping that we could
reuse parts for the successor in the DWARF standard. However, it seems
less and less likely that there will be a lot of opportunities for
sharing code and/or an interface. I just went for what I think is the
proper solution to our problem.
A quick summary for why these changes are necessary: dsymutil likes to
reuse the current implementation of the Apple accelerator tables.
However, LLDB expects a slightly different interface than what is
currently emitted. Additionally, in dsymutil we only have offsets and no
actual DIEs.
Although a lot of code seems to have changed, in the end this change is
pretty straightforward:
- We turned `HashDataContents` into a template parameter.
- We created two implementations of this class, one for type tables and one for everything else. There will be a third one for dsymutil with just an offset.
- We use the supplied class to deduct the atoms for the header which makes the structure of the table fully self contained.
- We renamed the prefix from DWARF- to Apple- to make space for the future implementation of `.debug_names`.
One could argue that the latter should've been a separate patch, but
since this refactoring touches almost every line, it doesn't really
matter.
The disadvantage of this is of course that a lot of the code is moved to
the header. One mitigation was splitting off the header class so we could
have the `::Emit()` method implemented in the cpp file. With regards to
includes we only need to import two more headers than before
(`CodeGen/AsmPrinter.h` and `llvm/MC/MCStreamer.h`) which seems
reasonable.
Repository:
rL LLVM
https://reviews.llvm.org/D42334
Files:
lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
lib/CodeGen/AsmPrinter/DwarfAccelTable.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42334.130765.patch
Type: text/x-patch
Size: 34386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180120/30b8557d/attachment-0001.bin>
More information about the llvm-commits
mailing list