From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14956 invoked by alias); 23 Jun 2015 14:47:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14944 invoked by uid 89); 23 Jun 2015 14:47:03 -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_40,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, 23 Jun 2015 14:47:03 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-3-omnfxDAGT8SarHdZ_E6r-A-1 Received: from localhost ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 23 Jun 2015 15:47:00 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [04/12] Move ssa_name hasher to header file References: <87egl2bicm.fsf@e105548-lin.cambridge.arm.com> Date: Tue, 23 Jun 2015 14:48:00 -0000 In-Reply-To: <87egl2bicm.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Tue, 23 Jun 2015 15:38:17 +0100") Message-ID: <87si9ia3do.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: omnfxDAGT8SarHdZ_E6r-A-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-06/txt/msg01569.txt.bz2 Another tree hasher, this time for SSA names. Again there's only one copy at the moment, but the idea seems general. gcc/ * tree-hash-traits.h (tree_ssa_name_hasher): New class. * sese.c: Include tree-hash-traits.h. (rename_map_hasher): Use tree_ssa_name_hasher. Index: gcc/tree-hash-traits.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/tree-hash-traits.h 2015-06-23 15:46:11.453390373 +0100 +++ gcc/tree-hash-traits.h 2015-06-23 15:46:11.449390427 +0100 @@ -53,4 +53,18 @@ tree_decl_hash::hash (tree t) return DECL_UID (t); } =20 +/* Hash for SSA_NAMEs in the same function. Pointer equality is enough + here, but the SSA_NAME_VERSION is a better hash than the pointer + value and gives a predictable traversal order. */ +struct tree_ssa_name_hash : ggc_ptr_hash +{ + static inline hashval_t hash (tree); +}; + +inline hashval_t +tree_ssa_name_hash::hash (tree t) +{ + return SSA_NAME_VERSION (t); +} + #endif Index: gcc/sese.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/sese.c 2015-06-23 15:46:11.453390373 +0100 +++ gcc/sese.c 2015-06-23 15:46:11.449390427 +0100 @@ -63,6 +63,7 @@ the Free Software Foundation; either ver #include "value-prof.h" #include "sese.h" #include "tree-ssa-propagate.h" +#include "tree-hash-traits.h" =20 /* Helper function for debug_rename_map. */ =20 @@ -78,22 +79,7 @@ debug_rename_map_1 (tree_node *const &ol return true; } =0C - -/* Hashtable helpers. */ - -struct rename_map_hasher : default_hashmap_traits -{ - static inline hashval_t hash (tree); -}; - -/* Computes a hash function for database element ELT. */ - -inline hashval_t -rename_map_hasher::hash (tree old_name) -{ - return SSA_NAME_VERSION (old_name); -} - +typedef simple_hashmap_traits rename_map_hasher; typedef hash_map rename_map_type; =0C =20