summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-01-31 20:02:58 +0000
committerEric Christopher <echristo@gmail.com>2014-01-31 20:02:58 +0000
commit4b1cf5801f56a1e510712c568afacae8932c0a92 (patch)
treec44a9f15948dfcc1ea88fb1ca9daf50b9ab14074 /llvm/lib
parent5ad8d90b71444ed176671f8d9cb214e0bb1e6a0c (diff)
downloadbcm5719-llvm-4b1cf5801f56a1e510712c568afacae8932c0a92.tar.gz
bcm5719-llvm-4b1cf5801f56a1e510712c568afacae8932c0a92.zip
Add support for DW_FORM_flag and DW_FORM_flag_present to the DIE hashing
algorithm. Sink the 'A' + Attribute hash into each form so we don't have to check valid forms before deciding whether or not we're going to hash which will let the default be to return without doing anything. llvm-svn: 200571
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
index ca10939d653..72be1b59501 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp
@@ -284,22 +284,20 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
return;
}
- // Other attribute values use the letter 'A' as the marker, ...
- addULEB128('A');
-
- addULEB128(Attribute);
-
- // ... 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.
+ // Other attribute values use the letter 'A' as the marker, 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.
switch (Desc->getForm()) {
case dwarf::DW_FORM_string:
llvm_unreachable(
"Add support for DW_FORM_string if we ever start emitting them again");
case dwarf::DW_FORM_GNU_str_index:
case dwarf::DW_FORM_strp:
+ addULEB128('A');
+ addULEB128(Attribute);
addULEB128(dwarf::DW_FORM_string);
addString(cast<DIEString>(Value)->getString());
break;
@@ -308,9 +306,20 @@ void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
case dwarf::DW_FORM_data4:
case dwarf::DW_FORM_data8:
case dwarf::DW_FORM_udata:
+ addULEB128('A');
+ addULEB128(Attribute);
addULEB128(dwarf::DW_FORM_sdata);
addSLEB128((int64_t)cast<DIEInteger>(Value)->getValue());
break;
+ // DW_FORM_flag_present is just flag with a value of one. We still give it a
+ // value so just use the value.
+ case dwarf::DW_FORM_flag_present:
+ case dwarf::DW_FORM_flag:
+ addULEB128('A');
+ addULEB128(Attribute);
+ addULEB128(dwarf::DW_FORM_flag);
+ addULEB128((int64_t)cast<DIEInteger>(Value)->getValue());
+ break;
default:
llvm_unreachable("Add support for additional forms");
}
OpenPOWER on IntegriCloud