diff mbox

[09/13] Make remaining pointer hashes inherit from a generic class

Message ID 87bngg10se.fsf@e105548-lin.cambridge.arm.com
State New
Headers show

Commit Message

Richard Sandiford June 16, 2015, 9:05 a.m. UTC
This patch mops up the remaining pointer traits classes that didn't
inherit from any of the standard ones and just did their own thing.

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.

Comments

Jeff Law June 23, 2015, 11:17 p.m. UTC | #1
On 06/16/2015 03:05 AM, Richard Sandiford wrote:
> This patch mops up the remaining pointer traits classes that didn't
> inherit from any of the standard ones and just did their own thing.
>
> 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.
OK.  Obviously dependent on prerequisites.

jeff
diff mbox

Patch

Index: gcc/cgraph.h
===================================================================
--- gcc/cgraph.h	2015-06-15 16:05:17.879281703 +0100
+++ gcc/cgraph.h	2015-06-15 16:05:17.863281887 +0100
@@ -1868,17 +1868,12 @@  enum symtab_state
   FINISHED
 };
 
-struct asmname_hasher
+struct asmname_hasher : ggc_ptr_hash <symtab_node>
 {
-  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
@@ -2188,28 +2183,6 @@  asmname_hasher::equal (symtab_node *n, c
   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);
Index: gcc/coverage.c
===================================================================
--- gcc/coverage.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/coverage.c	2015-06-15 16:05:17.867281842 +0100
@@ -88,7 +88,7 @@  struct GTY((chain_next ("%h.next"))) cov
 };
 
 /* Counts information for a function.  */
-typedef struct counts_entry
+typedef struct counts_entry : pointer_hash <counts_entry>
 {
   /* We hash by  */
   unsigned ident;
@@ -101,8 +101,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 *);
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/dwarf2out.c	2015-06-15 16:05:17.875281749 +0100
@@ -6959,9 +6959,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 <cu_hash_table_entry>
 {
-  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 *);
Index: gcc/ipa-devirt.c
===================================================================
--- gcc/ipa-devirt.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/ipa-devirt.c	2015-06-15 16:05:17.875281749 +0100
@@ -385,9 +385,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 <odr_type_d>
 {
-  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 *);
@@ -2731,10 +2730,9 @@  struct polymorphic_call_target_d
 
 /* Polymorphic call target cache helpers.  */
 
-struct polymorphic_call_target_hasher 
+struct polymorphic_call_target_hasher
+  : pointer_hash <polymorphic_call_target_d>
 {
-  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 *);
Index: gcc/ira-costs.c
===================================================================
--- gcc/ira-costs.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/ira-costs.c	2015-06-15 16:05:17.875281749 +0100
@@ -148,10 +148,8 @@  typedef const struct cost_classes *const
 
 /* Helper for cost_classes hashing.  */
 
-struct cost_classes_hasher
+struct cost_classes_hasher : pointer_hash <cost_classes>
 {
-  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 *);
Index: gcc/statistics.c
===================================================================
--- gcc/statistics.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/statistics.c	2015-06-15 16:05:17.863281887 +0100
@@ -47,10 +47,8 @@  typedef struct statistics_counter_s {
 
 /* Hashtable helpers.  */
 
-struct stats_counter_hasher
+struct stats_counter_hasher : pointer_hash <statistics_counter_t>
 {
-  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 *);
Index: gcc/trans-mem.c
===================================================================
--- gcc/trans-mem.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/trans-mem.c	2015-06-15 16:05:17.867281842 +0100
@@ -958,10 +958,8 @@  typedef struct tm_log_entry
 
 /* Log entry hashtable helpers.  */
 
-struct log_entry_hasher
+struct log_entry_hasher : pointer_hash <tm_log_entry>
 {
-  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 *);
Index: gcc/tree-ssa-dom.c
===================================================================
--- gcc/tree-ssa-dom.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/tree-ssa-dom.c	2015-06-15 16:05:17.875281749 +0100
@@ -169,10 +169,8 @@  static bool hashable_expr_equal_p (const
 				   const struct hashable_expr *);
 static void free_expr_hash_elt (void *);
 
-struct expr_elt_hasher
+struct expr_elt_hasher : pointer_hash <expr_hash_elt>
 {
-  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 &);
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/tree-ssa-sccvn.c	2015-06-15 16:05:17.875281749 +0100
@@ -172,10 +172,8 @@  typedef vn_nary_op_table_type::iterator
 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 <vn_phi_s>
 { 
-  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 *);
@@ -240,10 +238,8 @@  free_reference (vn_reference_s *vr)
 
 /* vn_reference hashtable helpers.  */
 
-struct vn_reference_hasher
+struct vn_reference_hasher : pointer_hash <vn_reference_s>
 {
-  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 *);
Index: gcc/tree-ssa-tail-merge.c
===================================================================
--- gcc/tree-ssa-tail-merge.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/tree-ssa-tail-merge.c	2015-06-15 16:05:17.875281749 +0100
@@ -234,7 +234,7 @@  the Free Software Foundation; either ver
    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 <same_succ_def>
 {
   /* The bbs that have the same successor bbs.  */
   bitmap bbs;
@@ -251,8 +251,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 *);
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	2015-06-15 16:05:17.879281703 +0100
+++ gcc/var-tracking.c	2015-06-15 16:05:17.875281749 +0100
@@ -525,9 +525,8 @@  static void variable_htab_free (void *);
 
 /* Variable hashtable helpers.  */
 
-struct variable_hasher
+struct variable_hasher : pointer_hash <variable_def>
 {
-  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 *);
Index: gcc/valtrack.h
===================================================================
--- gcc/valtrack.h	2015-06-15 16:05:17.879281703 +0100
+++ gcc/valtrack.h	2015-06-15 16:05:17.875281749 +0100
@@ -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 <dead_debug_global_entry>
 {
-  /* 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
   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.  */