[PATCH] D26567: Improve DWARF parsing speed by improving DWARFAbbreviationDeclaration
Greg Clayton via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 11 15:22:45 PST 2016
clayborg created this revision.
clayborg added reviewers: dblaikie, probinson, aprantl, llvm-commits.
This patch gets a DWARF parsing speed improvement by having DWARFAbbreviationDeclaration instances know if they have a fixed byte size. If an abbreviation has a fixed byte size that can be calculated given a DWARFUnit, then parsing a DIE becomes two steps: parse ULEB128 abbrev code, and then add constant size to the offset.
This patch also adds a fixed byte size to each DWARFAbbreviationDeclaration::AttributeSpec so that attributes can quickly skip their values if needed without the need to lookup the fixed for size.
Notable improvements:
- DWARFAbbreviationDeclaration::findAttributeIndex() now returns an Optional<uint32_t> instead of a uint32_t and we no longer have to look for the magic -1U return value
Optional<uint32_t> DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute attr) const;
- DWARFAbbreviationDeclaration now has a getAttributeValue() function that extracts an attribute value given a DIE offset that takes advantage of the DWARFAbbreviationDeclaration::AttributeSpec::ByteSize
bool DWARFAbbreviationDeclaration::getAttributeValue(const uint32_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U, DWARFFormValue &FormValue) const;
- A DWARFAbbreviationDeclaration instance can return a fixed byte size for itself so DWARF parsing is faster:
Optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(const DWARFUnit &U) const;
- Any functions that used to take a "const DWARFUnit *U" that would crash if U was NULL now take a "const DWARFUnit &U" and are only called with a valid DWARFUnit
https://reviews.llvm.org/D26567
Files:
include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
include/llvm/DebugInfo/DWARF/DWARFFormValue.h
lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
lib/DebugInfo/DWARF/DWARFUnit.cpp
tools/dsymutil/DwarfLinker.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26567.77678.patch
Type: text/x-patch
Size: 18112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161111/0cf51b3c/attachment.bin>
More information about the llvm-commits
mailing list