From patchwork Tue Jun 23 14:50:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 487669 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 BB4A5140157 for ; Wed, 24 Jun 2015 00:50:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ciUNYWUQ; 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=asn lE1/WB3AJG/ZXrZYdtQbLLHHNKwUKoMOUKuUZJcVeAA+JZG3AxcYbXgqDn/ra+eB j0uxgvEJw5wKJ9+s6Y9PWZYj5FgrLskFtopPzO713ZXyN26qmHLdNvAlZKsT7Fmb 7T6N2YtWa7NRSH1ceqWK2JbLPIZ+O4E2Q8t0eBVQ= 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=MjYJhsWRZ EN+0RfOaA10SAxhKx0=; b=ciUNYWUQclzcm8DyT0GZiK3TthIri2Udk7OJy2qDF dWbYVb/lWgPmq9xGxSfD6WIZqXqGTekZxmJXsu4hyGk+oznNdz9Op94bolwQQ+MQ 5+cHJrGf+SJgKeT1dnX0l5tEWjnX3FEIjkqP0JL28U/75ug81rVWag1fCZ96oh0w ko= Received: (qmail 25239 invoked by alias); 23 Jun 2015 14:50:28 -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 25230 invoked by uid 89); 23 Jun 2015 14:50:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, 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) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Jun 2015 14:50:26 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-8-8bGuP6QgSWOX1tdiDx6Pag-1 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 23 Jun 2015 15:50:23 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [07/12] Use new string hasher for MIPS References: <87egl2bicm.fsf@e105548-lin.cambridge.arm.com> Date: Tue, 23 Jun 2015 15:50:23 +0100 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: <87fv5ia380.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: 8bGuP6QgSWOX1tdiDx6Pag-1 Use the string hasher from patch 6 for MIPS. I split this out because local_alias_traits doesn't actually need to use SYMBOL_REF rtxes as the map keys, since the only data used is the symbol name. gcc/ * config/mips/mips.c (mips16_flip_traits): Use it. (local_alias_traits, mips16_local_aliases): Convert from a map of rtxes to a map of symbol names. (mips16_local_alias): Update accordingly. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2015-06-23 15:49:32.187081876 +0100 +++ gcc/config/mips/mips.c 2015-06-23 15:49:32.183081933 +0100 @@ -1265,15 +1265,7 @@ static int mips_register_move_cost (mach static unsigned int mips_function_arg_boundary (machine_mode, const_tree); static machine_mode mips_get_reg_raw_mode (int regno); -struct mips16_flip_traits : default_hashmap_traits -{ - static hashval_t hash (const char *s) { return htab_hash_string (s); } - static bool - equal_keys (const char *a, const char *b) - { - return !strcmp (a, b); - } -}; +struct mips16_flip_traits : simple_hashmap_traits {}; /* This hash table keeps track of implicit "mips16" and "nomips16" attributes for -mflip_mips16. It maps decl names onto a boolean mode setting. */ @@ -6601,30 +6593,13 @@ mips_load_call_address (enum mips_call_t } } -struct local_alias_traits : default_hashmap_traits -{ - static hashval_t hash (rtx); - static bool equal_keys (rtx, rtx); -}; +struct local_alias_traits : simple_hashmap_traits {}; /* Each locally-defined hard-float MIPS16 function has a local symbol associated with it. This hash table maps the function symbol (FUNC) to the local symbol (LOCAL). */ -static GTY (()) hash_map *mips16_local_aliases; - -/* Hash table callbacks for mips16_local_aliases. */ - -hashval_t -local_alias_traits::hash (rtx func) -{ - return htab_hash_string (XSTR (func, 0)); -} - -bool -local_alias_traits::equal_keys (rtx func1, rtx func2) -{ - return rtx_equal_p (func1, func2); -} +static GTY (()) hash_map + *mips16_local_aliases; /* FUNC is the symbol for a locally-defined hard-float MIPS16 function. Return a local alias for it, creating a new one if necessary. */ @@ -6635,23 +6610,23 @@ mips16_local_alias (rtx func) /* Create the hash table if this is the first call. */ if (mips16_local_aliases == NULL) mips16_local_aliases - = hash_map::create_ggc (37); + = hash_map::create_ggc (37); /* Look up the function symbol, creating a new entry if need be. */ bool existed; - rtx *slot = &mips16_local_aliases->get_or_insert (func, &existed); + const char *func_name = XSTR (func, 0); + rtx *slot = &mips16_local_aliases->get_or_insert (func_name, &existed); gcc_assert (slot != NULL); if (!existed) { - const char *func_name, *local_name; rtx local; /* Create a new SYMBOL_REF for the local symbol. The choice of __fn_local_* is based on the __fn_stub_* names that we've traditionally used for the non-MIPS16 stub. */ func_name = targetm.strip_name_encoding (XSTR (func, 0)); - local_name = ACONCAT (("__fn_local_", func_name, NULL)); + const char *local_name = ACONCAT (("__fn_local_", func_name, NULL)); local = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (local_name)); SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL;