diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-10-21 22:36:50 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-10-21 22:36:50 +0000 |
commit | f1545a219744c1ae66137e64d1c456cd8e924eb7 (patch) | |
tree | b187a8ab686cef6d3882343adc4f1768b5f9907c /lib | |
parent | 65d60c8468a40df0ef4f5c152e7e8ce572785400 (diff) | |
download | external_llvm-f1545a219744c1ae66137e64d1c456cd8e924eb7.zip external_llvm-f1545a219744c1ae66137e64d1c456cd8e924eb7.tar.gz external_llvm-f1545a219744c1ae66137e64d1c456cd8e924eb7.tar.bz2 |
DWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts
There are several other tag types that need similar handling but to
ensure test coverage they'll be coming incrementally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIEHash.cpp | 42 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIEHash.h | 4 |
2 files changed, 39 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIEHash.cpp b/lib/CodeGen/AsmPrinter/DIEHash.cpp index aa54db0..0dacd73 100644 --- a/lib/CodeGen/AsmPrinter/DIEHash.cpp +++ b/lib/CodeGen/AsmPrinter/DIEHash.cpp @@ -189,15 +189,47 @@ void DIEHash::collectAttributes(DIE *Die, DIEAttrs &Attrs) { // Hash an individual attribute \param Attr based on the type of attribute and // the form. -void DIEHash::hashAttribute(AttrEntry Attr) { +void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) { const DIEValue *Value = Attr.Val; const DIEAbbrevData *Desc = Attr.Desc; - // 7.27s3 + // 7.27 Step 3 // ... An attribute that refers to another type entry T is processed as // follows: if (const DIEEntry *EntryAttr = dyn_cast<DIEEntry>(Value)) { DIE *Entry = EntryAttr->getEntry(); + + // Step 5 + // If the tag in Step 3 is one of ... + if (Tag == dwarf::DW_TAG_pointer_type) { + // ... and the referenced type (via the DW_AT_type or DW_AT_friend + // attribute) ... + assert(Desc->getAttribute() == dwarf::DW_AT_type || + Desc->getAttribute() == dwarf::DW_AT_friend); + // [FIXME] ... has a DW_AT_name attribute, + // append the letter 'N' + addULEB128('N'); + + // the DWARF attribute code (DW_AT_type or DW_AT_friend), + addULEB128(Desc->getAttribute()); + + // the context of the tag, + if (DIE *Parent = Entry->getParent()) + addParentContext(Parent); + + // the letter 'E', + addULEB128('E'); + + // and the name of the type. + addString(getDIEStringAttr(Entry, dwarf::DW_AT_name)); + + // FIXME: + // For DW_TAG_friend, if the referenced entry is the DW_TAG_subprogram, + // the context is omitted and the name to be used is the ABI-specific name + // of the subprogram (e.g., the mangled linker name). + return; + } + unsigned &DieNumber = Numbering[Entry]; if (DieNumber) { // a) If T is in the list of [previously hashed types], use the letter @@ -258,11 +290,11 @@ void DIEHash::hashAttribute(AttrEntry Attr) { // Go through the attributes from \param Attrs in the order specified in 7.27.4 // and hash them. -void DIEHash::hashAttributes(const DIEAttrs &Attrs) { +void DIEHash::hashAttributes(const DIEAttrs &Attrs, dwarf::Tag Tag) { #define ADD_ATTR(ATTR) \ { \ if (ATTR.Val != 0) \ - hashAttribute(ATTR); \ + hashAttribute(ATTR, Tag); \ } ADD_ATTR(Attrs.DW_AT_name); @@ -322,7 +354,7 @@ void DIEHash::hashAttributes(const DIEAttrs &Attrs) { void DIEHash::addAttributes(DIE *Die) { DIEAttrs Attrs = {}; collectAttributes(Die, Attrs); - hashAttributes(Attrs); + hashAttributes(Attrs, Die->getTag()); } // Compute the hash of a DIE. This is based on the type signature computation diff --git a/lib/CodeGen/AsmPrinter/DIEHash.h b/lib/CodeGen/AsmPrinter/DIEHash.h index f6650cc..a59df35 100644 --- a/lib/CodeGen/AsmPrinter/DIEHash.h +++ b/lib/CodeGen/AsmPrinter/DIEHash.h @@ -119,10 +119,10 @@ private: void collectAttributes(DIE *Die, DIEAttrs &Attrs); /// \brief Hashes the attributes in \param Attrs in order. - void hashAttributes(const DIEAttrs &Attrs); + void hashAttributes(const DIEAttrs &Attrs, dwarf::Tag Tag); /// \brief Hashes an individual attribute. - void hashAttribute(AttrEntry Attr); + void hashAttribute(AttrEntry Attr, dwarf::Tag Tag); private: MD5 Hash; |