This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is "optimize" attribute on fndecl handled differently?


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
c-family/c-common.c. .

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!

Ciao!
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]