b9f811c91af48392d29b2a04b01a7afa161d8bff
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DIEHash.h
1 //===-- 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
16 namespace llvm {
17
18 class CompileUnit;
19
20 /// \brief An object containing the capability of hashing and adding hash
21 /// attributes onto a DIE.
22 class DIEHash {
23 public:
24   /// \brief Initializes. The hash is default initialized.
25   DIEHash() {}
26
27   /// \brief Computes the ODR signature
28   uint64_t computeDIEODRSignature(DIE *Die);
29
30   // Helper routines to process parts of a DIE.
31  private:
32   /// \brief Adds the parent context of \param Die to the hash.
33   void addParentContext(DIE *Die);
34   
35   // Routines that add DIEValues to the hash.
36 private:
37   /// \brief Encodes and adds \param Value to the hash as a ULEB128.
38   void addULEB128(uint64_t Value);
39
40   /// \brief Adds \param Str to the hash and includes a NULL byte.
41   void addString(StringRef Str);
42   
43 private:
44   MD5 Hash;
45 };
46 }