aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-22 21:04:02 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-22 21:04:02 +0000
commitcae115d6d4552a29efb4ea94363d63bde985b4d8 (patch)
tree971f8140db3ad5996450c01a83b79bf0fe08af00
parent449e9a33887046acec46f373f96900fc07735355 (diff)
downloadgcc-cae115d6d4552a29efb4ea94363d63bde985b4d8.zip
gcc-cae115d6d4552a29efb4ea94363d63bde985b4d8.tar.gz
gcc-cae115d6d4552a29efb4ea94363d63bde985b4d8.tar.bz2
Add wide_int version of inchash::hash::add_wide_int
This patch adds an inchash hasher for wide_int-based types. It means that hash_tree no longer hashes TREE_INT_CST_EXT_NUNITS, but that was redundant with hashing the type. 2017-10-22 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * inchash.h (inchash::hash::add_wide_int): New function. * lto-streamer-out.c (hash_tree): Use it. From-SVN: r253988
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/inchash.h9
-rw-r--r--gcc/lto-streamer-out.c8
3 files changed, 15 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e7eda1..47f93c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
+ * inchash.h (inchash::hash::add_wide_int): New function.
+ * lto-streamer-out.c (hash_tree): Use it.
+
+2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
+
* inchash.h (inchash::hash::add_wide_int): Rename to...
(inchash::hash::add_hwi): ...this.
* ipa-devirt.c (hash_odr_vtable): Update accordingly.
diff --git a/gcc/inchash.h b/gcc/inchash.h
index 29e9e6d..73930c2 100644
--- a/gcc/inchash.h
+++ b/gcc/inchash.h
@@ -63,6 +63,15 @@ class hash
val = iterative_hash_host_wide_int (v, val);
}
+ /* Add wide_int-based value V. */
+ template<typename T>
+ void add_wide_int (const generic_wide_int<T> &x)
+ {
+ add_int (x.get_len ());
+ for (unsigned i = 0; i < x.get_len (); i++)
+ add_hwi (x.elt (i));
+ }
+
/* Hash in pointer PTR. */
void add_ptr (const void *ptr)
{
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index f9f7677..554f9cc 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1028,13 +1028,7 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
hstate.commit_flag ();
if (CODE_CONTAINS_STRUCT (code, TS_INT_CST))
- {
- int i;
- hstate.add_hwi (TREE_INT_CST_NUNITS (t));
- hstate.add_hwi (TREE_INT_CST_EXT_NUNITS (t));
- for (i = 0; i < TREE_INT_CST_NUNITS (t); i++)
- hstate.add_hwi (TREE_INT_CST_ELT (t, i));
- }
+ hstate.add_wide_int (wi::to_widest (t));
if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST))
{