summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp26
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIEHash.h8
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp2
3 files changed, 35 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
index 1275d69a262..dbeb5890b00 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
@@ -17,6 +17,7 @@
#include "DIE.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Endian.h"
@@ -269,6 +270,15 @@ void DIEHash::hashDIEEntry(dwarf::Attribute Attribute, dwarf::Tag Tag,
computeHash(Entry);
}
+// Hash all of the values in a block like set of values. This assumes that
+// all of the data is going to be added as integers.
+void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue *> &Values) {
+ for (SmallVectorImpl<DIEValue *>::const_iterator I = Values.begin(),
+ E = Values.end();
+ I != E; ++I)
+ Hash.update((uint64_t)cast<DIEInteger>(*I)->getValue());
+}
+
// Hash an individual attribute \param Attr based on the type of attribute and
// the form.
void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
@@ -321,6 +331,22 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
addULEB128(dwarf::DW_FORM_flag);
addULEB128((int64_t)cast<DIEInteger>(Value)->getValue());
break;
+ case dwarf::DW_FORM_exprloc:
+ case dwarf::DW_FORM_block1:
+ case dwarf::DW_FORM_block2:
+ case dwarf::DW_FORM_block4:
+ case dwarf::DW_FORM_block:
+ addULEB128('A');
+ addULEB128(Attribute);
+ addULEB128(dwarf::DW_FORM_block);
+ if (isa<DIEBlock>(Value)) {
+ addULEB128(cast<DIEBlock>(Value)->ComputeSize(AP));
+ hashBlockData(cast<DIEBlock>(Value)->getValues());
+ } else {
+ addULEB128(cast<DIELoc>(Value)->ComputeSize(AP));
+ hashBlockData(cast<DIELoc>(Value)->getValues());
+ }
+ break;
default:
llvm_unreachable("Add support for additional forms");
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
index bac3c557844..40d6f44f311 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.h
@@ -17,6 +17,7 @@
namespace llvm {
+class AsmPrinter;
class CompileUnit;
/// \brief An object containing the capability of hashing and adding hash
@@ -84,6 +85,8 @@ class DIEHash {
};
public:
+ DIEHash(AsmPrinter *A = NULL) : AP(A) {}
+
/// \brief Computes the ODR signature.
uint64_t computeDIEODRSignature(const DIE &Die);
@@ -122,6 +125,10 @@ private:
/// \brief Hashes the attributes in \param Attrs in order.
void hashAttributes(const DIEAttrs &Attrs, dwarf::Tag Tag);
+ /// \brief Hashes the data in a block like DIEValue, e.g. DW_FORM_block or
+ /// DW_FORM_exprloc.
+ void hashBlockData(const SmallVectorImpl<DIEValue *> &Values);
+
/// \brief Hashes an individual attribute.
void hashAttribute(AttrEntry Attr, dwarf::Tag Tag);
@@ -143,6 +150,7 @@ private:
private:
MD5 Hash;
+ AsmPrinter *AP;
DenseMap<const DIE *, unsigned> Numbering;
};
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 70db96e43a1..9428fea7e14 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1007,7 +1007,7 @@ void DwarfDebug::finalizeModuleInfo() {
// This should be a unique identifier when we want to build .dwp files.
uint64_t ID = 0;
if (GenerateCUHash) {
- DIEHash CUHash;
+ DIEHash CUHash(Asm);
ID = CUHash.computeCUSignature(*TheU->getUnitDie());
}
TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
OpenPOWER on IntegriCloud