This is the mail archive of the
mailing list for the GCC project.
Re: Is "optimize" attribute on fndecl handled differently?
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: FX <fxcoudert at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sun, 28 Sep 2014 18:03:26 +0200
- Subject: Re: Is "optimize" attribute on fndecl handled differently?
- Authentication-results: sourceware.org; auth=none
- References: <240301BA-258A-417D-832E-24605247BCB2 at gmail dot com>
On Sun, Sep 28, 2014 at 5:24 PM, FX wrote:
> Iâm trying to get the Fortran front-end to add function-specific optimization flags to certain functions (those that request IEEE compliance through use of the specific Fortran module). It seems simple enough, adding the attribute to the fndecl, but though Iâve tried to do so at two different places (when we first build the function decl, and when we later call it), both fail with:
> Warning: âoptimizeâ attribute directive ignored [-Wattributes]
> Iâm getting the feeling that maybe itâs because I gave the attribute a string value, and itâs expecting a tree alreadyâ but the functions to do so are not generic, theyâre in c-family, which probably means I canât use them.
> Any idea how I could get to the result I want? (setting options from the Fortran front-end)
AFAIU, it looks like you run into the warning from decl_attributes at
"if (spec == NULL)" where spec is the attribute specification. I don't
think you want to go through that path (of decl_attributes); instead
you probably want to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION directly.
You've found handle_optimize_attribute and parse_optimize_options in
It looks like parse_optimize_options has nothing c-family specific in
it, so it could be moved to attribs.c. Then you'd use
build_optimization_node to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION, as
done in c-common.c:handle_optimize_attribute.
Hope this helps. Thanks for all the work you're putting into this!