/* Save current options. */
cl_optimization_save (&cur_opts, &global_options, &global_options_set);
+ tree prev_target_node = build_target_option_node (&global_options,
+ &global_options_set);
/* If we previously had some optimization options, use them as the
default. */
parse_optimize_options (args, true);
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
= build_optimization_node (&global_options, &global_options_set);
+ tree target_node = build_target_option_node (&global_options,
+ &global_options_set);
+ if (prev_target_node != target_node)
+ DECL_FUNCTION_SPECIFIC_TARGET (*node) = target_node;
/* Restore current options. */
cl_optimization_restore (&global_options, &global_options_set,
&cur_opts);
+ cl_target_option_restore (&global_options, &global_options_set,
+ TREE_TARGET_OPTION (prev_target_node));
+
if (saved_global_options != NULL)
{
cl_optimization_compare (saved_global_options, &global_options);
if (targetm.target_option.pragma_parse (args, NULL_TREE))
current_target_pragma = chainon (current_target_pragma, args);
+
+ /* A target pragma can also influence optimization options. */
+ tree current_optimize
+ = build_optimization_node (&global_options, &global_options_set);
+ if (current_optimize != optimization_current_node)
+ optimization_current_node = current_optimize;
}
}
target_option_current_node = p->target_binary;
}
+ /* Always restore optimization options as optimization_current_node is
+ * overwritten by invoke_set_current_function_hook. */
+ cl_optimization_restore (&global_options, &global_options_set,
+ TREE_OPTIMIZATION (p->optimize_binary));
+
if (p->optimize_binary != optimization_current_node)
{
- tree old_optimize = optimization_current_node;
- cl_optimization_restore (&global_options, &global_options_set,
- TREE_OPTIMIZATION (p->optimize_binary));
- c_cpp_builtins_optimize_pragma (parse_in, old_optimize,
+ c_cpp_builtins_optimize_pragma (parse_in, optimization_current_node,
p->optimize_binary);
optimization_current_node = p->optimize_binary;
}
checked_options["flag_merge_constants"]++
checked_options["param_max_fields_for_field_sensitive"]++
checked_options["flag_omit_frame_pointer"]++
-checked_options["unroll_only_small_loops"]++
# arc exceptions
checked_options["TARGET_ALIGN_CALL"]++
checked_options["TARGET_CASE_VECTOR_PC_RELATIVE"]++
checked_options["arc_size_opt_level"]++
-# arm exceptions
-checked_options["arm_fp16_format"]++
-checked_options["flag_ipa_ra"]++
-# s390 exceptions
-checked_options["param_max_completely_peel_times"]++
-checked_options["param_max_completely_peeled_insns"]++
-checked_options["param_max_unroll_times"]++
-checked_options["param_max_unrolled_insns"]++
for (i = 0; i < n_opts; i++) {