From patchwork Tue Jun 16 09:05:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 484867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 73D5714010F for ; Tue, 16 Jun 2015 19:05:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=O0rmgoDA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=wpy pI+rf1YmDcstvn3MXAxNAUaYsJMXfCeHMMpaHkL0CffbrC2rQbRzPVyFGrmXj3HB 1efdbKgyU+MrAIhmem2LIMbnrtnWuh8do3pL4QPInip50saMLj6dpPoAZwtUHelZ HWidnYjFui567O5wcuxy8MWh6b9DSO/f+pdUXgp8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=dPjXGQRbf SQBV05TbarBJMvchxs=; b=O0rmgoDABPVS9qTbwz53ZW+rLLwzUnF2po6u+lS+y RatNGiJezZTX8aPzAdaSs2tze3ztRgzutDf1urpYjsFazBmieiAD10ClnhwclWQ2 DefCTrGsQXyvptYiZkH/0gNbjeUxVBNj0OQ1aj15olHlFJJHRE9M9Ivy11l9f9Pg Js= Received: (qmail 97171 invoked by alias); 16 Jun 2015 09:05:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 97160 invoked by uid 89); 16 Jun 2015 09:05:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jun 2015 09:05:08 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-7.uk.mimecast.lan; Tue, 16 Jun 2015 10:05:05 +0100 Received: from localhost ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 16 Jun 2015 10:05:05 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [09/13] Make remaining pointer hashes inherit from a generic class References: <87fv5s2gej.fsf@e105548-lin.cambridge.arm.com> Date: Tue, 16 Jun 2015 10:05:05 +0100 In-Reply-To: <87fv5s2gej.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Tue, 16 Jun 2015 09:42:28 +0100") Message-ID: <87bngg10se.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: -AxHPfwjQtWXeGGS4E8_ew-1 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. 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 { - 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 { /* 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { /* 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 { - 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 { - /* 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. */