This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 0/9] start converting POINTER_SIZE to a hook
- From: Trevor Saunders <tbsaunde at tbsaunde dot org>
- To: Jeff Law <law at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, tbsaunde+gcc at tbsaunde dot org, GCC Patches <gcc-patches at gcc dot gnu dot org>, rdsandiford at googlemail dot com
- Date: Tue, 28 Jul 2015 20:04:52 -0400
- Subject: Re: [PATCH 0/9] start converting POINTER_SIZE to a hook
- Authentication-results: sourceware.org; auth=none
- References: <1437966615-21093-1-git-send-email-tbsaunde+gcc at tbsaunde dot org> <CAFiYyc0=9XjGrnECPrVC708v=2ryKH_YXqnKP8ri+VpbgPrYtg at mail dot gmail dot com> <55B658F1 dot 10300 at redhat dot com> <87a8uhfjt7 dot fsf at googlemail dot com> <20150728034406 dot GB23293 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com> <873808f2tq dot fsf at googlemail dot com>
On Tue, Jul 28, 2015 at 09:24:17PM +0100, Richard Sandiford wrote:
> Trevor Saunders <tbsaunde@tbsaunde.org> 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 though,
> >> 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.
>
> I was thinking more:
>
> void targetm.get_type_data (target_types *);
>
> 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? I'd think you'd want to avoid that
work, and have a global or set of global constant target_types structs,
and based on the target in use you could return the appropriate one. a
target could also just have global one, but change its values when the
sub target changes, but having it be constant seems like a nicer design
for the target. I guess that has the disadvantage that if the target
isn't a switchable target you need to reinitialize the whole struct
every time the hook is called on the off chance something has changed,
but that seems like the same thing that happens in your proposal?
Trev
>
> Thanks,
> Richard