diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9220e64619ed1e0c497d2d2265e5ca83a94b7a4..3957e1932e4c2ca023a0ca15c0103125c86efb63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,53 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * hash-table.h: Update comments. + * hash-traits.h (pointer_hash): Don't inherit from typed_noop_remove. + (nofree_ptr_hash): New class. + * asan.c (asan_mem_ref_hasher): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + * attribs.c (attribute_hasher): Likewise. + * cfg.c (bb_copy_hasher): Likewise. + * cselib.c (cselib_hasher): Likewise. + * dse.c (invariant_group_base_hasher): Likewise. + * dwarf2cfi.c (trace_info_hasher): Likewise. + * dwarf2out.c (macinfo_entry_hasher): Likewise. + (comdat_type_hasher, loc_list_hasher): Likewise. + * gcse.c (pre_ldst_expr_hasher): Likewise. + * genmatch.c (id_base): Likewise. + * genrecog.c (test_pattern_hasher): Likewise. + * gimple-ssa-strength-reduction.c (cand_chain_hasher): Likewise. + * haifa-sched.c (delay_i1_hasher): Likewise. + * hard-reg-set.h (simplifiable_subregs_hasher): Likewise. + * ipa-icf.h (congruence_class_group_hash): Likewise. + * ipa-profile.c (histogram_hash): Likewise. + * ira-color.c (allocno_hard_regs_hasher): Likewise. + * lto-streamer.h (string_slot_hasher): Likewise. + * lto-streamer.c (tree_entry_hasher): Likewise. + * plugin.c (event_hasher): Likewise. + * postreload-gcse.c (expr_hasher): Likewise. + * store-motion.c (st_expr_hasher): Likewise. + * tree-sra.c (uid_decl_hasher): Likewise. + * tree-ssa-coalesce.c (coalesce_pair_hasher): Likewise. + (ssa_name_var_hash): Likewise. + * tree-ssa-live.c (tree_int_map_hasher): Likewise. + * tree-ssa-loop-im.c (mem_ref_hasher): Likewise. + * tree-ssa-pre.c (pre_expr_d): Likewise. + * tree-ssa-sccvn.c (vn_nary_op_hasher): Likewise. + * vtable-verify.h (registration_hasher): Likewise. + * vtable-verify.c (vtbl_map_hasher): Likewise. + * config/arm/arm.c (libcall_hasher): Likewise. + * config/i386/winnt.c (wrapped_symbol_hasher): Likewise. + * config/ia64/ia64.c (bundle_state_hasher): Likewise. + * config/sol2.c (comdat_entry_hasher): Likewise. + * fold-const.c (fold): Use nofree_ptr_hash instead of pointer_hash. + (print_fold_checksum, fold_checksum_tree): Likewise. + (debug_fold_checksum, fold_build1_stat_loc): Likewise. + (fold_build2_stat_loc, fold_build3_stat_loc): Likewise. + (fold_build_call_array_loc): Likewise. + * tree-ssa-ccp.c (gimple_htab): Likewise. + * tree-browser.c (tree_upper_hasher): Inherit from nofree_ptr_hash + rather than pointer_type. + 2015-06-25 Richard Sandiford <richard.sandiford@arm.com> * hash-traits.h (pointer_hash::mark_deleted, pointer_hash::mark_empty) diff --git a/gcc/asan.c b/gcc/asan.c index e89817e6fe295fd5571ba3e5d05021a3dccad81e..3d72240917d17673caeb52163734452de97e1f21 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -426,12 +426,8 @@ asan_mem_ref_get_end (const asan_mem_ref *ref, tree len) return asan_mem_ref_get_end (ref->start, len); } -struct asan_mem_ref_hasher - : typed_noop_remove <asan_mem_ref> +struct asan_mem_ref_hasher : nofree_ptr_hash <asan_mem_ref> { - typedef asan_mem_ref *value_type; - typedef asan_mem_ref *compare_type; - static inline hashval_t hash (const asan_mem_ref *); static inline bool equal (const asan_mem_ref *, const asan_mem_ref *); }; diff --git a/gcc/attribs.c b/gcc/attribs.c index 793107797432ed336078178edbb3068a4e5410e6..265009b47a2e945bd3178533212b235eabd48429 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -57,9 +57,8 @@ substring_hash (const char *str, int l) /* Used for attribute_hash. */ -struct attribute_hasher : typed_noop_remove <attribute_spec> +struct attribute_hasher : nofree_ptr_hash <attribute_spec> { - typedef attribute_spec *value_type; typedef substring *compare_type; static inline hashval_t hash (const attribute_spec *); static inline bool equal (const attribute_spec *, const substring *); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 6b3deac6cffbb59273695058b2d9a2565e712a91..e727fb51288e14d52d96c06073fd7ca0f432251b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * c-decl.c (detect_field_duplicates_hash): Use nofree_ptr_hash + instead of pointer_hash. + (detect_field_duplicates): Likewise. + 2015-06-25 Marek Polacek <polacek@redhat.com> * c-array-notation.c: Use VAR_P throughout. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index fb4a83c0bd7d6fdd2034a5463e9968473dcde1b8..862151597a618433b7140866efe7527831b970cc 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7399,7 +7399,7 @@ is_duplicate_field (tree x, tree y) static void detect_field_duplicates_hash (tree fieldlist, - hash_table<pointer_hash <tree_node> > *htab) + hash_table<nofree_ptr_hash <tree_node> > *htab) { tree x, y; tree_node **slot; @@ -7499,7 +7499,7 @@ detect_field_duplicates (tree fieldlist) } else { - hash_table<pointer_hash <tree_node> > htab (37); + hash_table<nofree_ptr_hash <tree_node> > htab (37); detect_field_duplicates_hash (fieldlist, &htab); } } diff --git a/gcc/cfg.c b/gcc/cfg.c index 72f711c3917612c72f2a2aa153be4ebef3b91b2a..fb13b7de06a19bee08477cc18027769b55cf1cae 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -1023,10 +1023,8 @@ struct htab_bb_copy_original_entry int index2; }; -struct bb_copy_hasher : typed_noop_remove <htab_bb_copy_original_entry> +struct bb_copy_hasher : nofree_ptr_hash <htab_bb_copy_original_entry> { - typedef htab_bb_copy_original_entry *value_type; - typedef htab_bb_copy_original_entry *compare_type; static inline hashval_t hash (const htab_bb_copy_original_entry *); static inline bool equal (const htab_bb_copy_original_entry *existing, const htab_bb_copy_original_entry * candidate); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 9f4e3950789c3310783c7b7f6c66159263f5b7d4..2f711be29bf2197a0edb05a7ec77c6cc3f796726 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -5038,10 +5038,8 @@ arm_function_value(const_tree type, const_tree func, /* libcall hashtable helpers. */ -struct libcall_hasher : typed_noop_remove <rtx_def> +struct libcall_hasher : nofree_ptr_hash <const rtx_def> { - typedef const rtx_def *value_type; - typedef const rtx_def *compare_type; static inline hashval_t hash (const rtx_def *); static inline bool equal (const rtx_def *, const rtx_def *); static inline void remove (rtx_def *); diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 39249879b62f5e68a38b2622d6526dc14bee0be8..47ea87a3113dbd85815f767e265b672a3397df61 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -709,10 +709,8 @@ i386_pe_record_stub (const char *name) /* Hashtable helpers. */ -struct wrapped_symbol_hasher : typed_noop_remove <char> +struct wrapped_symbol_hasher : nofree_ptr_hash <const char> { - typedef const char *value_type; - typedef const char *compare_type; static inline hashval_t hash (const char *); static inline bool equal (const char *, const char *); static inline void remove (const char *); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 1cee14b5da3126224fd6a93ccc7af82d55994e72..508532e5fbaa8d4446c1a7eeeca91524447fd9c7 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -8579,10 +8579,8 @@ finish_bundle_states (void) /* Hashtable helpers. */ -struct bundle_state_hasher : typed_noop_remove <bundle_state> +struct bundle_state_hasher : nofree_ptr_hash <bundle_state> { - typedef bundle_state *value_type; - typedef bundle_state *compare_type; static inline hashval_t hash (const bundle_state *); static inline bool equal (const bundle_state *, const bundle_state *); }; diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index 21147d6573d91f2b08d4d04b340a8d80437ca360..168c89511253931006ff63af9c810da7eb471cff 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -172,10 +172,8 @@ typedef struct comdat_entry /* Helpers for maintaining solaris_comdat_htab. */ -struct comdat_entry_hasher : typed_noop_remove <comdat_entry> +struct comdat_entry_hasher : nofree_ptr_hash <comdat_entry> { - typedef comdat_entry *value_type; - typedef comdat_entry *compare_type; static inline hashval_t hash (const comdat_entry *); static inline bool equal (const comdat_entry *, const comdat_entry *); static inline void remove (comdat_entry *); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9dc92669cedc99b4c4902454b3fc3aeba7ab6408..6bc2962255b2caa93ec617ed21b7ba49eab25397 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * class.c (fixed_type_or_null_ref_ht): Inherit from nofree_ptr_hash + rather than pointer_hash. + (fixed_type_or_null): Use nofree_ptr_hash instead of pointer_hash. + * semantics.c (nrv_data): Likewise. + * tree.c (verify_stmt_tree_r, verify_stmt_tree): Likewise. + 2015-06-24 Jason Merrill <jason@redhat.com> PR c++/66647 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9da532e18dd4eb204b0fd3263ebea5f755da1da7..007c49e4ce09f6c856e2f689c8c4190b84e322e8 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6916,7 +6916,7 @@ finish_struct (tree t, tree attributes) } /* Hash table to avoid endless recursion when handling references. */ -static hash_table<pointer_hash<tree_node> > *fixed_type_or_null_ref_ht; +static hash_table<nofree_ptr_hash<tree_node> > *fixed_type_or_null_ref_ht; /* Return the dynamic type of INSTANCE, if known. Used to determine whether the virtual function table is needed @@ -7035,7 +7035,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp) /* We only need one hash table because it is always left empty. */ if (!fixed_type_or_null_ref_ht) fixed_type_or_null_ref_ht - = new hash_table<pointer_hash<tree_node> > (37); + = new hash_table<nofree_ptr_hash<tree_node> > (37); /* Reference variables should be references to objects. */ if (nonnull) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c0abeaba1c4c0bff8b056b4dcd20191ecf07fdd9..cf34ddba19617e1c3d44e2eb393bb5c412792643 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4126,7 +4126,7 @@ struct nrv_data tree var; tree result; - hash_table<pointer_hash <tree_node> > visited; + hash_table<nofree_ptr_hash <tree_node> > visited; }; /* Helper function for walk_tree, used by finalize_nrv below. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index bc8428db0a4825004091851e1f13e17d81136c22..3ee2f347258123df9e70acf950deae032a44dc2b 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2197,8 +2197,8 @@ static tree verify_stmt_tree_r (tree* tp, int * /*walk_subtrees*/, void* data) { tree t = *tp; - hash_table<pointer_hash <tree_node> > *statements - = static_cast <hash_table<pointer_hash <tree_node> > *> (data); + hash_table<nofree_ptr_hash <tree_node> > *statements + = static_cast <hash_table<nofree_ptr_hash <tree_node> > *> (data); tree_node **slot; if (!STATEMENT_CODE_P (TREE_CODE (t))) @@ -2221,7 +2221,7 @@ verify_stmt_tree_r (tree* tp, int * /*walk_subtrees*/, void* data) void verify_stmt_tree (tree t) { - hash_table<pointer_hash <tree_node> > statements (37); + hash_table<nofree_ptr_hash <tree_node> > statements (37); cp_walk_tree (&t, verify_stmt_tree_r, &statements, NULL); } diff --git a/gcc/cselib.c b/gcc/cselib.c index 6336e6bdc3e18286e76fc9aff4bac93f620f21e4..6c04813dcc126f837cfae47377ab489a7716df26 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -106,9 +106,8 @@ static rtx cselib_expand_value_rtx_1 (rtx, struct expand_value_data *, int); this involves walking the table entries for a given value and comparing the locations of the entries with the rtx we are looking up. */ -struct cselib_hasher : typed_noop_remove <cselib_val> +struct cselib_hasher : nofree_ptr_hash <cselib_val> { - typedef cselib_val *value_type; struct key { /* The rtx value and its mode (needed separately for constant integers). */ diff --git a/gcc/dse.c b/gcc/dse.c index 508ec006fc3819dd9b73dca275cf4a3e07bdf419..0a4ba8f85698ccce1828a919e698d40d3f25949c 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -732,10 +732,8 @@ clear_alias_set_lookup (alias_set_type alias_set) /* Hashtable callbacks for maintaining the "bases" field of store_group_info, given that the addresses are function invariants. */ -struct invariant_group_base_hasher : typed_noop_remove <group_info> +struct invariant_group_base_hasher : nofree_ptr_hash <group_info> { - typedef group_info *value_type; - typedef group_info *compare_type; static inline hashval_t hash (const group_info *); static inline bool equal (const group_info *, const group_info *); }; diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 4af2b9939275f066b2274f95b494a90beec24944..e7117fffcc130b44ed4d5b7e953b2248eb9abe1a 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -167,10 +167,8 @@ typedef dw_trace_info *dw_trace_info_ref; /* Hashtable helpers. */ -struct trace_info_hasher : typed_noop_remove <dw_trace_info> +struct trace_info_hasher : nofree_ptr_hash <dw_trace_info> { - typedef dw_trace_info *value_type; - typedef dw_trace_info *compare_type; static inline hashval_t hash (const dw_trace_info *); static inline bool equal (const dw_trace_info *, const dw_trace_info *); }; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 843fc1e85fb58a93b13934f31db022b043676c73..3999b727f9e199b6ebe108095bb92aa57b9aee5e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22779,10 +22779,8 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED, /* Helpers to manipulate hash table of CUs. */ -struct macinfo_entry_hasher : typed_noop_remove <macinfo_entry> +struct macinfo_entry_hasher : nofree_ptr_hash <macinfo_entry> { - typedef macinfo_entry *value_type; - typedef macinfo_entry *compare_type; static inline hashval_t hash (const macinfo_entry *); static inline bool equal (const macinfo_entry *, const macinfo_entry *); }; @@ -23871,10 +23869,8 @@ file_table_relative_p (dwarf_file_data **slot, bool *p) /* Helpers to manipulate hash table of comdat type units. */ -struct comdat_type_hasher : typed_noop_remove <comdat_type_node> +struct comdat_type_hasher : nofree_ptr_hash <comdat_type_node> { - typedef comdat_type_node *value_type; - typedef comdat_type_node *compare_type; static inline hashval_t hash (const comdat_type_node *); static inline bool equal (const comdat_type_node *, const comdat_type_node *); }; @@ -24984,10 +24980,8 @@ compare_locs (dw_loc_descr_ref x, dw_loc_descr_ref y) /* Hashtable helpers. */ -struct loc_list_hasher : typed_noop_remove <dw_loc_list_struct> +struct loc_list_hasher : nofree_ptr_hash <dw_loc_list_struct> { - typedef dw_loc_list_struct *value_type; - typedef dw_loc_list_struct *compare_type; static inline hashval_t hash (const dw_loc_list_struct *); static inline bool equal (const dw_loc_list_struct *, const dw_loc_list_struct *); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6fa784a17cbf704975b62c4f8162113386cbf2a9..c32ac3d0a9a601d0f042c58af729472400dc7137 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13868,7 +13868,7 @@ fold (tree expr) #undef fold static void fold_checksum_tree (const_tree, struct md5_ctx *, - hash_table<pointer_hash<const tree_node> > *); + hash_table<nofree_ptr_hash<const tree_node> > *); static void fold_check_failed (const_tree, const_tree); void print_fold_checksum (const_tree); @@ -13882,7 +13882,7 @@ fold (tree expr) tree ret; struct md5_ctx ctx; unsigned char checksum_before[16], checksum_after[16]; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (expr, &ctx, &ht); @@ -13906,7 +13906,7 @@ print_fold_checksum (const_tree expr) { struct md5_ctx ctx; unsigned char checksum[16], cnt; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (expr, &ctx, &ht); @@ -13924,7 +13924,7 @@ fold_check_failed (const_tree expr ATTRIBUTE_UNUSED, const_tree ret ATTRIBUTE_UN static void fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, - hash_table<pointer_hash <const tree_node> > *ht) + hash_table<nofree_ptr_hash <const tree_node> > *ht) { const tree_node **slot; enum tree_code code; @@ -14085,7 +14085,7 @@ debug_fold_checksum (const_tree t) int i; unsigned char checksum[16]; struct md5_ctx ctx; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (t, &ctx, &ht); @@ -14113,7 +14113,7 @@ fold_build1_stat_loc (location_t loc, #ifdef ENABLE_FOLD_CHECKING unsigned char checksum_before[16], checksum_after[16]; struct md5_ctx ctx; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (op0, &ctx, &ht); @@ -14154,7 +14154,7 @@ fold_build2_stat_loc (location_t loc, checksum_after_op0[16], checksum_after_op1[16]; struct md5_ctx ctx; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (op0, &ctx, &ht); @@ -14208,7 +14208,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type, checksum_after_op1[16], checksum_after_op2[16]; struct md5_ctx ctx; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); md5_init_ctx (&ctx); fold_checksum_tree (op0, &ctx, &ht); @@ -14274,7 +14274,7 @@ fold_build_call_array_loc (location_t loc, tree type, tree fn, checksum_after_fn[16], checksum_after_arglist[16]; struct md5_ctx ctx; - hash_table<pointer_hash<const tree_node> > ht (32); + hash_table<nofree_ptr_hash<const tree_node> > ht (32); int i; md5_init_ctx (&ctx); diff --git a/gcc/gcse.c b/gcc/gcse.c index f1d3af9d03ccf9e1913e56a918add4b62925afef..bcd7c8fb694b54953104356f97cce7556ed1fb05 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -374,9 +374,8 @@ struct ls_expr /* Head of the list of load/store memory refs. */ static struct ls_expr * pre_ldst_mems = NULL; -struct pre_ldst_expr_hasher : typed_noop_remove <ls_expr> +struct pre_ldst_expr_hasher : nofree_ptr_hash <ls_expr> { - typedef ls_expr *value_type; typedef value_type compare_type; static inline hashval_t hash (const ls_expr *); static inline bool equal (const ls_expr *, const ls_expr *); diff --git a/gcc/genmatch.c b/gcc/genmatch.c index e7e0ed7ebc5217065a3c77e9df82caec11e953ce..265210517edd2fa0add67dab87946d3ecc8bd227 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -178,7 +178,7 @@ END_BUILTINS /* Base class for all identifiers the parser knows. */ -struct id_base : typed_noop_remove<id_base> +struct id_base : nofree_ptr_hash<id_base> { enum id_kind { CODE, FN, PREDICATE, USER } kind; @@ -189,8 +189,6 @@ struct id_base : typed_noop_remove<id_base> const char *id; /* hash_table support. */ - typedef id_base *value_type; - typedef id_base *compare_type; static inline hashval_t hash (const id_base *); static inline int equal (const id_base *, const id_base *); }; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index d62ba9f114a38c2e52a90a7b6c07177cdb6bbdde..b2e233571b994f21459b41b157fa696596a584ed 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -2519,10 +2519,8 @@ merge_relative_positions (position **roota, position *a, /* A hasher of states that treats two states as "equal" if they might be merged (but trying to be more discriminating than "return true"). */ -struct test_pattern_hasher : typed_noop_remove <merge_state_info> +struct test_pattern_hasher : nofree_ptr_hash <merge_state_info> { - typedef merge_state_info *value_type; - typedef merge_state_info *compare_type; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); }; diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 81ba14b701388b23f670526105271dcd9ba2a8f6..1d666676c31aa434509e22f3fedf338f9b9d7243 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -424,10 +424,8 @@ lookup_cand (cand_idx idx) /* Helper for hashing a candidate chain header. */ -struct cand_chain_hasher : typed_noop_remove <cand_chain> +struct cand_chain_hasher : nofree_ptr_hash <cand_chain> { - typedef cand_chain *value_type; - typedef cand_chain *compare_type; static inline hashval_t hash (const cand_chain *); static inline bool equal (const cand_chain *, const cand_chain *); }; diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 21274deca3fcff1217a0ee470cce6d6ae6bf2226..5879282ed6844d0c9fa4c4700a26715076f453c3 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -613,9 +613,8 @@ struct delay_pair /* Helpers for delay hashing. */ -struct delay_i1_hasher : typed_noop_remove <delay_pair> +struct delay_i1_hasher : nofree_ptr_hash <delay_pair> { - typedef delay_pair *value_type; typedef void *compare_type; static inline hashval_t hash (const delay_pair *); static inline bool equal (const delay_pair *, const void *); diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index 8aaf4231f7508ecbdd02265c175219bf3f975132..f90ae5d0b5f2e6685bb384abade4ef4d79ef516e 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -616,9 +616,8 @@ extern char global_regs[FIRST_PSEUDO_REGISTER]; struct simplifiable_subreg; struct subreg_shape; -struct simplifiable_subregs_hasher : typed_noop_remove <simplifiable_subreg> +struct simplifiable_subregs_hasher : nofree_ptr_hash <simplifiable_subreg> { - typedef simplifiable_subreg *value_type; typedef const subreg_shape *compare_type; static inline hashval_t hash (const simplifiable_subreg *); diff --git a/gcc/hash-table.h b/gcc/hash-table.h index d0d93a353ac820bac19fe537fafb34fa4917919c..31440f6f44e49485e00ebc25929f8dc11990803f 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -118,12 +118,10 @@ along with GCC; see the file COPYING3. If not see Suppose you want to put some_type into the hash table. You could define the descriptor type as follows. - struct some_type_hasher : typed_noop_remove <some_type> - // Deriving from typed_noop_remove means that we get a 'remove' that does + struct some_type_hasher : nofree_ptr_hash <some_type> + // Deriving from nofree_ptr_hash means that we get a 'remove' that does // nothing. This choice is good for raw values. { - typedef some_type value_type; - typedef some_type compare_type; static inline hashval_t hash (const value_type *); static inline bool equal (const value_type *, const compare_type *); }; diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h index 65ed32c89715260f7ba4ee773b1dc7ec77cb9a97..5afcc1103d623c3c8ec2497a57291c74623dea10 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -57,10 +57,12 @@ typed_noop_remove <Type>::remove (Type *p ATTRIBUTE_UNUSED) } -/* Pointer hash with a no-op remove method. */ +/* Pointer hasher based on pointer equality. Other types of pointer hash + can inherit this and override the hash and equal functions with some + other form of equality (such as string equality). */ template <typename Type> -struct pointer_hash : typed_noop_remove <Type> +struct pointer_hash { typedef Type *value_type; typedef Type *compare_type; @@ -165,4 +167,10 @@ struct ggc_cache_hasher : ggc_hasher<T> } }; +/* Traits for pointer elements that should not be freed when an element + is deleted. */ + +template <typename T> +struct nofree_ptr_hash : pointer_hash <T>, typed_noop_remove <T> {}; + #endif diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index ee35ee27ac26090a8e55b29ea26f93f9479c8a75..f229ca18ecf151181bd4759627d161a6ec92f4e5 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -439,11 +439,8 @@ struct congruence_class_group }; /* Congruence class set structure. */ -struct congruence_class_group_hash: typed_noop_remove <congruence_class_group> +struct congruence_class_group_hash : nofree_ptr_hash <congruence_class_group> { - typedef congruence_class_group *value_type; - typedef congruence_class_group *compare_type; - static inline hashval_t hash (const congruence_class_group *item) { return item->hash; diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c index 3de4ec5c34243f6fa80cd04454888420dd42063b..9f2d67c08d5aa87bd4f90b6d30fb77870bc9ad04 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -102,10 +102,8 @@ static pool_allocator<histogram_entry> histogram_pool /* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR. */ -struct histogram_hash : typed_noop_remove <histogram_entry> +struct histogram_hash : nofree_ptr_hash <histogram_entry> { - typedef histogram_entry *value_type; - typedef histogram_entry *compare_type; static inline hashval_t hash (const histogram_entry *); static inline int equal (const histogram_entry *, const histogram_entry *); }; diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 860547c191d3a91a12837ee7f4fc8bddf03dc6ed..972a053402fd03dcc40adaa09bd93d1e85ac5f65 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -228,10 +228,8 @@ static vec<ira_allocno_t> allocno_stack_vec; /* Vector of unique allocno hard registers. */ static vec<allocno_hard_regs_t> allocno_hard_regs_vec; -struct allocno_hard_regs_hasher : typed_noop_remove <allocno_hard_regs> +struct allocno_hard_regs_hasher : nofree_ptr_hash <allocno_hard_regs> { - typedef allocno_hard_regs *value_type; - typedef allocno_hard_regs *compare_type; static inline hashval_t hash (const allocno_hard_regs *); static inline bool equal (const allocno_hard_regs *, const allocno_hard_regs *); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index cb06d83aa8f3badb0d2eb42ded676f4cf2eae009..edc2c552361abfd2dd7847c906f99aa87651b2fc 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * jcf-io.c (charstar_hash): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Do not include input.h, line-map.h or is-a.h. diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index 8156927423af8a9e54e16b729c5b87e784f85c94..91fe952fdb9158acd524c7defcadf955d3f3c3e7 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -275,10 +275,8 @@ find_classfile (char *filename, JCF *jcf, const char *dep_name) /* Hash table helper. */ -struct charstar_hash : typed_noop_remove <char> +struct charstar_hash : nofree_ptr_hash <const char> { - typedef const char *value_type; - typedef const char *compare_type; static inline hashval_t hash (const char *candidate); static inline bool equal (const char *existing, const char *candidate); }; diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c index 1ac4ce1736bacd4dcab52d4b53b3aa54ca87d376..c3badf8f6de592297366fc7d3c24efd951cef915 100644 --- a/gcc/lto-streamer.c +++ b/gcc/lto-streamer.c @@ -281,10 +281,8 @@ struct tree_hash_entry intptr_t value; }; -struct tree_entry_hasher : typed_noop_remove <tree_hash_entry> +struct tree_entry_hasher : nofree_ptr_hash <tree_hash_entry> { - typedef tree_hash_entry value_type; - typedef tree_hash_entry compare_type; static inline hashval_t hash (const value_type *); static inline bool equal (const value_type *, const compare_type *); }; diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 6eb040b8a25a6eaafb620f95ceaec2f3bbc14f6d..1463dd99fcfb17e5a92c93fd27e8f1a836b99a79 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -652,10 +652,8 @@ struct string_slot /* Hashtable helpers. */ -struct string_slot_hasher : typed_noop_remove <string_slot> +struct string_slot_hasher : nofree_ptr_hash <string_slot> { - typedef string_slot *value_type; - typedef string_slot *compare_type; static inline hashval_t hash (const string_slot *); static inline bool equal (const string_slot *, const string_slot *); }; diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index b089bbf5d2d3685fedf003636b629e0abffd772e..08fb86d4049f087068fa17663141a1f07d26fc28 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * lto.c (tree_scc_hasher): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Do not include input.h, line-map.h or is-a.h. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 323c4f134aead7ae4777e233ea5dc384c73babc7..08234d8448cc20b3a91ab01c73326007db7cf845 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -937,10 +937,8 @@ struct tree_scc tree entries[1]; }; -struct tree_scc_hasher : typed_noop_remove <tree_scc> +struct tree_scc_hasher : nofree_ptr_hash <tree_scc> { - typedef tree_scc *value_type; - typedef tree_scc *compare_type; static inline hashval_t hash (const tree_scc *); static inline bool equal (const tree_scc *, const tree_scc *); }; diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 0450a3dc4406f356248f34a4b1d7d57b29d5d674..5d618ab1cd057c383d5c0fef6e6f5854446b17a3 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * objc-act.c (decl_name_hash): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Do not include input.h, line-map.h or is-a.h. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 58f4760134a3472928ad3fcabff2dc8ef6f9bcee..53e50e55d64fae2d967cec7af71f9d212060f263 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3856,10 +3856,8 @@ objc_get_class_ivars (tree class_name) more like a set). So, we store the DECLs, but define equality as DECLs having the same name, and hash as the hash of the name. */ -struct decl_name_hash : typed_noop_remove <tree_node> +struct decl_name_hash : nofree_ptr_hash <tree_node> { - typedef tree_node *value_type; - typedef tree_node *compare_type; static inline hashval_t hash (const tree_node *); static inline bool equal (const tree_node *, const tree_node *); }; diff --git a/gcc/plugin.c b/gcc/plugin.c index 15756f3bd43ecb52786074b91e24a2fa764e4906..93e2e3a6a097cf6c3b50266b9c4b15e2d6fdf453 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -55,10 +55,8 @@ const char **plugin_event_name = plugin_event_name_init; /* Event hashtable helpers. */ -struct event_hasher : typed_noop_remove <const char *> +struct event_hasher : nofree_ptr_hash <const char *> { - typedef const char **value_type; - typedef const char **compare_type; static inline hashval_t hash (const char **); static inline bool equal (const char **, const char **); }; diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c index 39c8c3959d1d4d46ab1ee7460e55193eb35329da..a1ffdb4d632c78bf1d2f535ec42f265458d2ee18 100644 --- a/gcc/postreload-gcse.c +++ b/gcc/postreload-gcse.c @@ -120,10 +120,8 @@ struct expr /* Hashtable helpers. */ -struct expr_hasher : typed_noop_remove <expr> +struct expr_hasher : nofree_ptr_hash <expr> { - typedef expr *value_type; - typedef expr *compare_type; static inline hashval_t hash (const expr *); static inline bool equal (const expr *, const expr *); }; diff --git a/gcc/store-motion.c b/gcc/store-motion.c index 32bf0216d70f304989be92604ac9cbbc601327ac..802c6004d4edaf929f74ec9fa027ecc4a50c527b 100644 --- a/gcc/store-motion.c +++ b/gcc/store-motion.c @@ -122,10 +122,8 @@ static struct edge_list *edge_list; /* Hashtable helpers. */ -struct st_expr_hasher : typed_noop_remove <st_expr> +struct st_expr_hasher : nofree_ptr_hash <st_expr> { - typedef st_expr *value_type; - typedef st_expr *compare_type; static inline hashval_t hash (const st_expr *); static inline bool equal (const st_expr *, const st_expr *); }; diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c index bd2e0fa24b8a4203baed9a41e4cf738a752f7bd4..6a1a9f33be9e4b1ea425b335e99de76bae81db75 100644 --- a/gcc/tree-browser.c +++ b/gcc/tree-browser.c @@ -104,7 +104,7 @@ static tree TB_history_prev (void); void browse_tree (tree); /* Hashtable helpers. */ -struct tree_upper_hasher : pointer_hash<tree_node> +struct tree_upper_hasher : nofree_ptr_hash<tree_node> { static inline bool equal (const value_type &, const compare_type &); }; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 8e342440e0b254825145bae63843f2b7fb8db41c..7cf9f7eb551addf3bab12aa1f4acd01675f24690 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -341,10 +341,8 @@ static hash_map<tree, auto_vec<access_p> > *base_access_vec; /* Candidate hash table helpers. */ -struct uid_decl_hasher : typed_noop_remove <tree_node> +struct uid_decl_hasher : nofree_ptr_hash <tree_node> { - typedef tree_node *value_type; - typedef tree_node *compare_type; static inline hashval_t hash (const tree_node *); static inline bool equal (const tree_node *, const tree_node *); }; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 34c3ad612913f112263faa0b72c77c532cf4f3f7..496d84006fd7460245c739b0ba8be35fdb9cb47d 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1972,7 +1972,7 @@ evaluate_stmt (gimple stmt) return val; } -typedef hash_table<pointer_hash<gimple_statement_base> > gimple_htab; +typedef hash_table<nofree_ptr_hash<gimple_statement_base> > gimple_htab; /* Given a BUILT_IN_STACK_SAVE value SAVED_VAL, insert a clobber of VAR before each matching BUILT_IN_STACK_RESTORE. Mark visited phis in VISITED. */ diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index b6ee224e2093a737cf1f79bc6c0f5f8f92e4efd5..ee30c5ca9e81fec0a745650a5da00c424c1e1f13 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -69,10 +69,8 @@ typedef const struct coalesce_pair *const_coalesce_pair_p; /* Coalesce pair hashtable helpers. */ -struct coalesce_pair_hasher : typed_noop_remove <coalesce_pair> +struct coalesce_pair_hasher : nofree_ptr_hash <coalesce_pair> { - typedef coalesce_pair *value_type; - typedef coalesce_pair *compare_type; static inline hashval_t hash (const coalesce_pair *); static inline bool equal (const coalesce_pair *, const coalesce_pair *); }; @@ -1239,10 +1237,8 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl, /* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR. */ -struct ssa_name_var_hash : typed_noop_remove <tree_node> +struct ssa_name_var_hash : nofree_ptr_hash <tree_node> { - typedef union tree_node *value_type; - typedef union tree_node *compare_type; static inline hashval_t hash (const tree_node *); static inline int equal (const tree_node *, const tree_node *); }; diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 510e45b06e0cf7f1e249cf54faf81f5416073e97..45d969763940f90b049aa4ce62eb5fae2315b229 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -89,10 +89,8 @@ static void verify_live_on_entry (tree_live_info_p); /* Hashtable helpers. */ -struct tree_int_map_hasher : typed_noop_remove <tree_int_map> +struct tree_int_map_hasher : nofree_ptr_hash <tree_int_map> { - typedef tree_int_map *value_type; - typedef tree_int_map *compare_type; static inline hashval_t hash (const tree_int_map *); static inline bool equal (const tree_int_map *, const tree_int_map *); }; diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 8f0cc804a6d489024eaef95fca24c186e6383de0..477f373e89d6c08a35f378864486b0a330c884b9 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -159,9 +159,8 @@ typedef struct im_mem_ref /* Mem_ref hashtable helpers. */ -struct mem_ref_hasher : typed_noop_remove <im_mem_ref> +struct mem_ref_hasher : nofree_ptr_hash <im_mem_ref> { - typedef im_mem_ref *value_type; typedef tree_node *compare_type; static inline hashval_t hash (const im_mem_ref *); static inline bool equal (const im_mem_ref *, const tree_node *); diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index e8a670e5730e83486723914214e362db782edbcb..f766f9caf28a4974bd905edc803f01cc237e4c15 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -207,15 +207,13 @@ typedef union pre_expr_union_d vn_reference_t reference; } pre_expr_union; -typedef struct pre_expr_d : typed_noop_remove <pre_expr_d> +typedef struct pre_expr_d : nofree_ptr_hash <pre_expr_d> { enum pre_expr_kind kind; unsigned int id; pre_expr_union u; /* hash_table support. */ - typedef pre_expr_d *value_type; - typedef pre_expr_d *compare_type; static inline hashval_t hash (const pre_expr_d *); static inline int equal (const pre_expr_d *, const pre_expr_d *); } *pre_expr; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index ccfa6b603ecf6d87f9e3ee60131c396eb932d740..fc8fbeeb08d415ed641db0bbb8429705c6fabeb9 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -137,9 +137,8 @@ static vn_lookup_kind default_vn_walk_kind; /* vn_nary_op hashtable helpers. */ -struct vn_nary_op_hasher : typed_noop_remove <vn_nary_op_s> +struct vn_nary_op_hasher : nofree_ptr_hash <vn_nary_op_s> { - typedef vn_nary_op_s *value_type; typedef vn_nary_op_s *compare_type; static inline hashval_t hash (const vn_nary_op_s *); static inline bool equal (const vn_nary_op_s *, const vn_nary_op_s *); diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c index 7af54c022f1388fb61955c71aaf055cf8209148e..8e24c924cc20e6938b1a9b549cfa1e3369a1b863 100644 --- a/gcc/vtable-verify.c +++ b/gcc/vtable-verify.c @@ -282,10 +282,8 @@ registration_hasher::equal (const vtable_registration *p1, /* Hashtable definition and functions for vtbl_map_hash. */ -struct vtbl_map_hasher : typed_noop_remove <struct vtbl_map_node> +struct vtbl_map_hasher : nofree_ptr_hash <struct vtbl_map_node> { - typedef struct vtbl_map_node *value_type; - typedef struct vtbl_map_node *compare_type; static inline hashval_t hash (const vtbl_map_node *); static inline bool equal (const vtbl_map_node *, const vtbl_map_node *); }; diff --git a/gcc/vtable-verify.h b/gcc/vtable-verify.h index fbb3bfd9734c8a0c472dece9e2d637af5e2c09f8..dda6f069dba41a9a29e6ea65e8da7c09efb9f954 100644 --- a/gcc/vtable-verify.h +++ b/gcc/vtable-verify.h @@ -55,10 +55,8 @@ struct vtable_registration vec<unsigned> offsets; /* The offsets array. */ }; -struct registration_hasher : typed_noop_remove <struct vtable_registration> +struct registration_hasher : nofree_ptr_hash <struct vtable_registration> { - typedef struct vtable_registration *value_type; - typedef struct vtable_registration *compare_type; static inline hashval_t hash (const vtable_registration *); static inline bool equal (const vtable_registration *, const vtable_registration *); diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index 231ac6db16bbb609a02c042f6ce5e00a5dadae22..aba33b9c1581123b2309550df7297d030a1ee9f7 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,10 @@ +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + + * plugin.cc (string_hasher): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + (plugin_context): Use nofree_ptr_hash rather than pointer_hash. + (plugin_context::mark): Likewise. + 2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com> * Makefile.in: Regenerated with automake-1.11.6. diff --git a/libcc1/plugin.cc b/libcc1/plugin.cc index 74a7ec3782ce3205ebc6569e5389dcddf13191dc..4c268c32fe6a84d813e860b4458eaae43550778c 100644 --- a/libcc1/plugin.cc +++ b/libcc1/plugin.cc @@ -134,11 +134,8 @@ decl_addr_hasher::equal (const decl_addr_value *p1, const decl_addr_value *p2) -struct string_hasher : typed_noop_remove<const char> +struct string_hasher : nofree_ptr_hash<const char> { - typedef const char *value_type; - typedef const char *compare_type; - static inline hashval_t hash (const char *s) { return htab_hash_string (s); @@ -176,7 +173,7 @@ struct plugin_context : public cc1_plugin::connection hash_table<decl_addr_hasher> address_map; // A collection of trees that are preserved for the GC. - hash_table< pointer_hash<tree_node> > preserved; + hash_table< nofree_ptr_hash<tree_node> > preserved; // File name cache. hash_table<string_hasher> file_names; @@ -245,9 +242,8 @@ plugin_context::mark () ggc_mark ((*it)->address); } - for (hash_table< pointer_hash<tree_node> >::iterator it = preserved.begin (); - it != preserved.end (); - ++it) + for (hash_table< nofree_ptr_hash<tree_node> >::iterator + it = preserved.begin (); it != preserved.end (); ++it) ggc_mark (&*it); }