diff options
| author | David Blaikie <dblaikie@gmail.com> | 2013-10-25 18:38:43 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2013-10-25 18:38:43 +0000 |
| commit | 65cc969f5038d82c65c7f8cbaee30c8481971e38 (patch) | |
| tree | 121987b4c9dfe27488dcd9a9dde0faca0633fa04 /llvm/lib | |
| parent | bac3ff1aa7f169c513003cd6136aa15c0d185fc7 (diff) | |
| download | bcm5719-llvm-65cc969f5038d82c65c7f8cbaee30c8481971e38.tar.gz bcm5719-llvm-65cc969f5038d82c65c7f8cbaee30c8481971e38.zip | |
DIEHash: Summary hashing of nested types
llvm-svn: 193427
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp | 25 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp index b8b2bd22059..18264672ed2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp @@ -384,6 +384,18 @@ void DIEHash::addAttributes(const DIE &Die) { hashAttributes(Attrs, Die.getTag()); } +void DIEHash::hashNestedType(const DIE &Die, StringRef Name) { + // 7.27 Step 7 + // ... append the letter 'S', + addULEB128('S'); + + // the tag of C, + addULEB128(Die.getTag()); + + // and the name. + addString(Name); +} + // Compute the hash of a DIE. This is based on the type signature computation // given in section 7.27 of the DWARF4 standard. It is the md5 hash of a // flattened description of the DIE. @@ -398,8 +410,19 @@ void DIEHash::computeHash(const DIE &Die) { // Then hash each of the children of the DIE. for (std::vector<DIE *>::const_iterator I = Die.getChildren().begin(), E = Die.getChildren().end(); - I != E; ++I) + I != E; ++I) { + // 7.27 Step 7 + // If C is a nested type entry or a member function entry, ... + if (isType((*I)->getTag())) { + StringRef Name = getDIEStringAttr(**I, dwarf::DW_AT_name); + // ... and has a DW_AT_name attribute + if (!Name.empty()) { + hashNestedType(**I, Name); + continue; + } + } computeHash(**I); + } // Following the last (or if there are no children), append a zero byte. Hash.update(makeArrayRef((uint8_t)'\0')); diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h index da373de3f0f..b9cf7ce949f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h +++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h @@ -137,6 +137,8 @@ private: /// \brief Hashes a reference to a previously referenced type DIE. void hashRepeatedTypeReference(dwarf::Attribute Attribute, unsigned DieNumber); + void hashNestedType(const DIE &Die, StringRef Name); + private: MD5 Hash; DenseMap<const DIE *, unsigned> Numbering; |

