From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14822 invoked by alias); 29 Jul 2015 08:11:29 -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 14809 invoked by uid 89); 29 Jul 2015 08:11:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham 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; Wed, 29 Jul 2015 08:11:27 +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-23-wYMyZluYRDKF0qV3uI5XaQ-1; Wed, 29 Jul 2015 09:11:22 +0100 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2015 09:11:21 +0100 From: Richard Sandiford To: Trevor Saunders Mail-Followup-To: Trevor Saunders ,Jeff Law , Richard Biener , tbsaunde+gcc@tbsaunde.org, GCC Patches , richard.sandiford@arm.com Cc: Jeff Law , Richard Biener , tbsaunde+gcc@tbsaunde.org, GCC Patches Subject: Re: [PATCH 0/9] start converting POINTER_SIZE to a hook References: <1437966615-21093-1-git-send-email-tbsaunde+gcc@tbsaunde.org> <55B658F1.10300@redhat.com> <87a8uhfjt7.fsf@googlemail.com> <20150728034406.GB23293@tsaunders-iceball.corp.tor1.mozilla.com> <873808f2tq.fsf@googlemail.com> <20150729000452.GA8356@tsaunders-iceball.corp.tor1.mozilla.com> Date: Wed, 29 Jul 2015 08:32:00 -0000 In-Reply-To: <20150729000452.GA8356@tsaunders-iceball.corp.tor1.mozilla.com> (Trevor Saunders's message of "Tue, 28 Jul 2015 20:04:52 -0400") Message-ID: <87a8ufmlhy.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: wYMyZluYRDKF0qV3uI5XaQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-07/txt/msg02426.txt.bz2 Trevor Saunders writes: > On Tue, Jul 28, 2015 at 09:24:17PM +0100, Richard Sandiford wrote: >> Trevor Saunders writes: >> > On Mon, Jul 27, 2015 at 09:05:08PM +0100, Richard Sandiford wrote: >> >> Alternatively we could have a new target_globals structure that is >> >> initialised with the result of calling the hook. If we do that thoug= h, >> >> it might make sense to consolidate the hooks rather than have one for >> >> every value. E.g. having one function for UNITS_PER_WORD, one for >> >> POINTER_SIZE, one for Pmode, etc., would lead to some very verbose >> >> target code. >> > >> > so something like >> > >> > struct target_types >> > { >> > unsigned long pointer_size; >> > ... >> > }; >> > >> > const target_types &targetm.get_type_data () >> > >> > ? that seems pretty reasonable, and I wouldn't expect too many ordering >> > issues, but who knows. Its too bad nobody has taken on the big job of >> > turning targetm into a class so we can hope for some devirt help from >> > the compiler. >>=20 >> I was thinking more: >>=20 >> void targetm.get_type_data (target_types *); >>=20 >> The caller could then initialise or post-process the defaults. The >> target_types would eventually end up in some target_globals structure. > > but wouldn't that mean the hook would need to initialize all the fields > every time the hook was called? Yeah, but the idea was that the hook would only be called once per target initialisation and the result would be stored in a target_globals structure. Then places that use POINTER_SIZE would instead use the cached target_globals structure rather than targetm. For SWITCHABLE_TARGETs, the hook would be called only once for each subtarget used by the TU. For other targets it would be called once for each change in subtarget (which is already very expensive without SWITCHABLE_TARGET -- targets that want it to be fast should move to SWITCHABLE_TARGET). The disadvantage of: const target_types &targetm.get_type_data () is that it pushes the caching logic into targetm rather than sharing it between all ports. This could be a particular problem for targets like MIPS that support a lot of variations. Thanks, Richard