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  <richard.sandif...@linaro.org>

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.000000000 +0000
+++ 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.c    2017-08-10 14:36:08.043471772 +0100
+++ gcc/ipa-devirt.c    2017-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);
+         hstate.add_hwi (hash);
          optimizer->m_type_hash_cache.put (type, hash);
        }
       else
-        hstate.add_wide_int (*val);
+        hstate.add_hwi (*val);
     }
 }
 
@@ -2108,7 +2108,7 @@ sem_variable::get_hash (void)
 
   hstate.add_int (456346417);
   if (DECL_SIZE (decl) && tree_fits_shwi_p (DECL_SIZE (decl)))
-    hstate.add_wide_int (tree_to_shwi (DECL_SIZE (decl)));
+    hstate.add_hwi (tree_to_shwi (DECL_SIZE (decl)));
   add_expr (ctor, hstate);
   set_hash (hstate.end ());
 
@@ -2720,7 +2720,7 @@ sem_item_optimizer::update_hash_by_addr_
 
                if (TYPE_NAME (class_type)
                     && DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (class_type)))
-                 hstate.add_wide_int
+                 hstate.add_hwi
                    (IDENTIFIER_HASH_VALUE
                       (DECL_ASSEMBLER_NAME (TYPE_NAME (class_type))));
 
Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c      2017-08-21 12:14:39.683583730 +0100
+++ gcc/lto-streamer-out.c      2017-10-13 14:59:35.121978207 +0100
@@ -1030,10 +1030,10 @@ #define visit(SIBLING) \
   if (CODE_CONTAINS_STRUCT (code, TS_INT_CST))
     {
       int i;
-      hstate.add_wide_int (TREE_INT_CST_NUNITS (t));
-      hstate.add_wide_int (TREE_INT_CST_EXT_NUNITS (t));
+      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_wide_int (TREE_INT_CST_ELT (t, i));
+       hstate.add_hwi (TREE_INT_CST_ELT (t, i));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST))
@@ -1058,7 +1058,7 @@ #define visit(SIBLING) \
 
   if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
     {
-      hstate.add_wide_int (DECL_MODE (t));
+      hstate.add_hwi (DECL_MODE (t));
       hstate.add_flag (DECL_NONLOCAL (t));
       hstate.add_flag (DECL_VIRTUAL_P (t));
       hstate.add_flag (DECL_IGNORED_P (t));
@@ -1151,7 +1151,7 @@ #define visit(SIBLING) \
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
     {
-      hstate.add_wide_int (TYPE_MODE (t));
+      hstate.add_hwi (TYPE_MODE (t));
       hstate.add_flag (TYPE_STRING_FLAG (t));
       /* TYPE_NO_FORCE_BLK is private to stor-layout and need
         no streaming.  */
@@ -1181,10 +1181,10 @@ #define visit(SIBLING) \
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)
       /* We don't stream these when passing things to a different target.  */
       && !lto_stream_offload_p)
-    hstate.add_wide_int (cl_target_option_hash (TREE_TARGET_OPTION (t)));
+    hstate.add_hwi (cl_target_option_hash (TREE_TARGET_OPTION (t)));
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
-    hstate.add_wide_int (cl_optimization_hash (TREE_OPTIMIZATION (t)));
+    hstate.add_hwi (cl_optimization_hash (TREE_OPTIMIZATION (t)));
 
   if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER))
     hstate.merge_hash (IDENTIFIER_HASH_VALUE (t));
@@ -1312,7 +1312,7 @@ #define visit(SIBLING) \
 
   if (CODE_CONTAINS_STRUCT (code, TS_EXP))
     {
-      hstate.add_wide_int (TREE_OPERAND_LENGTH (t));
+      hstate.add_hwi (TREE_OPERAND_LENGTH (t));
       for (int i = 0; i < TREE_OPERAND_LENGTH (t); ++i)
        visit (TREE_OPERAND (t, i));
     }
@@ -1336,7 +1336,7 @@ #define visit(SIBLING) \
     {
       unsigned i;
       tree index, value;
-      hstate.add_wide_int (CONSTRUCTOR_NELTS (t));
+      hstate.add_hwi (CONSTRUCTOR_NELTS (t));
       FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), i, index, value)
        {
          visit (index);
@@ -1349,7 +1349,7 @@ #define visit(SIBLING) \
       int i;
       HOST_WIDE_INT val;
 
-      hstate.add_wide_int (OMP_CLAUSE_CODE (t));
+      hstate.add_hwi (OMP_CLAUSE_CODE (t));
       switch (OMP_CLAUSE_CODE (t))
        {
        case OMP_CLAUSE_DEFAULT:
@@ -1374,7 +1374,7 @@ #define visit(SIBLING) \
          val = 0;
          break;
        }
-      hstate.add_wide_int (val);
+      hstate.add_hwi (val);
       for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++)
        visit (OMP_CLAUSE_OPERAND (t, i));
       visit (OMP_CLAUSE_CHAIN (t));
Index: gcc/optc-save-gen.awk
===================================================================
--- gcc/optc-save-gen.awk       2017-07-02 10:05:20.996539436 +0100
+++ gcc/optc-save-gen.awk       2017-10-13 14:59:35.121978207 +0100
@@ -678,7 +678,7 @@ for (i = 0; i < n_target_array; i++) {
 }
 for (i = 0; i < n_target_val; i++) {
        name = var_target_val[i]
-       print "  hstate.add_wide_int (ptr->" name");";
+       print "  hstate.add_hwi (ptr->" name");";
 }
 print "  return hstate.end ();";
 print "}";
@@ -766,7 +766,7 @@ for (i = 0; i < n_opt_val; i++) {
        if (!var_opt_hash[i])
                continue;
        name = var_opt_val[i]
-       print "  hstate.add_wide_int (ptr->" name");";
+       print "  hstate.add_hwi (ptr->" name");";
 }
 print "  return hstate.end ();";
 print "}";
Index: gcc/tree.c
===================================================================
--- gcc/tree.c  2017-10-13 10:23:38.959631964 +0100
+++ gcc/tree.c  2017-10-13 14:59:35.122894211 +0100
@@ -7058,7 +7058,7 @@ add_expr (const_tree t, inchash::hash &h
     case INTEGER_CST:
       gcc_checking_assert (!(flags & OEP_ADDRESS_OF));
       for (i = 0; i < TREE_INT_CST_EXT_NUNITS (t); i++)
-       hstate.add_wide_int (TREE_INT_CST_ELT (t, i));
+       hstate.add_hwi (TREE_INT_CST_ELT (t, i));
       return;
     case REAL_CST:
       {
@@ -7093,7 +7093,7 @@ add_expr (const_tree t, inchash::hash &h
       }
     case SSA_NAME:
       /* We can just compare by pointer.  */
-      hstate.add_wide_int (SSA_NAME_VERSION (t));
+      hstate.add_hwi (SSA_NAME_VERSION (t));
       return;
     case PLACEHOLDER_EXPR:
       /* The node itself doesn't matter.  */
@@ -7151,7 +7151,7 @@ add_expr (const_tree t, inchash::hash &h
       if (tclass == tcc_declaration)
        {
          /* DECL's have a unique ID */
-         hstate.add_wide_int (DECL_UID (t));
+         hstate.add_hwi (DECL_UID (t));
        }
       else if (tclass == tcc_comparison && !commutative_tree_code (code))
        {

Reply via email to