From 7edd9b154d9f03c1006722aff36caa0955198c31 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 25 Jun 2015 17:06:52 +0000 Subject: [PATCH] cgraph.h (asmname_hasher): Inherit from ggc_ptr_hash. gcc/ * cgraph.h (asmname_hasher): Inherit from ggc_ptr_hash. Remove redundant typedefs and members. * coverage.c (counts_entry): Inherit from pointer_hash. Remove redundant typedefs. * dwarf2out.c (cu_hash_table_entry_hasher): Likewise. * ipa-devirt.c (odr_name_hasher): Likewise. (polymorphic_call_target_hasher): Likewise. * ira-costs.c (cost_classes_hasher): Likewise. * statistics.c (stats_counter_hasher): Likewise. * trans-mem.c (log_entry_hasher): Likewise. * tree-ssa-dom.c (expr_elt_hasher): Likewise. * tree-ssa-sccvn.c (vn_phi_hasher, vn_reference_hasher): Likewise. * tree-ssa-tail-merge.c (same_succ_def): Likewise. * var-tracking.c (variable_hasher): Likewise. * valtrack.h (dead_debug_hash_descr): Inherit from free_ptr_hash. Remove redundant typedefs and members. From-SVN: r224961 --- gcc/ChangeLog | 19 +++++++++++++++++++ gcc/cgraph.h | 29 +---------------------------- gcc/coverage.c | 4 +--- gcc/dwarf2out.c | 3 +-- gcc/ipa-devirt.c | 8 +++----- gcc/ira-costs.c | 4 +--- gcc/statistics.c | 4 +--- gcc/trans-mem.c | 4 +--- gcc/tree-ssa-dom.c | 4 +--- gcc/tree-ssa-sccvn.c | 8 ++------ gcc/tree-ssa-tail-merge.c | 4 +--- gcc/valtrack.h | 14 +------------- gcc/var-tracking.c | 3 +-- 13 files changed, 34 insertions(+), 74 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f906d8eff6..27bbec5ab06 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2015-06-25 Richard Sandiford + + * cgraph.h (asmname_hasher): Inherit from ggc_ptr_hash. Remove + redundant typedefs and members. + * coverage.c (counts_entry): Inherit from pointer_hash. Remove + redundant typedefs. + * dwarf2out.c (cu_hash_table_entry_hasher): Likewise. + * ipa-devirt.c (odr_name_hasher): Likewise. + (polymorphic_call_target_hasher): Likewise. + * ira-costs.c (cost_classes_hasher): Likewise. + * statistics.c (stats_counter_hasher): Likewise. + * trans-mem.c (log_entry_hasher): Likewise. + * tree-ssa-dom.c (expr_elt_hasher): Likewise. + * tree-ssa-sccvn.c (vn_phi_hasher, vn_reference_hasher): Likewise. + * tree-ssa-tail-merge.c (same_succ_def): Likewise. + * var-tracking.c (variable_hasher): Likewise. + * valtrack.h (dead_debug_hash_descr): Inherit from free_ptr_hash. + Remove redundant typedefs and members. + 2015-06-25 Richard Sandiford * hash-traits.h (ggc_cache_hasher): Rename to... diff --git a/gcc/cgraph.h b/gcc/cgraph.h index d4cb94d4950..affed3a30bc 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1854,17 +1854,12 @@ enum symtab_state FINISHED }; -struct asmname_hasher +struct asmname_hasher : ggc_ptr_hash { - typedef symtab_node *value_type; typedef const_tree compare_type; static hashval_t hash (symtab_node *n); static bool equal (symtab_node *n, const_tree t); - static void ggc_mx (symtab_node *n); - static void pch_nx (symtab_node *&); - static void pch_nx (symtab_node *&, gt_pointer_operator, void *); - static void remove (symtab_node *) {} }; class GTY((tag ("SYMTAB"))) symbol_table @@ -2174,28 +2169,6 @@ asmname_hasher::equal (symtab_node *n, const_tree t) return symbol_table::decl_assembler_name_equal (n->decl, t); } -extern void gt_ggc_mx (symtab_node *&); - -inline void -asmname_hasher::ggc_mx (symtab_node *n) -{ - gt_ggc_mx (n); -} - -extern void gt_pch_nx (symtab_node *&); - -inline void -asmname_hasher::pch_nx (symtab_node *&n) -{ - gt_pch_nx (n); -} - -inline void -asmname_hasher::pch_nx (symtab_node *&n, gt_pointer_operator op, void *cookie) -{ - op (&n, cookie); -} - /* In cgraph.c */ void cgraph_c_finalize (void); void release_function_body (tree); diff --git a/gcc/coverage.c b/gcc/coverage.c index 40d788f368c..a9c5e86b331 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -86,7 +86,7 @@ struct GTY((chain_next ("%h.next"))) coverage_data }; /* Counts information for a function. */ -typedef struct counts_entry +typedef struct counts_entry : pointer_hash { /* We hash by */ unsigned ident; @@ -99,8 +99,6 @@ typedef struct counts_entry struct gcov_ctr_summary summary; /* hash_table support. */ - typedef counts_entry *value_type; - typedef counts_entry *compare_type; static inline hashval_t hash (const counts_entry *); static int equal (const counts_entry *, const counts_entry *); static void remove (counts_entry *); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0f08daacf13..11d11271c67 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6957,9 +6957,8 @@ struct cu_hash_table_entry /* Helpers to manipulate hash table of CUs. */ -struct cu_hash_table_entry_hasher +struct cu_hash_table_entry_hasher : pointer_hash { - typedef cu_hash_table_entry *value_type; typedef die_struct *compare_type; static inline hashval_t hash (const cu_hash_table_entry *); static inline bool equal (const cu_hash_table_entry *, const die_struct *); diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 1bf4b1acb6b..b735f64784a 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -383,9 +383,8 @@ type_possibly_instantiated_p (tree t) /* Hash used to unify ODR types based on their mangled name and for anonymous namespace types. */ -struct odr_name_hasher +struct odr_name_hasher : pointer_hash { - typedef odr_type_d *value_type; typedef union tree_node *compare_type; static inline hashval_t hash (const odr_type_d *); static inline bool equal (const odr_type_d *, const tree_node *); @@ -2724,10 +2723,9 @@ struct polymorphic_call_target_d /* Polymorphic call target cache helpers. */ -struct polymorphic_call_target_hasher +struct polymorphic_call_target_hasher + : pointer_hash { - typedef polymorphic_call_target_d *value_type; - typedef polymorphic_call_target_d *compare_type; static inline hashval_t hash (const polymorphic_call_target_d *); static inline bool equal (const polymorphic_call_target_d *, const polymorphic_call_target_d *); diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 972978d603a..0d39215b047 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -147,10 +147,8 @@ static cost_classes_t *regno_cost_classes; /* Helper for cost_classes hashing. */ -struct cost_classes_hasher +struct cost_classes_hasher : pointer_hash { - typedef cost_classes *value_type; - typedef cost_classes *compare_type; static inline hashval_t hash (const cost_classes *); static inline bool equal (const cost_classes *, const cost_classes *); static inline void remove (cost_classes *); diff --git a/gcc/statistics.c b/gcc/statistics.c index 233926d53a6..97884faf81e 100644 --- a/gcc/statistics.c +++ b/gcc/statistics.c @@ -46,10 +46,8 @@ typedef struct statistics_counter_s { /* Hashtable helpers. */ -struct stats_counter_hasher +struct stats_counter_hasher : pointer_hash { - typedef statistics_counter_t *value_type; - typedef statistics_counter_t *compare_type; static inline hashval_t hash (const statistics_counter_t *); static inline bool equal (const statistics_counter_t *, const statistics_counter_t *); diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 9e860ce7942..0b7c2da9d36 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -955,10 +955,8 @@ typedef struct tm_log_entry /* Log entry hashtable helpers. */ -struct log_entry_hasher +struct log_entry_hasher : pointer_hash { - typedef tm_log_entry *value_type; - typedef tm_log_entry *compare_type; static inline hashval_t hash (const tm_log_entry *); static inline bool equal (const tm_log_entry *, const tm_log_entry *); static inline void remove (tm_log_entry *); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 8cded4c78c1..e45b78c411a 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -166,10 +166,8 @@ static bool hashable_expr_equal_p (const struct hashable_expr *, const struct hashable_expr *); static void free_expr_hash_elt (void *); -struct expr_elt_hasher +struct expr_elt_hasher : pointer_hash { - typedef expr_hash_elt *value_type; - typedef expr_hash_elt *compare_type; static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); static inline void remove (value_type &); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 5f8abd14c38..15b8b85d70a 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -170,10 +170,8 @@ typedef vn_nary_op_table_type::iterator vn_nary_op_iterator_type; static int vn_phi_eq (const_vn_phi_t const vp1, const_vn_phi_t const vp2); -struct vn_phi_hasher +struct vn_phi_hasher : pointer_hash { - typedef vn_phi_s *value_type; - typedef vn_phi_s *compare_type; static inline hashval_t hash (const vn_phi_s *); static inline bool equal (const vn_phi_s *, const vn_phi_s *); static inline void remove (vn_phi_s *); @@ -238,10 +236,8 @@ free_reference (vn_reference_s *vr) /* vn_reference hashtable helpers. */ -struct vn_reference_hasher +struct vn_reference_hasher : pointer_hash { - typedef vn_reference_s *value_type; - typedef vn_reference_s *compare_type; static inline hashval_t hash (const vn_reference_s *); static inline bool equal (const vn_reference_s *, const vn_reference_s *); static inline void remove (vn_reference_s *); diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index f13ded0823a..3c660f9f0bd 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -231,7 +231,7 @@ along with GCC; see the file COPYING3. If not see Additionally, the hash value for the struct is cached in hashval, and in_worklist indicates whether it's currently part of worklist. */ -struct same_succ_def +struct same_succ_def : pointer_hash { /* The bbs that have the same successor bbs. */ bitmap bbs; @@ -248,8 +248,6 @@ struct same_succ_def hashval_t hashval; /* hash_table support. */ - typedef same_succ_def *value_type; - typedef same_succ_def *compare_type; static inline hashval_t hash (const same_succ_def *); static int equal (const same_succ_def *, const same_succ_def *); static void remove (same_succ_def *); diff --git a/gcc/valtrack.h b/gcc/valtrack.h index 67bdebb3503..7223a431989 100644 --- a/gcc/valtrack.h +++ b/gcc/valtrack.h @@ -41,18 +41,13 @@ struct dead_debug_global_entry /* Descriptor for hash_table to hash by dead_debug_global_entry's REG and map to DTEMP. */ -struct dead_debug_hash_descr +struct dead_debug_hash_descr : free_ptr_hash { - /* The hash table contains pointers to entries of this type. */ - typedef struct dead_debug_global_entry *value_type; - typedef struct dead_debug_global_entry *compare_type; /* Hash on the pseudo number. */ static inline hashval_t hash (const dead_debug_global_entry *my); /* Entries are identical if they refer to the same pseudo. */ static inline bool equal (const dead_debug_global_entry *my, const dead_debug_global_entry *other); - /* Release entries when they're removed. */ - static inline void remove (dead_debug_global_entry *p); }; /* Hash on the pseudo number. */ @@ -70,13 +65,6 @@ dead_debug_hash_descr::equal (const dead_debug_global_entry *my, return my->reg == other->reg; } -/* Release entries when they're removed. */ -inline void -dead_debug_hash_descr::remove (dead_debug_global_entry *p) -{ - XDELETE (p); -} - /* Maintain a global table of pseudos used in debug insns after their deaths in other blocks, and debug temps their deathpoint values are to be bound to. */ diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index dbf090e21b5..ebd0cfa7a7c 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -524,9 +524,8 @@ static void variable_htab_free (void *); /* Variable hashtable helpers. */ -struct variable_hasher +struct variable_hasher : pointer_hash { - typedef variable_def *value_type; typedef void *compare_type; static inline hashval_t hash (const variable_def *); static inline bool equal (const variable_def *, const void *); -- 2.30.2