summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-02-20 02:50:45 +0000
committerEric Christopher <echristo@gmail.com>2014-02-20 02:50:45 +0000
commit420569be0454a3fb254dc98202080a8ec904fd2a (patch)
treea4dd86ad26c103d64fe05139d5dd1eacbdd4949a /llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
parent5d503b5deb29780e5bc4ac6e5f185ec708c3ad07 (diff)
downloadbcm5719-llvm-420569be0454a3fb254dc98202080a8ec904fd2a.tar.gz
bcm5719-llvm-420569be0454a3fb254dc98202080a8ec904fd2a.zip
Add support for hashing attributes with DW_FORM_block. This required
passing down an AsmPrinter instance so we could compute the size of the block which could be target specific. All of the test cases in the unittest don't have any target specific data so we can use a NULL AsmPrinter there. This also depends upon block data being added as integers. We can now hash the entire fission-cu.ll compile unit so turn the flag on there with the hash value. llvm-svn: 201752
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp26
1 files changed, 26 insertions, 0 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");
}
OpenPOWER on IntegriCloud