diff mbox

[4/7] Convert ipa-devirt to inchash

Message ID 1406730225-25896-5-git-send-email-andi@firstfloor.org
State New
Headers show

Commit Message

Andi Kleen July 30, 2014, 2:23 p.m. UTC
From: Andi Kleen <ak@linux.intel.com>

gcc/:

2014-07-30  Andi Kleen  <ak@linux.intel.com>

	* ipa-devirt.c (polymorphic_call_target_hasher::hash):
	Convert to inchash.
---
 gcc/ipa-devirt.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

Comments

Jeff Law July 31, 2014, 3:16 a.m. UTC | #1
On 07/30/14 08:23, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> gcc/:
>
> 2014-07-30  Andi Kleen  <ak@linux.intel.com>
>
> 	* ipa-devirt.c (polymorphic_call_target_hasher::hash):
> 	Convert to inchash.
OK once hashinc namespace is approved.

jeff
Jan Hubicka Aug. 7, 2014, 10:42 a.m. UTC | #2
> From: Andi Kleen <ak@linux.intel.com>
> 
> gcc/:
> 
> 2014-07-30  Andi Kleen  <ak@linux.intel.com>
> 
> 	* ipa-devirt.c (polymorphic_call_target_hasher::hash):
> 	Convert to inchash.

OK,
Honza
diff mbox

Patch

diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 4b5b2a6..fc2c31f 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1635,25 +1635,22 @@  struct polymorphic_call_target_hasher
 inline hashval_t
 polymorphic_call_target_hasher::hash (const value_type *odr_query)
 {
-  hashval_t hash;
+  inchash::hash hstate (odr_query->otr_token);
+
+  hstate.add_wide_int (odr_query->type->id);
+  hstate.merge_hash (TYPE_UID (odr_query->context.outer_type));
+  hstate.add_wide_int (odr_query->context.offset);
 
-  hash = iterative_hash_host_wide_int
-	  (odr_query->otr_token,
-	   odr_query->type->id);
-  hash = iterative_hash_hashval_t (TYPE_UID (odr_query->context.outer_type),
-				   hash);
-  hash = iterative_hash_host_wide_int (odr_query->context.offset, hash);
   if (odr_query->context.speculative_outer_type)
     {
-      hash = iterative_hash_hashval_t
-	       (TYPE_UID (odr_query->context.speculative_outer_type), hash);
-      hash = iterative_hash_host_wide_int (odr_query->context.speculative_offset,
-					   hash);
+      hstate.merge_hash (TYPE_UID (odr_query->context.speculative_outer_type));
+      hstate.add_wide_int (odr_query->context.speculative_offset);
     }
-  return iterative_hash_hashval_t
-	    (((int)odr_query->context.maybe_in_construction << 2)
-	     | ((int)odr_query->context.speculative_maybe_derived_type << 1)
-	     | (int)odr_query->context.maybe_derived_type, hash);
+  hstate.add_flag (odr_query->context.maybe_in_construction);
+  hstate.add_flag (odr_query->context.maybe_derived_type);
+  hstate.add_flag (odr_query->context.speculative_maybe_derived_type);
+  hstate.commit_flag ();
+  return hstate.end ();
 }
 
 /* Compare cache entries T1 and T2.  */