This is the mail archive of the
mailing list for the GCC project.
Re: Frontend access to target-related options
- From: Andrew Pinski <pinskia at gmail dot com>
- To: The Other <simplytheother at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Nathan Sidwell <nathan at acm dot org>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 8 Jan 2020 02:04:23 -0800
- Subject: Re: Frontend access to target-related options
- References: <CADYxmzQ_5uccYZnCcYB8imU1j98Y+5z437PsPSYMuS_tgy+7Qw@mail.gmail.com> <firstname.lastname@example.org> <CAFiYyc2R06+g5XycyrP3ELrMtgruWVQ=wwtODHenkqCF0cpXBA@mail.gmail.com> <CADYxmzSg_Qted=0=yoUHArZ_P4BtxA1niqP3295P_h5+Vx-1EQ@mail.gmail.com>
On Wed, Jan 8, 2020 at 1:16 AM The Other <email@example.com> wrote:
> I've found the code for the target hooks for both the C-family and D
> frontends (or at least their implementation for the i386 platform). The
> C-family ones seem like they probably are too tied to the preprocessor to
> be usable for other languages (which I assume is the reason that the D
> frontend created their own target hooks). I'm not sure if functions like
> "cpp_assert" and "cpp_define" are actually directly defined or if they have
> a macro indirection layer (like lang hooks have macro indirection layers
> with LANG_HOOKS_INIT), but I suspect that they're defined, and so the
> one-definition rule of C++ prevents any overloading from any other
> frontend. As such, the C-family target hooks appear to be unusable for my
> On the other hand, the D frontend target hooks don't appear to provide
> enough information relating to the target system to be useful (e.g. they
> seem to be missing features like SSE support and whatever).
GCC has a generic vector support so usually other languages don't need
to export that.
What exact information do you need to provide here? That is what does
Rust need for SSE support?
Can you just use the generic vector support or are there intrinsics
(builtins) support that is needed?
Do you need to know about the builtins that the target supplies? and
then make intrinsics out of them?
Why not a rust_target_objs like there is for
c_target_objs/cxx_target_objs in config.gcc.
Just like how D added d_target_objs too?
And then you have one or two defines which will add the builtins like
you need to do it.
> As such, I think it looks like I'd have to add a new target hook. How would
> I go about doing this? Is there any documentation on doing so?
> On Tue, Jan 7, 2020 at 9:16 PM Richard Biener <firstname.lastname@example.org>
> > On Thu, Jan 2, 2020 at 5:54 PM Nathan Sidwell <email@example.com> wrote:
> > >
> > > On 1/1/20 4:31 AM, The Other wrote:
> > > > Hi,
> > > > I'm currently working on a Rust frontend for GCC. Rust has some
> > > > language-level conditional compilation features based on the presence
> > or
> > > > lack of features in the target architecture (e.g. SSE, AVX, a static C
> > > > runtime) as well as the target CPU architecture itself, target OS, and
> > > > various other target-related information (such as pointer width and
> > > > endianness).
> > > >
> > > > As such, the frontend parser requires this target-related option
> > > > information to be available to it. I was wondering if there was an
> > > > architecture-neutral way of accessing this data (if it is even stored).
> > > > I've looked into options.h but I cannot figure out how to use it in an
> > > > architecture-neutral way.
> > >
> > > Um, AVX and such are arch-specific. It sounds like you need some kind
> > > of (new?) langhook that targets can register?
> > You mean target hook. Depending on the actual piece of info such hook
> > might already exist though.
> > Richard.
> > > nathan
> > >
> > > --
> > > Nathan Sidwell