summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DIEHash.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-03-08 00:29:41 +0000
committerEric Christopher <echristo@gmail.com>2014-03-08 00:29:41 +0000
commitb1c884410141ea7bdae5d4f9b1559d71cecc3d7c (patch)
tree02f759d522811746bce1820d0e10bdfb5d3df6a1 /lib/CodeGen/AsmPrinter/DIEHash.cpp
parentd07494f1022c01a51abaad6802900fa3e6068a60 (diff)
downloadllvm-b1c884410141ea7bdae5d4f9b1559d71cecc3d7c.tar.gz
llvm-b1c884410141ea7bdae5d4f9b1559d71cecc3d7c.tar.bz2
llvm-b1c884410141ea7bdae5d4f9b1559d71cecc3d7c.tar.xz
Add support for hashing location information for CU level hashes.
Add a testcase based on sret.cpp where we can now hash the entire compile unit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DIEHash.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DIEHash.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIEHash.cpp b/lib/CodeGen/AsmPrinter/DIEHash.cpp
index cff8f2180a..024ce0e725 100644
--- a/lib/CodeGen/AsmPrinter/DIEHash.cpp
+++ b/lib/CodeGen/AsmPrinter/DIEHash.cpp
@@ -13,8 +13,10 @@
#define DEBUG_TYPE "dwarfdebug"
+#include "ByteStreamer.h"
#include "DIEHash.h"
#include "DIE.h"
+#include "DwarfDebug.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/AsmPrinter.h"
@@ -279,6 +281,28 @@ void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue *> &Values) {
Hash.update((uint64_t)cast<DIEInteger>(*I)->getValue());
}
+// Hash the contents of a loclistptr class.
+void DIEHash::hashLocList(const DIELocList &LocList) {
+ SmallVectorImpl<DotDebugLocEntry>::const_iterator Start =
+ AP->getDwarfDebug()->getDebugLocEntries().begin();
+ Start += LocList.getValue();
+ HashingByteStreamer Streamer(*this);
+ for (SmallVectorImpl<DotDebugLocEntry>::const_iterator
+ I = Start,
+ E = AP->getDwarfDebug()->getDebugLocEntries().end();
+ I != E; ++I) {
+ const DotDebugLocEntry &Entry = *I;
+ // Go through the entries until we hit the end of the list,
+ // which is the next empty entry.
+ if (Entry.isEmpty())
+ return;
+ else if (Entry.isMerged())
+ continue;
+ else
+ AP->getDwarfDebug()->emitDebugLocEntry(Streamer, Entry);
+ }
+}
+
// Hash an individual attribute \param Attr based on the type of attribute and
// the form.
void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
@@ -333,19 +357,23 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
break;
case DIEValue::isBlock:
case DIEValue::isLoc:
+ case DIEValue::isLocList:
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 {
+ } else if (isa<DIELoc>(Value)) {
addULEB128(cast<DIELoc>(Value)->ComputeSize(AP));
hashBlockData(cast<DIELoc>(Value)->getValues());
+ } else {
+ // We could add the block length, but that would take
+ // a bit of work and not add a lot of uniqueness
+ // to the hash in some way we could test.
+ hashLocList(*cast<DIELocList>(Value));
}
break;
- // FIXME: Handle loclistptr.
- case DIEValue::isLocList:
// FIXME: It's uncertain whether or not we should handle this at the moment.
case DIEValue::isExpr:
case DIEValue::isLabel: