> 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