1 //===-- llvm/CodeGen/DIEHash.h - Dwarf Hashing Framework -------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for DWARF4 hashing of DIEs.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/MD5.h"
20 /// \brief An object containing the capability of hashing and adding hash
21 /// attributes onto a DIE.
23 // The entry for a particular attribute.
26 const DIEAbbrevData *Desc;
29 // Collection of all attributes used in hashing a particular DIE.
32 AttrEntry DW_AT_language;
36 /// \brief Computes the ODR signature
37 uint64_t computeDIEODRSignature(DIE *Die);
39 /// \brief Computes the CU signature
40 uint64_t computeCUSignature(DIE *Die);
42 // Helper routines to process parts of a DIE.
44 /// \brief Adds the parent context of \param Die to the hash.
45 void addParentContext(DIE *Die);
47 /// \brief Adds the attributes of \param Die to the hash.
48 void addAttributes(DIE *Die);
50 /// \brief Computes the full DWARF4 7.27 hash of the DIE.
51 void computeHash(DIE *Die);
53 // Routines that add DIEValues to the hash.
55 /// \brief Encodes and adds \param Value to the hash as a ULEB128.
56 void addULEB128(uint64_t Value);
58 /// \brief Adds \param Str to the hash and includes a NULL byte.
59 void addString(StringRef Str);
61 /// \brief Collects the attributes of DIE \param Die into the \param Attrs
63 void collectAttributes(DIE *Die, DIEAttrs &Attrs);
65 /// \brief Hashes the attributes in \param Attrs in order.
66 void hashAttributes(const DIEAttrs &Attrs);
68 /// \brief Hashes an individual attribute.
69 void hashAttribute(AttrEntry Attr);