From: Richard Sandiford Date: Thu, 25 Jun 2015 17:06:24 +0000 (+0000) Subject: hash-traits.h (free_ptr_hash): New class. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95fbe13e99744b36691495fd81934ccee963c0a3;p=gcc.git hash-traits.h (free_ptr_hash): New class. gcc/ * hash-traits.h (free_ptr_hash): New class. * dwarf2out.c (decl_table_entry_hasher): Inherit from free_ptr_hash rather than typed_free_remove. Remove redudant typedefs. (external_ref_hasher): Likewise. * except.c (action_record_hasher, ttypes_filter_hasher): Likewise. (ehspec_hasher): Likewise. * ggc-common.c (saving_hasher): Likewise. * gimplify.c (gimplify_hasher): Likewise. * haifa-sched.c (delay_i2_hasher): Likewise. * loop-invariant.c (invariant_expr_hasher): Likewise. * loop-iv.c (biv_entry_hasher): Likewise. * loop-unroll.c (iv_split_hasher, var_expand_hasher): Likewise. * trans-mem.c (tm_mem_map_hasher, tm_memop_hasher): Likewise. * tree-cfg.c (locus_discrim_hasher): Likewise. * tree-eh.c (finally_tree_hasher): Likewise. * tree-into-ssa.c (var_info_hasher): Likewise. * tree-parloops.c (reduction_hasher, name_to_copy_hasher): Likewise. * tree-ssa-loop-ivopts.c (iv_inv_expr_hasher): Likewise. * tree-ssa-phiopt.c (ssa_names_hasher): Likewise. * tree-ssa-pre.c (expr_pred_trans_d): Likewise. * tree-ssa-sccvn.c (vn_constant_hasher): Likewise. * tree-ssa-structalias.c (equiv_class_hasher): Likewise. (shared_bitmap_hasher): Likewise. * tree-ssa-threadupdate.c (redirection_data): Likewise. * tree-vectorizer.h (peel_info_hasher): Likewise. * tree-vectorizer.c (simduid_to_vf, simd_array_to_simduid): Likewise. * config/mips/mips.c (mips_lo_sum_offset_hasher): Likewise. libcc1/ * plugin.cc (decl_addr_hasher): Inherit from free_ptr_hash rather than typed_free_remove. Remove redudant typedefs. From-SVN: r224958 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3957e1932e4..b3d064e24e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,33 @@ +2015-06-25 Richard Sandiford + + * hash-traits.h (free_ptr_hash): New class. + * dwarf2out.c (decl_table_entry_hasher): Inherit from free_ptr_hash + rather than typed_free_remove. Remove redudant typedefs. + (external_ref_hasher): Likewise. + * except.c (action_record_hasher, ttypes_filter_hasher): Likewise. + (ehspec_hasher): Likewise. + * ggc-common.c (saving_hasher): Likewise. + * gimplify.c (gimplify_hasher): Likewise. + * haifa-sched.c (delay_i2_hasher): Likewise. + * loop-invariant.c (invariant_expr_hasher): Likewise. + * loop-iv.c (biv_entry_hasher): Likewise. + * loop-unroll.c (iv_split_hasher, var_expand_hasher): Likewise. + * trans-mem.c (tm_mem_map_hasher, tm_memop_hasher): Likewise. + * tree-cfg.c (locus_discrim_hasher): Likewise. + * tree-eh.c (finally_tree_hasher): Likewise. + * tree-into-ssa.c (var_info_hasher): Likewise. + * tree-parloops.c (reduction_hasher, name_to_copy_hasher): Likewise. + * tree-ssa-loop-ivopts.c (iv_inv_expr_hasher): Likewise. + * tree-ssa-phiopt.c (ssa_names_hasher): Likewise. + * tree-ssa-pre.c (expr_pred_trans_d): Likewise. + * tree-ssa-sccvn.c (vn_constant_hasher): Likewise. + * tree-ssa-structalias.c (equiv_class_hasher): Likewise. + (shared_bitmap_hasher): Likewise. + * tree-ssa-threadupdate.c (redirection_data): Likewise. + * tree-vectorizer.h (peel_info_hasher): Likewise. + * tree-vectorizer.c (simduid_to_vf, simd_array_to_simduid): Likewise. + * config/mips/mips.c (mips_lo_sum_offset_hasher): Likewise. + 2015-06-25 Richard Sandiford * hash-table.h: Update comments. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1c837cf7c90..3e0adf00c50 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -16346,9 +16346,8 @@ mips_hash_base (rtx base) /* Hashtable helpers. */ -struct mips_lo_sum_offset_hasher : typed_free_remove +struct mips_lo_sum_offset_hasher : free_ptr_hash { - typedef mips_lo_sum_offset *value_type; typedef rtx_def *compare_type; static inline hashval_t hash (const mips_lo_sum_offset *); static inline bool equal (const mips_lo_sum_offset *, const rtx_def *); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 3999b727f9e..4b89d3e667d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7294,9 +7294,8 @@ struct decl_table_entry /* Hashtable helpers. */ -struct decl_table_entry_hasher : typed_free_remove +struct decl_table_entry_hasher : free_ptr_hash { - typedef decl_table_entry *value_type; typedef die_struct *compare_type; static inline hashval_t hash (const decl_table_entry *); static inline bool equal (const decl_table_entry *, const die_struct *); @@ -7836,10 +7835,8 @@ struct external_ref /* Hashtable helpers. */ -struct external_ref_hasher : typed_free_remove +struct external_ref_hasher : free_ptr_hash { - typedef external_ref *value_type; - typedef external_ref *compare_type; static inline hashval_t hash (const external_ref *); static inline bool equal (const external_ref *, const external_ref *); }; diff --git a/gcc/except.c b/gcc/except.c index cb830885b94..ce1e31f0645 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -205,10 +205,8 @@ struct action_record /* Hashtable helpers. */ -struct action_record_hasher : typed_free_remove +struct action_record_hasher : free_ptr_hash { - typedef action_record *value_type; - typedef action_record *compare_type; static inline hashval_t hash (const action_record *); static inline bool equal (const action_record *, const action_record *); }; @@ -721,9 +719,8 @@ struct ttypes_filter { /* Helper for ttypes_filter hashing. */ -struct ttypes_filter_hasher : typed_free_remove +struct ttypes_filter_hasher : free_ptr_hash { - typedef ttypes_filter *value_type; typedef tree_node *compare_type; static inline hashval_t hash (const ttypes_filter *); static inline bool equal (const ttypes_filter *, const tree_node *); @@ -749,10 +746,8 @@ typedef hash_table ttypes_hash_type; /* Helper for ehspec hashing. */ -struct ehspec_hasher : typed_free_remove +struct ehspec_hasher : free_ptr_hash { - typedef ttypes_filter *value_type; - typedef ttypes_filter *compare_type; static inline hashval_t hash (const ttypes_filter *); static inline bool equal (const ttypes_filter *, const ttypes_filter *); }; diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 60d427f8f11..5096837df27 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -237,9 +237,8 @@ struct ptr_data /* Helper for hashing saving_htab. */ -struct saving_hasher : typed_free_remove +struct saving_hasher : free_ptr_hash { - typedef ptr_data *value_type; typedef void *compare_type; static inline hashval_t hash (const ptr_data *); static inline bool equal (const ptr_data *, const void *); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7492d933868..5f4936c3250 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -126,10 +126,8 @@ enum omp_region_type /* Gimplify hashtable helper. */ -struct gimplify_hasher : typed_free_remove +struct gimplify_hasher : free_ptr_hash { - typedef elt_t *value_type; - typedef elt_t *compare_type; static inline hashval_t hash (const elt_t *); static inline bool equal (const elt_t *, const elt_t *); }; diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 5879282ed68..fd6e3e929e6 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -636,9 +636,8 @@ delay_i1_hasher::equal (const delay_pair *x, const void *y) return x->i1 == y; } -struct delay_i2_hasher : typed_free_remove +struct delay_i2_hasher : free_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/hash-traits.h b/gcc/hash-traits.h index 5afcc1103d6..e4c182eabf2 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -173,4 +173,10 @@ struct ggc_cache_hasher : ggc_hasher template struct nofree_ptr_hash : pointer_hash , typed_noop_remove {}; +/* Traits for pointer elements that should be freed via free() when an + element is deleted. */ + +template +struct free_ptr_hash : pointer_hash , typed_free_remove {}; + #endif diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 92d8e4c638a..d3a74399f1b 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -441,10 +441,8 @@ invariant_expr_equal_p (rtx_insn *insn1, rtx e1, rtx_insn *insn2, rtx e2) return true; } -struct invariant_expr_hasher : typed_free_remove +struct invariant_expr_hasher : free_ptr_hash { - typedef invariant_expr_entry *value_type; - typedef invariant_expr_entry *compare_type; static inline hashval_t hash (const invariant_expr_entry *); static inline bool equal (const invariant_expr_entry *, const invariant_expr_entry *); diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index c0d6a1d3f3f..d02d5429715 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -124,9 +124,8 @@ static struct loop *current_loop; /* Hashtable helper. */ -struct biv_entry_hasher : typed_free_remove +struct biv_entry_hasher : free_ptr_hash { - typedef biv_entry *value_type; typedef rtx_def *compare_type; static inline hashval_t hash (const biv_entry *); static inline bool equal (const biv_entry *, const rtx_def *); diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index e2e2f23f95e..3fa7fc0ceeb 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -112,10 +112,8 @@ struct var_to_expand /* Hashtable helper for iv_to_split. */ -struct iv_split_hasher : typed_free_remove +struct iv_split_hasher : free_ptr_hash { - typedef iv_to_split *value_type; - typedef iv_to_split *compare_type; static inline hashval_t hash (const iv_to_split *); static inline bool equal (const iv_to_split *, const iv_to_split *); }; @@ -139,10 +137,8 @@ iv_split_hasher::equal (const iv_to_split *i1, const iv_to_split *i2) /* Hashtable helper for iv_to_split. */ -struct var_expand_hasher : typed_free_remove +struct var_expand_hasher : free_ptr_hash { - typedef var_to_expand *value_type; - typedef var_to_expand *compare_type; static inline hashval_t hash (const var_to_expand *); static inline bool equal (const var_to_expand *, const var_to_expand *); }; diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index ded1e513705..b3dbcbd795c 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -1030,10 +1030,8 @@ typedef struct tm_new_mem_map /* Hashtable helpers. */ -struct tm_mem_map_hasher : typed_free_remove +struct tm_mem_map_hasher : free_ptr_hash { - typedef tm_new_mem_map_t *value_type; - typedef tm_new_mem_map_t *compare_type; static inline hashval_t hash (const tm_new_mem_map_t *); static inline bool equal (const tm_new_mem_map_t *, const tm_new_mem_map_t *); }; @@ -3331,10 +3329,8 @@ typedef struct tm_memop /* TM memory operation hashtable helpers. */ -struct tm_memop_hasher : typed_free_remove +struct tm_memop_hasher : free_ptr_hash { - typedef tm_memop *value_type; - typedef tm_memop *compare_type; static inline hashval_t hash (const tm_memop *); static inline bool equal (const tm_memop *, const tm_memop *); }; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index adc56bab388..c16e7baddbd 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -132,10 +132,8 @@ struct locus_discrim_map /* Hashtable helpers. */ -struct locus_discrim_hasher : typed_free_remove +struct locus_discrim_hasher : free_ptr_hash { - typedef locus_discrim_map *value_type; - typedef locus_discrim_map *compare_type; static inline hashval_t hash (const locus_discrim_map *); static inline bool equal (const locus_discrim_map *, const locus_discrim_map *); diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 7c141ad5f73..edd43e6a7fd 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -198,10 +198,8 @@ struct finally_tree_node /* Hashtable helpers. */ -struct finally_tree_hasher : typed_free_remove +struct finally_tree_hasher : free_ptr_hash { - typedef finally_tree_node *value_type; - typedef finally_tree_node *compare_type; static inline hashval_t hash (const finally_tree_node *); static inline bool equal (const finally_tree_node *, const finally_tree_node *); diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 4c4a3401058..24cca2cf9b1 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -215,10 +215,8 @@ typedef struct var_info_d *var_info_p; /* VAR_INFOS hashtable helpers. */ -struct var_info_hasher : typed_free_remove +struct var_info_hasher : free_ptr_hash { - typedef var_info_d *value_type; - typedef var_info_d *compare_type; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); }; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index e582fe759ba..ac469b39d7a 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -218,10 +218,8 @@ struct reduction_info /* Reduction info hashtable helpers. */ -struct reduction_hasher : typed_free_remove +struct reduction_hasher : free_ptr_hash { - typedef reduction_info *value_type; - typedef reduction_info *compare_type; static inline hashval_t hash (const reduction_info *); static inline bool equal (const reduction_info *, const reduction_info *); }; @@ -270,10 +268,8 @@ struct name_to_copy_elt /* Name copies hashtable helpers. */ -struct name_to_copy_hasher : typed_free_remove +struct name_to_copy_hasher : free_ptr_hash { - typedef name_to_copy_elt *value_type; - typedef name_to_copy_elt *compare_type; static inline hashval_t hash (const name_to_copy_elt *); static inline bool equal (const name_to_copy_elt *, const name_to_copy_elt *); }; diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index cab5acfc8d5..8dd92a6ec8c 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -283,10 +283,8 @@ typedef struct iv_cand *iv_cand_p; /* Hashtable helpers. */ -struct iv_inv_expr_hasher : typed_free_remove +struct iv_inv_expr_hasher : free_ptr_hash { - typedef iv_inv_expr_ent *value_type; - typedef iv_inv_expr_ent *compare_type; static inline hashval_t hash (const iv_inv_expr_ent *); static inline bool equal (const iv_inv_expr_ent *, const iv_inv_expr_ent *); }; diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index d2a5cee2329..92b4ab00fb4 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1309,10 +1309,8 @@ struct name_to_bb /* Hashtable helpers. */ -struct ssa_names_hasher : typed_free_remove +struct ssa_names_hasher : free_ptr_hash { - typedef name_to_bb *value_type; - typedef name_to_bb *compare_type; static inline hashval_t hash (const name_to_bb *); static inline bool equal (const name_to_bb *, const name_to_bb *); }; diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index f766f9caf28..9872a3fa8f3 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -515,7 +515,7 @@ static bitmap need_ab_cleanup; /* A three tuple {e, pred, v} used to cache phi translations in the phi_translate_table. */ -typedef struct expr_pred_trans_d : typed_free_remove +typedef struct expr_pred_trans_d : free_ptr_hash { /* The expression. */ pre_expr e; @@ -531,8 +531,6 @@ typedef struct expr_pred_trans_d : typed_free_remove hashval_t hashcode; /* hash_table support. */ - typedef expr_pred_trans_d *value_type; - typedef expr_pred_trans_d *compare_type; static inline hashval_t hash (const expr_pred_trans_d *); static inline int equal (const expr_pred_trans_d *, const expr_pred_trans_d *); } *expr_pred_trans_t; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index fc8fbeeb08d..5f8abd14c38 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -286,10 +286,8 @@ typedef struct vn_tables_s /* vn_constant hashtable helpers. */ -struct vn_constant_hasher : typed_free_remove +struct vn_constant_hasher : free_ptr_hash { - typedef vn_constant_s *value_type; - typedef vn_constant_s *compare_type; static inline hashval_t hash (const vn_constant_s *); static inline bool equal (const vn_constant_s *, const vn_constant_s *); }; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index cef73fa38e7..820dae48a9d 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -1925,10 +1925,8 @@ typedef const struct equiv_class_label *const_equiv_class_label_t; /* Equiv_class_label hashtable helpers. */ -struct equiv_class_hasher : typed_free_remove +struct equiv_class_hasher : free_ptr_hash { - typedef equiv_class_label *value_type; - typedef equiv_class_label *compare_type; static inline hashval_t hash (const equiv_class_label *); static inline bool equal (const equiv_class_label *, const equiv_class_label *); @@ -5950,10 +5948,8 @@ typedef const struct shared_bitmap_info *const_shared_bitmap_info_t; /* Shared_bitmap hashtable helpers. */ -struct shared_bitmap_hasher : typed_free_remove +struct shared_bitmap_hasher : free_ptr_hash { - typedef shared_bitmap_info *value_type; - typedef shared_bitmap_info *compare_type; static inline hashval_t hash (const shared_bitmap_info *); static inline bool equal (const shared_bitmap_info *, const shared_bitmap_info *); diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 2b018f8cdec..4b190221097 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -125,7 +125,7 @@ struct el may have many incoming edges threaded to the same outgoing edge. This can be naturally implemented with a hash table. */ -struct redirection_data : typed_free_remove +struct redirection_data : free_ptr_hash { /* We support wiring up two block duplicates in a jump threading path. @@ -150,8 +150,6 @@ struct redirection_data : typed_free_remove struct el *incoming_edges; /* hash_table support. */ - typedef redirection_data *value_type; - typedef redirection_data *compare_type; static inline hashval_t hash (const redirection_data *); static inline int equal (const redirection_data *, const redirection_data *); }; diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 9d178026a2f..e69cbfb70e3 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -102,14 +102,12 @@ vec stmt_vec_info_vec; /* For mapping simduid to vectorization factor. */ -struct simduid_to_vf : typed_free_remove +struct simduid_to_vf : free_ptr_hash { unsigned int simduid; int vf; /* hash_table support. */ - typedef simduid_to_vf *value_type; - typedef simduid_to_vf *compare_type; static inline hashval_t hash (const simduid_to_vf *); static inline int equal (const simduid_to_vf *, const simduid_to_vf *); }; @@ -138,14 +136,12 @@ simduid_to_vf::equal (const simduid_to_vf *p1, const simduid_to_vf *p2) This hash maps from the OMP simd array (D.1737[]) to DECL_UID of simduid.0. */ -struct simd_array_to_simduid : typed_free_remove +struct simd_array_to_simduid : free_ptr_hash { tree decl; unsigned int simduid; /* hash_table support. */ - typedef simd_array_to_simduid *value_type; - typedef simd_array_to_simduid *compare_type; static inline hashval_t hash (const simd_array_to_simduid *); static inline int equal (const simd_array_to_simduid *, const simd_array_to_simduid *); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index d3e788b8785..48c1f8d64b7 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -212,10 +212,8 @@ typedef struct _vect_peel_extended_info /* Peeling hashtable helpers. */ -struct peel_info_hasher : typed_free_remove <_vect_peel_info> +struct peel_info_hasher : free_ptr_hash <_vect_peel_info> { - typedef _vect_peel_info *value_type; - typedef _vect_peel_info *compare_type; static inline hashval_t hash (const _vect_peel_info *); static inline bool equal (const _vect_peel_info *, const _vect_peel_info *); }; diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index aba33b9c158..2aaceda2dd0 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Richard Sandiford + + * plugin.cc (decl_addr_hasher): Inherit from free_ptr_hash + rather than typed_free_remove. Remove redudant typedefs. + 2015-06-25 Richard Sandiford * plugin.cc (string_hasher): Inherit from nofree_ptr_hash rather diff --git a/libcc1/plugin.cc b/libcc1/plugin.cc index 4c268c32fe6..57fca7c9a7b 100644 --- a/libcc1/plugin.cc +++ b/libcc1/plugin.cc @@ -111,11 +111,8 @@ struct decl_addr_value tree address; }; -struct decl_addr_hasher : typed_free_remove +struct decl_addr_hasher : free_ptr_hash { - typedef decl_addr_value *value_type; - typedef decl_addr_value *compare_type; - static inline hashval_t hash (const decl_addr_value *); static inline bool equal (const decl_addr_value *, const decl_addr_value *); };