From patchwork Thu Sep 30 06:47:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 45594 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDE3C3857C66 for ; Thu, 30 Sep 2021 06:48:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 9E8373858C39 for ; Thu, 30 Sep 2021 06:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E8373858C39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: t+ZXD7ivGNFruLSGIeR6BFtmYWGedq8deruYh3BC2acxr0Lbc/W0BP6AJiZx8ZOPxGCfF/1q/2 UYcVOCKIWDEUFDZgTavDjXw7EjrQ4opYfzpgmTvC+g59jEv76t2keT6Eop9nPpbHXDc6VRWtRA LRORf/7spEZKiWn39itD9nWoKvLuJcS6AnHrsHpb0QJtzgaNEoyAyhm1gDysftFU6pU40RI972 HQ9zqMYaXckXIki7hVu9e8GYWfDbTFKWV7qZMH8LUvBzjeUpo6pTlJPRo7IEj4tap4vDpx828p GXnHi+WdgAayBQl9ir37ZqcA X-IronPort-AV: E=Sophos;i="5.85,335,1624348800"; d="scan'208,223";a="66546336" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 29 Sep 2021 22:47:56 -0800 IronPort-SDR: Esg/uA3m2rs3Iy+Mp3HDgzlsbqZiHpVQJSEsN8+A4NAgQUqVcq3HGTI0kvZQ0Ul+oatG8SVkKp D1vK5mHGMidy8+MbBTBK+IQrkTysAf84nkSI2ftRMUJaKtLk4a10cbBzQS3CD8WrT/5v9q90vD j2lqZsCeG1Lz5y5nrTdulnxd+ceduT0/XmxgCbkGgGF/byA9YMnYoge+gbZvhUwsZPL7ief+z7 Xn2ApimOytF0oKYaZ2XONQay78OWD1EIviKv4rwU0d+Bl0CHzoi2CkgdkewDp5GfqPSRB6rpNM Rsc= From: Thomas Schwinge To: David Malcolm , Subject: [PING^3] Generalize 'gcc/input.h:struct location_hash' (was: [Committed] [PATCH 2/4] (v4) On-demand locations within string-literals) In-Reply-To: <87y27va1vl.fsf@euler.schwinge.homeip.net> References: <1469841382.17384.65.camel@redhat.com> <1470239113-42666-1-git-send-email-dmalcolm@redhat.com> <1470239113-42666-2-git-send-email-dmalcolm@redhat.com> <1470338501.8203.47.camel@redhat.com> <46aafdfa-3cbe-8072-cef1-c827ec144b7e@redhat.com> <1470421018.8203.93.camel@redhat.com> <871r67w025.fsf@euler.schwinge.homeip.net> <87mtouoku5.fsf@dem-tschwing-1.ger.mentorg.com> <87k0jxobz2.fsf@dem-tschwing-1.ger.mentorg.com> <87r1dwuazb.fsf@euler.schwinge.homeip.net> <87y27va1vl.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Thu, 30 Sep 2021 08:47:49 +0200 Message-ID: <87v92ia7ai.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2021-09-17T13:16:14+0200, I wrote: > On 2021-09-10T09:48:56+0200, I wrote: >> Ping. My patches again attached, for easy reference. > > Ping once again. Jeff had ACKed "Don't record string concatenation data for 'RESERVED_LOCATION_P'" (thanks!), but "Generalize 'gcc/input.h:struct location_hash'" is still awaiting review: >> On 2021-09-03T18:33:37+0200, I wrote: >>> On 2021-09-02T21:09:54+0200, I wrote: >>>> On 2021-09-02T15:59:14+0200, I wrote: >>>>> On 2016-08-05T14:16:58-0400, David Malcolm wrote: >>>>>> Committed to trunk as r239175; I'm attaching the final version of the >>>>>> patch for reference. >>>>> >>>>> David, you've added here 'gcc/input.h:struct location_hash' (see quoted >>>>> below), which will be useful elsewhere, so: >>>>>> --- a/gcc/input.h >>>>>> +++ b/gcc/input.h >>>>> >>>>>> +struct location_hash : int_hash { }; >>>>>> + >>>>>> +class GTY(()) string_concat_db >>>>>> +{ >>>>>> +[...] >>>>>> + hash_map *m_table; >>>>>> +}; >>>>> >>>>> OK to push the attached >>>>> "Generalize 'gcc/input.h:struct location_hash'"? Attached again, for easy reference. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 349a3172f64db93ee98ea39b36489b702b6596ab Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 31 Aug 2021 23:30:25 +0200 Subject: [PATCH 2/2] Generalize 'gcc/input.h:struct location_hash' This is currently only used here ('gcc/input.h:class string_concat_db'), but is actually generally useful, so advertize it as such. Per the rationale given, we may use 'BUILTINS_LOCATION' as spare value for 'Deleted', in addition to the existing use of 'UNKNOWN_LOCATION' as spare value for 'Empty'. gcc/ * input.h (location_hash): Use 'BUILTINS_LOCATION' as spare value for 'Deleted'. Turn into a '#define'. --- gcc/input.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gcc/input.h b/gcc/input.h index e6881072c5f..46971a2684c 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -36,6 +36,25 @@ extern GTY(()) class line_maps *saved_line_table; both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */ STATIC_ASSERT (BUILTINS_LOCATION < RESERVED_LOCATION_COUNT); +/* Hasher for 'location_t' values satisfying '!RESERVED_LOCATION_P', thus able + to use 'UNKNOWN_LOCATION'/'BUILTINS_LOCATION' as spare values for + 'Empty'/'Deleted'. */ +/* If the following is used more than once, 'gengtype' generates duplicate + functions (thus: "error: redefinition of 'void gt_ggc_mx(location_hash&)'" + etc.): + + struct location_hash + : int_hash {}; + + Likewise for this: + + typedef int_hash + location_hash; + + Thus, use a plain ol' '#define': +*/ +#define location_hash int_hash + extern bool is_location_from_builtin_token (location_t); extern expanded_location expand_location (location_t); @@ -230,8 +249,6 @@ public: location_t * GTY ((atomic)) m_locs; }; -struct location_hash : int_hash { }; - class GTY(()) string_concat_db { public: -- 2.33.0