[PATCH] D26526: Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes()
Greg Clayton via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 14:31:51 PST 2016
clayborg created this revision.
clayborg added reviewers: dblaikie, aprantl, llvm-commits.
In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64.
This patch cleans up code so that everyone is using one of the new DWARFFormValue functions:
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr);
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32);
This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form.
This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64.
To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values.
https://reviews.llvm.org/D26526
Files:
include/llvm/DebugInfo/DWARF/DWARFFormValue.h
include/llvm/DebugInfo/DWARF/DWARFUnit.h
include/llvm/Support/Dwarf.h
lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
lib/DebugInfo/DWARF/DWARFFormValue.cpp
tools/llvm-dwp/llvm-dwp.cpp
unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26526.77555.patch
Type: text/x-patch
Size: 27256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161110/f9d082b7/attachment.bin>
More information about the llvm-commits
mailing list