Re: Rename inchash::hash::add_wide_int

2017-10-13 Thread Jeff Law
On 10/13/2017 08:04 AM, Richard Sandiford wrote:
> The name inchash::add_wide_int is a bit misleading, since it sounds
> like it's hashing a wide_int.  This patch renames it to add_hwi instead.
> 
> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
> OK to install?
> 
> Richard
> 
> 
> 2017-10-13  Richard Sandiford  
> 
> gcc/
>   * inchash.h (inchash::hash::add_wide_int): Rename to...
>   (inchash::hash::add_hwi): ...this.
>   * ipa-devirt.c (hash_odr_vtable): Update accordingly.
>   (polymorphic_call_target_hasher::hash): Likewise.
>   * ipa-icf.c (sem_function::get_hash, sem_function::init): Likewise.
>   (sem_item::add_expr, sem_item::add_type, sem_variable::get_hash)
>   (sem_item_optimizer::update_hash_by_addr_refs): Likewise.
>   * lto-streamer-out.c (hash_tree): Likewise.
>   * optc-save-gen.awk: Likewise.
>   * tree.c (add_expr): Likewise.
OK.
jeff


Rename inchash::hash::add_wide_int

2017-10-13 Thread Richard Sandiford
The name inchash::add_wide_int is a bit misleading, since it sounds
like it's hashing a wide_int.  This patch renames it to add_hwi instead.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
OK to install?

Richard


2017-10-13  Richard Sandiford  

gcc/
* inchash.h (inchash::hash::add_wide_int): Rename to...
(inchash::hash::add_hwi): ...this.
* ipa-devirt.c (hash_odr_vtable): Update accordingly.
(polymorphic_call_target_hasher::hash): Likewise.
* ipa-icf.c (sem_function::get_hash, sem_function::init): Likewise.
(sem_item::add_expr, sem_item::add_type, sem_variable::get_hash)
(sem_item_optimizer::update_hash_by_addr_refs): Likewise.
* lto-streamer-out.c (hash_tree): Likewise.
* optc-save-gen.awk: Likewise.
* tree.c (add_expr): Likewise.

Index: gcc/inchash.h
===
--- gcc/inchash.h   2017-02-23 19:54:20.0 +
+++ gcc/inchash.h   2017-10-13 14:59:35.120146199 +0100
@@ -58,7 +58,7 @@ hashval_t iterative_hash_hashval_t (hash
   }
 
   /* Add HOST_WIDE_INT value V.  */
-  void add_wide_int (HOST_WIDE_INT v)
+  void add_hwi (HOST_WIDE_INT v)
   {
 val = iterative_hash_host_wide_int (v, val);
   }
Index: gcc/ipa-devirt.c
===
--- gcc/ipa-devirt.c2017-08-10 14:36:08.043471772 +0100
+++ gcc/ipa-devirt.c2017-10-13 14:59:35.121062203 +0100
@@ -373,7 +373,7 @@ hash_odr_vtable (const_tree t)
   v = TREE_OPERAND (TREE_OPERAND (v, 0), 0);
 }
 
-  hstate.add_wide_int (IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (v)));
+  hstate.add_hwi (IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (v)));
   return hstate.end ();
 }
 
@@ -2625,14 +2625,14 @@ polymorphic_call_target_hasher::hash (co
 {
   inchash::hash hstate (odr_query->otr_token);
 
-  hstate.add_wide_int (odr_query->type->id);
+  hstate.add_hwi (odr_query->type->id);
   hstate.merge_hash (TYPE_UID (odr_query->context.outer_type));
-  hstate.add_wide_int (odr_query->context.offset);
+  hstate.add_hwi (odr_query->context.offset);
 
   if (odr_query->context.speculative_outer_type)
 {
   hstate.merge_hash (TYPE_UID (odr_query->context.speculative_outer_type));
-  hstate.add_wide_int (odr_query->context.speculative_offset);
+  hstate.add_hwi (odr_query->context.speculative_offset);
 }
   hstate.add_flag (odr_query->speculative);
   hstate.add_flag (odr_query->context.maybe_in_construction);
Index: gcc/ipa-icf.c
===
--- gcc/ipa-icf.c   2017-09-25 13:33:39.989814299 +0100
+++ gcc/ipa-icf.c   2017-10-13 14:59:35.121062203 +0100
@@ -286,11 +286,11 @@ sem_function::get_hash (void)
 
   /* Add common features of declaration itself.  */
   if (DECL_FUNCTION_SPECIFIC_TARGET (decl))
-hstate.add_wide_int
+hstate.add_hwi
 (cl_target_option_hash
   (TREE_TARGET_OPTION (DECL_FUNCTION_SPECIFIC_TARGET (decl;
   if (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl))
-   hstate.add_wide_int
+   hstate.add_hwi
 (cl_optimization_hash
   (TREE_OPTIMIZATION (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl;
   hstate.add_flag (DECL_CXX_CONSTRUCTOR_P (decl));
@@ -1437,8 +1437,8 @@ sem_function::init (void)
 {
   cfg_checksum = 0;
   inchash::hash hstate;
-  hstate.add_wide_int (cnode->thunk.fixed_offset);
-  hstate.add_wide_int (cnode->thunk.virtual_value);
+  hstate.add_hwi (cnode->thunk.fixed_offset);
+  hstate.add_hwi (cnode->thunk.virtual_value);
   hstate.add_flag (cnode->thunk.this_adjusting);
   hstate.add_flag (cnode->thunk.virtual_offset_p);
   hstate.add_flag (cnode->thunk.add_pointer_bounds_args);
@@ -1485,7 +1485,7 @@ sem_item::add_expr (const_tree exp, inch
unsigned HOST_WIDE_INT idx;
tree value;
 
-   hstate.add_wide_int (int_size_in_bytes (TREE_TYPE (exp)));
+   hstate.add_hwi (int_size_in_bytes (TREE_TYPE (exp)));
 
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value)
  if (value)
@@ -1500,7 +1500,7 @@ sem_item::add_expr (const_tree exp, inch
 case VAR_DECL:
 case CONST_DECL:
 case PARM_DECL:
-  hstate.add_wide_int (int_size_in_bytes (TREE_TYPE (exp)));
+  hstate.add_hwi (int_size_in_bytes (TREE_TYPE (exp)));
   break;
 case MEM_REF:
 case POINTER_PLUS_EXPR:
@@ -1518,7 +1518,7 @@ sem_item::add_expr (const_tree exp, inch
   }
   break;
 CASE_CONVERT:
-  hstate.add_wide_int (int_size_in_bytes (TREE_TYPE (exp)));
+  hstate.add_hwi (int_size_in_bytes (TREE_TYPE (exp)));
   return add_expr (TREE_OPERAND (exp, 0), hstate);
 default:
   break;
@@ -1589,11 +1589,11 @@ sem_item::add_type (const_tree type, inc
 
  hstate2.add_int (nf);
  hash = hstate2.end ();
- hstate.add_wide_int (hash);
+