diff options
author | Eric Christopher <echristo@gmail.com> | 2013-08-08 23:45:55 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-08-08 23:45:55 +0000 |
commit | 4573198b3081b43c7c33dc1f4c767d7b58013ff6 (patch) | |
tree | 4547cfb3f279f922ad0aeb80c6744ed5a43443e4 /llvm/lib/CodeGen/AsmPrinter/DIEHash.h | |
parent | 56eb4b654ff73a6f5e9fc6bc82873f84ce7a7c03 (diff) | |
download | bcm5719-llvm-4573198b3081b43c7c33dc1f4c767d7b58013ff6.tar.gz bcm5719-llvm-4573198b3081b43c7c33dc1f4c767d7b58013ff6.zip |
Move hash computation code into a separate class and file.
No functional change intended.
llvm-svn: 188028
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIEHash.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h new file mode 100644 index 00000000000..b9f811c91af --- /dev/null +++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h @@ -0,0 +1,46 @@ +//===-- llvm/CodeGen/DIEHash.h - Dwarf Hashing Framework -------*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains support for DWARF4 hashing of DIEs. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/MD5.h" + +namespace llvm { + +class CompileUnit; + +/// \brief An object containing the capability of hashing and adding hash +/// attributes onto a DIE. +class DIEHash { +public: + /// \brief Initializes. The hash is default initialized. + DIEHash() {} + + /// \brief Computes the ODR signature + uint64_t computeDIEODRSignature(DIE *Die); + + // Helper routines to process parts of a DIE. + private: + /// \brief Adds the parent context of \param Die to the hash. + void addParentContext(DIE *Die); + + // Routines that add DIEValues to the hash. +private: + /// \brief Encodes and adds \param Value to the hash as a ULEB128. + void addULEB128(uint64_t Value); + + /// \brief Adds \param Str to the hash and includes a NULL byte. + void addString(StringRef Str); + +private: + MD5 Hash; +}; +} |