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?


> 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.

Yep, Iâve done it that way, it works fine.

Thereâs one surprise: a few flags (flag_finite_math_only, flag_signed_zeros, flag_trapping_math, flag_unsafe_math_optimizations) seem to appear or disappear when I set specific flags for a function. What I do is this:

--------------------
static void
add_ieee_options (tree fndecl)
{
  struct cl_optimization cur_opts;

  /* Save current options.  */
  cl_optimization_save (&cur_opts, &global_options);

  /* Parse options, and update the vector.  */
 /*  parse_optimize_options (opts, true);*/
  DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
    = build_optimization_node (&global_options);

  debug_tree (optimization_current_node);
  debug_tree (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl));

  /* Restore current options.  */
  cl_optimization_restore (&global_options, &cur_opts);
}
--------------------

So, even if I donât change anything to the local options (global is: -O3 -ffast-math), I see some differences between âoptimization_current_nodeâ and "DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)â:

> 1,3d0
> <     align_functions (0x10)
> <     align_jumps (0x10)
> <     align_loops (0x10)
> 26d22
> <     flag_finite_math_only (0x1)
> 71a68
> >     flag_signed_zeros (0x1)
> 78a76
> >     flag_trapping_math (0x1)
> 113d110
> <     flag_unsafe_math_optimizations (0x1)


Is that a bug in optimization handling, or am I missing something?

FX



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