From 8d67ee553dc97016a8248b95bfced8f7f5d06663 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 25 Jun 2015 17:06:13 +0000 Subject: [PATCH] hash-table.h: Update comments. gcc/ * 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. gcc/c/ * c-decl.c (detect_field_duplicates_hash): Use nofree_ptr_hash instead of pointer_hash. (detect_field_duplicates): Likewise. gcc/cp/ * 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. gcc/java/ * jcf-io.c (charstar_hash): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. gcc/lto/ * lto.c (tree_scc_hasher): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. gcc/objc/ * objc-act.c (decl_name_hash): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. libcc1/ * 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. From-SVN: r224957 --- gcc/ChangeLog | 50 +++++++++++++++++++++++++++++ gcc/asan.c | 6 +--- gcc/attribs.c | 3 +- gcc/c/ChangeLog | 6 ++++ gcc/c/c-decl.c | 4 +-- gcc/cfg.c | 4 +-- gcc/config/arm/arm.c | 4 +-- gcc/config/i386/winnt.c | 4 +-- gcc/config/ia64/ia64.c | 4 +-- gcc/config/sol2.c | 4 +-- gcc/cp/ChangeLog | 8 +++++ gcc/cp/class.c | 4 +-- gcc/cp/semantics.c | 2 +- gcc/cp/tree.c | 6 ++-- gcc/cselib.c | 3 +- gcc/dse.c | 4 +-- gcc/dwarf2cfi.c | 4 +-- gcc/dwarf2out.c | 12 ++----- gcc/fold-const.c | 18 +++++------ gcc/gcse.c | 3 +- gcc/genmatch.c | 4 +-- gcc/genrecog.c | 4 +-- gcc/gimple-ssa-strength-reduction.c | 4 +-- gcc/haifa-sched.c | 3 +- gcc/hard-reg-set.h | 3 +- gcc/hash-table.h | 6 ++-- gcc/hash-traits.h | 12 +++++-- gcc/ipa-icf.h | 5 +-- gcc/ipa-profile.c | 4 +-- gcc/ira-color.c | 4 +-- gcc/java/ChangeLog | 5 +++ gcc/java/jcf-io.c | 4 +-- gcc/lto-streamer.c | 4 +-- gcc/lto-streamer.h | 4 +-- gcc/lto/ChangeLog | 5 +++ gcc/lto/lto.c | 4 +-- gcc/objc/ChangeLog | 5 +++ gcc/objc/objc-act.c | 4 +-- gcc/plugin.c | 4 +-- gcc/postreload-gcse.c | 4 +-- gcc/store-motion.c | 4 +-- gcc/tree-browser.c | 2 +- gcc/tree-sra.c | 4 +-- gcc/tree-ssa-ccp.c | 2 +- gcc/tree-ssa-coalesce.c | 8 ++--- gcc/tree-ssa-live.c | 4 +-- gcc/tree-ssa-loop-im.c | 3 +- gcc/tree-ssa-pre.c | 4 +-- gcc/tree-ssa-sccvn.c | 3 +- gcc/vtable-verify.c | 4 +-- gcc/vtable-verify.h | 4 +-- libcc1/ChangeLog | 7 ++++ libcc1/plugin.cc | 12 +++---- 53 files changed, 160 insertions(+), 146 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9220e64619..3957e1932e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,53 @@ +2015-06-25 Richard Sandiford + + * 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 * hash-traits.h (pointer_hash::mark_deleted, pointer_hash::mark_empty) diff --git a/gcc/asan.c b/gcc/asan.c index e89817e6fe2..3d72240917d 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 +struct asan_mem_ref_hasher : nofree_ptr_hash { - 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 79310779743..265009b47a2 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 +struct attribute_hasher : nofree_ptr_hash { - 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 6b3deac6cff..e727fb51288 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2015-06-25 Richard Sandiford + + * c-decl.c (detect_field_duplicates_hash): Use nofree_ptr_hash + instead of pointer_hash. + (detect_field_duplicates): Likewise. + 2015-06-25 Marek Polacek * c-array-notation.c: Use VAR_P throughout. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index fb4a83c0bd7..862151597a6 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 > *htab) + hash_table > *htab) { tree x, y; tree_node **slot; @@ -7499,7 +7499,7 @@ detect_field_duplicates (tree fieldlist) } else { - hash_table > htab (37); + hash_table > htab (37); detect_field_duplicates_hash (fieldlist, &htab); } } diff --git a/gcc/cfg.c b/gcc/cfg.c index 72f711c3917..fb13b7de06a 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 +struct bb_copy_hasher : nofree_ptr_hash { - 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 9f4e3950789..2f711be29bf 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 +struct libcall_hasher : nofree_ptr_hash { - 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 39249879b62..47ea87a3113 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 +struct wrapped_symbol_hasher : nofree_ptr_hash { - 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 1cee14b5da3..508532e5fba 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 +struct bundle_state_hasher : nofree_ptr_hash { - 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 21147d6573d..168c8951125 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 +struct comdat_entry_hasher : nofree_ptr_hash { - 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 9dc92669ced..6bc2962255b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2015-06-25 Richard Sandiford + + * 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 PR c++/66647 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9da532e18dd..007c49e4ce0 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 > *fixed_type_or_null_ref_ht; +static hash_table > *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 > (37); + = new hash_table > (37); /* Reference variables should be references to objects. */ if (nonnull) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c0abeaba1c4..cf34ddba196 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4126,7 +4126,7 @@ struct nrv_data tree var; tree result; - hash_table > visited; + hash_table > visited; }; /* Helper function for walk_tree, used by finalize_nrv below. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index bc8428db0a4..3ee2f347258 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 > *statements - = static_cast > *> (data); + hash_table > *statements + = static_cast > *> (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 > statements (37); + hash_table > statements (37); cp_walk_tree (&t, verify_stmt_tree_r, &statements, NULL); } diff --git a/gcc/cselib.c b/gcc/cselib.c index 6336e6bdc3e..6c04813dcc1 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 +struct cselib_hasher : nofree_ptr_hash { - 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 508ec006fc3..0a4ba8f8569 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 +struct invariant_group_base_hasher : nofree_ptr_hash { - 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 4af2b993927..e7117fffcc1 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 +struct trace_info_hasher : nofree_ptr_hash { - 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 843fc1e85fb..3999b727f9e 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 +struct macinfo_entry_hasher : nofree_ptr_hash { - 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 +struct comdat_type_hasher : nofree_ptr_hash { - 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 +struct loc_list_hasher : nofree_ptr_hash { - 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 6fa784a17cb..c32ac3d0a9a 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 > *); + hash_table > *); 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 > ht (32); + hash_table > 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 > ht (32); + hash_table > 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 > *ht) + hash_table > *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 > ht (32); + hash_table > 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 > ht (32); + hash_table > 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 > ht (32); + hash_table > 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 > ht (32); + hash_table > 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 > ht (32); + hash_table > ht (32); int i; md5_init_ctx (&ctx); diff --git a/gcc/gcse.c b/gcc/gcse.c index f1d3af9d03c..bcd7c8fb694 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 +struct pre_ldst_expr_hasher : nofree_ptr_hash { - 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 e7e0ed7ebc5..265210517ed 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 +struct id_base : nofree_ptr_hash { enum id_kind { CODE, FN, PREDICATE, USER } kind; @@ -189,8 +189,6 @@ struct id_base : typed_noop_remove 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 d62ba9f114a..b2e233571b9 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 +struct test_pattern_hasher : nofree_ptr_hash { - 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 81ba14b7013..1d666676c31 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 +struct cand_chain_hasher : nofree_ptr_hash { - 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 21274deca3f..5879282ed68 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 +struct delay_i1_hasher : nofree_ptr_hash { - 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 8aaf4231f75..f90ae5d0b5f 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 +struct simplifiable_subregs_hasher : nofree_ptr_hash { - 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 d0d93a353ac..31440f6f44e 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 - // Deriving from typed_noop_remove means that we get a 'remove' that does + struct some_type_hasher : nofree_ptr_hash + // 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 65ed32c8971..5afcc1103d6 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -57,10 +57,12 @@ typed_noop_remove ::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 -struct pointer_hash : typed_noop_remove +struct pointer_hash { typedef Type *value_type; typedef Type *compare_type; @@ -165,4 +167,10 @@ struct ggc_cache_hasher : ggc_hasher } }; +/* Traits for pointer elements that should not be freed when an element + is deleted. */ + +template +struct nofree_ptr_hash : pointer_hash , typed_noop_remove {}; + #endif diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index ee35ee27ac2..f229ca18ecf 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 +struct congruence_class_group_hash : nofree_ptr_hash { - 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 3de4ec5c342..9f2d67c08d5 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -102,10 +102,8 @@ static pool_allocator histogram_pool /* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR. */ -struct histogram_hash : typed_noop_remove +struct histogram_hash : nofree_ptr_hash { - 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 860547c191d..972a053402f 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -228,10 +228,8 @@ static vec allocno_stack_vec; /* Vector of unique allocno hard registers. */ static vec allocno_hard_regs_vec; -struct allocno_hard_regs_hasher : typed_noop_remove +struct allocno_hard_regs_hasher : nofree_ptr_hash { - 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 cb06d83aa8f..edc2c552361 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford + + * jcf-io.c (charstar_hash): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod * 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 8156927423a..91fe952fdb9 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 +struct charstar_hash : nofree_ptr_hash { - 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 1ac4ce1736b..c3badf8f6de 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 +struct tree_entry_hasher : nofree_ptr_hash { - 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 6eb040b8a25..1463dd99fcf 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 +struct string_slot_hasher : nofree_ptr_hash { - 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 b089bbf5d2d..08fb86d4049 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford + + * lto.c (tree_scc_hasher): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod * 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 323c4f134ae..08234d8448c 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 +struct tree_scc_hasher : nofree_ptr_hash { - 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 0450a3dc440..5d618ab1cd0 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford + + * objc-act.c (decl_name_hash): Inherit from nofree_ptr_hash rather + than typed_noop_remove. Remove redudant typedefs. + 2015-06-17 Andrew MacLeod * 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 58f4760134a..53e50e55d64 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 +struct decl_name_hash : nofree_ptr_hash { - 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 15756f3bd43..93e2e3a6a09 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 +struct event_hasher : nofree_ptr_hash { - 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 39c8c3959d1..a1ffdb4d632 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 +struct expr_hasher : nofree_ptr_hash { - 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 32bf0216d70..802c6004d4e 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 +struct st_expr_hasher : nofree_ptr_hash { - 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 bd2e0fa24b8..6a1a9f33be9 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 +struct tree_upper_hasher : nofree_ptr_hash { static inline bool equal (const value_type &, const compare_type &); }; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 8e342440e0b..7cf9f7eb551 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -341,10 +341,8 @@ static hash_map > *base_access_vec; /* Candidate hash table helpers. */ -struct uid_decl_hasher : typed_noop_remove +struct uid_decl_hasher : nofree_ptr_hash { - 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 34c3ad61291..496d84006fd 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 > gimple_htab; +typedef hash_table > 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 b6ee224e209..ee30c5ca9e8 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 +struct coalesce_pair_hasher : nofree_ptr_hash { - 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 +struct ssa_name_var_hash : nofree_ptr_hash { - 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 510e45b06e0..45d96976394 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 +struct tree_int_map_hasher : nofree_ptr_hash { - 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 8f0cc804a6d..477f373e89d 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 +struct mem_ref_hasher : nofree_ptr_hash { - 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 e8a670e5730..f766f9caf28 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 +typedef struct pre_expr_d : nofree_ptr_hash { 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 ccfa6b603ec..fc8fbeeb08d 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 +struct vn_nary_op_hasher : nofree_ptr_hash { - 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 7af54c022f1..8e24c924cc2 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_hasher : nofree_ptr_hash { - 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 fbb3bfd9734..dda6f069dba 100644 --- a/gcc/vtable-verify.h +++ b/gcc/vtable-verify.h @@ -55,10 +55,8 @@ struct vtable_registration vec offsets; /* The offsets array. */ }; -struct registration_hasher : typed_noop_remove +struct registration_hasher : nofree_ptr_hash { - 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 231ac6db16b..aba33b9c158 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,10 @@ +2015-06-25 Richard Sandiford + + * 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 * Makefile.in: Regenerated with automake-1.11.6. diff --git a/libcc1/plugin.cc b/libcc1/plugin.cc index 74a7ec3782c..4c268c32fe6 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 +struct string_hasher : nofree_ptr_hash { - 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 address_map; // A collection of trees that are preserved for the GC. - hash_table< pointer_hash > preserved; + hash_table< nofree_ptr_hash > preserved; // File name cache. hash_table file_names; @@ -245,9 +242,8 @@ plugin_context::mark () ggc_mark ((*it)->address); } - for (hash_table< pointer_hash >::iterator it = preserved.begin (); - it != preserved.end (); - ++it) + for (hash_table< nofree_ptr_hash >::iterator + it = preserved.begin (); it != preserved.end (); ++it) ggc_mark (&*it); } -- 2.30.2