From 449e9a33887046acec46f373f96900fc07735355 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sun, 22 Oct 2017 20:42:06 +0000 Subject: [PATCH] Rename inchash::hash::add_wide_int 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. 2017-10-22 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. From-SVN: r253987 --- gcc/ChangeLog | 13 +++++++++++++ gcc/inchash.h | 2 +- gcc/ipa-devirt.c | 8 ++++---- gcc/ipa-icf.c | 22 +++++++++++----------- gcc/lto-streamer-out.c | 22 +++++++++++----------- gcc/optc-save-gen.awk | 4 ++-- gcc/tree.c | 6 +++--- 7 files changed, 45 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78cd3cea361..2e7eda14715 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2017-10-22 Richard Sandiford + + * 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. + 2017-10-22 Uros Bizjak PR target/52451 diff --git a/gcc/inchash.h b/gcc/inchash.h index 6af1dadfc67..29e9e6d0513 100644 --- a/gcc/inchash.h +++ b/gcc/inchash.h @@ -58,7 +58,7 @@ class 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); } diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index f0aecfbc455..f03c7f099f7 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -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 (const polymorphic_call_target_d *odr_query { 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); diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index e666d5ab2d0..3f6f432483b 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -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)); @@ -1438,8 +1438,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); @@ -1486,7 +1486,7 @@ sem_item::add_expr (const_tree exp, inchash::hash &hstate) 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) @@ -1501,7 +1501,7 @@ sem_item::add_expr (const_tree exp, inchash::hash &hstate) 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: @@ -1519,7 +1519,7 @@ sem_item::add_expr (const_tree exp, inchash::hash &hstate) } 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; @@ -1590,11 +1590,11 @@ sem_item::add_type (const_tree type, inchash::hash &hstate) 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); } } @@ -2114,7 +2114,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 ()); @@ -2726,7 +2726,7 @@ sem_item_optimizer::update_hash_by_addr_refs () 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)))); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index d007c0af5d6..f9f76775d06 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1030,10 +1030,10 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, { 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, 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)); diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index fc582103f6f..7e734356ca7 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -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 "}"; diff --git a/gcc/tree.c b/gcc/tree.c index 62a438609af..fa6fcb1da71 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7073,7 +7073,7 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) 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: { @@ -7108,7 +7108,7 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) } 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. */ @@ -7166,7 +7166,7 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) 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)) { -- 2.30.2