diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-04-29 17:12:42 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-04-29 17:12:42 +0000 |
commit | b58db2293dff0eb47d9e16a8482b32e2008b68e4 (patch) | |
tree | b99c2fdc50c13024bfa468a3e8e0eab5eca13181 /lib/DebugInfo/DWARFDebugInfoEntry.h | |
parent | f38f17c463cae4ffae73336fa5b738241fd55d3a (diff) | |
download | llvm-b58db2293dff0eb47d9e16a8482b32e2008b68e4.tar.gz llvm-b58db2293dff0eb47d9e16a8482b32e2008b68e4.tar.bz2 llvm-b58db2293dff0eb47d9e16a8482b32e2008b68e4.tar.xz |
[DWARF parser] Compress DIEMinimal even further, simplify building DIE tree.
DIE doesn't need to store a pointer to its parent: we can traverse the DIE tree
only with functions getFirstChild() and getSibling(). Parents must be known
only when we construct the tree. Rewrite setDIERelations() procedure in a more
straightforward way, and get rid of lots of now unused DIEMinimal methods.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207563 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFDebugInfoEntry.h')
-rw-r--r-- | lib/DebugInfo/DWARFDebugInfoEntry.h | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/lib/DebugInfo/DWARFDebugInfoEntry.h b/lib/DebugInfo/DWARFDebugInfoEntry.h index 2d0e953de3..35140d7359 100644 --- a/lib/DebugInfo/DWARFDebugInfoEntry.h +++ b/lib/DebugInfo/DWARFDebugInfoEntry.h @@ -29,17 +29,13 @@ class DWARFDebugInfoEntryMinimal { /// Offset within the .debug_info of the start of this entry. uint32_t Offset; - /// How many to subtract from "this" to get the parent. - /// If zero this die has no parent. - uint32_t ParentIdx; - /// How many to add to "this" to get the sibling. uint32_t SiblingIdx; const DWARFAbbreviationDeclaration *AbbrevDecl; public: DWARFDebugInfoEntryMinimal() - : Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(nullptr) {} + : Offset(0), SiblingIdx(0), AbbrevDecl(nullptr) {} void dump(raw_ostream &OS, const DWARFUnit *u, unsigned recurseDepth, unsigned indent = 0) const; @@ -64,45 +60,23 @@ public: bool hasChildren() const { return !isNULL() && AbbrevDecl->hasChildren(); } // We know we are kept in a vector of contiguous entries, so we know - // our parent will be some index behind "this". - DWARFDebugInfoEntryMinimal *getParent() { - return ParentIdx > 0 ? this - ParentIdx : nullptr; - } - const DWARFDebugInfoEntryMinimal *getParent() const { - return ParentIdx > 0 ? this - ParentIdx : nullptr; - } - // We know we are kept in a vector of contiguous entries, so we know // our sibling will be some index after "this". - DWARFDebugInfoEntryMinimal *getSibling() { - return SiblingIdx > 0 ? this + SiblingIdx : nullptr; - } const DWARFDebugInfoEntryMinimal *getSibling() const { return SiblingIdx > 0 ? this + SiblingIdx : nullptr; } + // We know we are kept in a vector of contiguous entries, so we know // we don't need to store our child pointer, if we have a child it will // be the next entry in the list... - DWARFDebugInfoEntryMinimal *getFirstChild() { - return hasChildren() ? this + 1 : nullptr; - } const DWARFDebugInfoEntryMinimal *getFirstChild() const { return hasChildren() ? this + 1 : nullptr; } - void setParent(DWARFDebugInfoEntryMinimal *parent) { - if (parent) { - // We know we are kept in a vector of contiguous entries, so we know - // our parent will be some index behind "this". - ParentIdx = this - parent; - } else - ParentIdx = 0; - } - void setSibling(DWARFDebugInfoEntryMinimal *sibling) { - if (sibling) { + void setSibling(const DWARFDebugInfoEntryMinimal *Sibling) { + if (Sibling) { // We know we are kept in a vector of contiguous entries, so we know // our sibling will be some index after "this". - SiblingIdx = sibling - this; - sibling->setParent(getParent()); + SiblingIdx = Sibling - this; } else SiblingIdx = 0; } |