blob: 27e3c576318f8cfa3752818bdcbba8f98fdfc1e7 [file] [log] [blame]
Eric Christopher0d27ca12013-08-08 23:45:55 +00001//===-- llvm/CodeGen/DIEHash.h - Dwarf Hashing Framework -------*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains support for DWARF4 hashing of DIEs.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/Support/MD5.h"
15
16namespace llvm {
17
18class CompileUnit;
19
20/// \brief An object containing the capability of hashing and adding hash
21/// attributes onto a DIE.
22class DIEHash {
23public:
Eric Christopher0d27ca12013-08-08 23:45:55 +000024 /// \brief Computes the ODR signature
25 uint64_t computeDIEODRSignature(DIE *Die);
26
27 // Helper routines to process parts of a DIE.
28 private:
29 /// \brief Adds the parent context of \param Die to the hash.
30 void addParentContext(DIE *Die);
31
32 // Routines that add DIEValues to the hash.
33private:
34 /// \brief Encodes and adds \param Value to the hash as a ULEB128.
35 void addULEB128(uint64_t Value);
36
37 /// \brief Adds \param Str to the hash and includes a NULL byte.
38 void addString(StringRef Str);
39
40private:
41 MD5 Hash;
42};
43}