Commit cae115d6 by Richard Sandiford Committed by Richard Sandiford

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
parent 449e9a33
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.
......@@ -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)
{
......
......@@ -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))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment