summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DIEHash.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-10-17 22:07:09 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-10-17 22:07:09 +0000
commit47f66d5a756d4eaeba9082ff4c82023a213daf45 (patch)
treeb00ba7ffbd91bf60a7c7b479e2425d57d811d2ed /lib/CodeGen/AsmPrinter/DIEHash.cpp
parent7014d274e4adb51cbb20201ab002057395b7dcaa (diff)
downloadllvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.tar.gz
llvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.tar.bz2
llvm-47f66d5a756d4eaeba9082ff4c82023a213daf45.tar.xz
DIEHash: Support for simple (non-recursive, non-reused) type references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DIEHash.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DIEHash.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIEHash.cpp b/lib/CodeGen/AsmPrinter/DIEHash.cpp
index 8409a7f56c..c3dc7af2f8 100644
--- a/lib/CodeGen/AsmPrinter/DIEHash.cpp
+++ b/lib/CodeGen/AsmPrinter/DIEHash.cpp
@@ -274,6 +274,9 @@ void DIEHash::collectAttributes(DIE *Die, DIEAttrs &Attrs) {
case dwarf::DW_AT_vtable_elem_location:
COLLECT_ATTR(DW_AT_vtable_elem_location)
break;
+ case dwarf::DW_AT_type:
+ COLLECT_ATTR(DW_AT_type)
+ break;
default:
break;
}
@@ -286,19 +289,39 @@ void DIEHash::hashAttribute(AttrEntry Attr) {
const DIEValue *Value = Attr.Val;
const DIEAbbrevData *Desc = Attr.Desc;
- // TODO: Add support for types.
+ // 7.27s3
+ // ... An attribute that refers to another type entry T is processed as
+ // follows:
+ // a) If T is in the list of [previously hashed types], use the letter 'R' as
+ // the marker and use the unsigned LEB128 encoding of [the index of T in the
+ // list] as the attribute value; otherwise,
+
+ // [TODO: implement clause (a)]
+
+ if (const DIEEntry *EntryAttr = dyn_cast<DIEEntry>(Value)) {
+ DIE *Entry = EntryAttr->getEntry();
+
+ // b) use the letter 'T' as a the marker, ...
+ addULEB128('T');
+
+ addULEB128(Desc->getAttribute());
- // Add the letter A to the hash.
+ // ... process the type T recursively by performing Steps 2 through 7, and
+ // use the result as the attribute value.
+ computeHash(Entry);
+ return;
+ }
+
+ // Other attribute values use the letter 'A' as the marker, ...
addULEB128('A');
- // Then the attribute code.
addULEB128(Desc->getAttribute());
- // To ensure reproducibility of the signature, the set of forms used in the
+ // ... and the value consists of the form code (encoded as an unsigned LEB128
+ // value) followed by the encoding of the value according to the form code. To
+ // ensure reproducibility of the signature, the set of forms used in the
// signature computation is limited to the following: DW_FORM_sdata,
// DW_FORM_flag, DW_FORM_string, and DW_FORM_block.
-
- // TODO: Add support for additional forms.
switch (Desc->getForm()) {
case dwarf::DW_FORM_string:
llvm_unreachable(
@@ -315,6 +338,7 @@ void DIEHash::hashAttribute(AttrEntry Attr) {
addULEB128(dwarf::DW_FORM_sdata);
addSLEB128((int64_t)cast<DIEInteger>(Value)->getValue());
break;
+ // TODO: Add support for additional forms.
}
}
@@ -375,6 +399,7 @@ void DIEHash::hashAttributes(const DIEAttrs &Attrs) {
ADD_ATTR(Attrs.DW_AT_virtuality);
ADD_ATTR(Attrs.DW_AT_visibility);
ADD_ATTR(Attrs.DW_AT_vtable_elem_location);
+ ADD_ATTR(Attrs.DW_AT_type);
// FIXME: Add the extended attributes.
}