diff options
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 70 |
1 files changed, 58 insertions, 12 deletions
diff --git a/gcc/opts.c b/gcc/opts.c index 90f34df1dec..78143608d98 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -42,6 +42,10 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "dbgcnt.h" #include "debug.h" +#include "multi-target.h" + +START_TARGET_SPECIFIC +#ifndef EXTRA_TARGET /* Value of the -G xx switch, and whether it was passed or not. */ unsigned HOST_WIDE_INT g_switch_value; @@ -771,12 +775,16 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask) } } +EXTRA_TARGETS_DECL (void decode_options (unsigned int argc, const char **argv)); +#endif /* !EXTRA_TARGET */ /* Parse command line options and set default flag values. Do minimal options processing. */ void -decode_options (unsigned int argc, const char **argv) +decode_options (unsigned int argc ATTRIBUTE_UNUSED, + const char **argv ATTRIBUTE_UNUSED) { static bool first_time_p = true; +#ifndef EXTRA_TARGET static int initial_max_aliased_vops; static int initial_avg_aliased_vops; static int initial_min_crossjump_insns; @@ -785,10 +793,14 @@ decode_options (unsigned int argc, const char **argv) static unsigned int initial_lang_mask; unsigned int i, lang_mask; +#endif /* !EXTRA_TARGET */ int opt1; int opt2; +#ifndef EXTRA_TARGET int opt3; +#endif /* !EXTRA_TARGET */ int opt1_max; +#ifndef EXTRA_TARGET if (first_time_p) { @@ -843,9 +855,10 @@ decode_options (unsigned int argc, const char **argv) } } +#endif /* !EXTRA_TARGET */ /* Use priority coloring if cover classes is not defined for the target. */ - if (targetm.ira_cover_classes == NULL) + if (this_targetm.ira_cover_classes == NULL) flag_ira_algorithm = IRA_ALGORITHM_PRIORITY; /* -O1 optimizations. */ @@ -857,10 +870,13 @@ decode_options (unsigned int argc, const char **argv) #ifdef CAN_DEBUG_WITHOUT_FP flag_omit_frame_pointer = opt1; #endif +#ifndef EXTRA_TARGET flag_guess_branch_prob = opt1; flag_cprop_registers = opt1; +#endif /* !EXTRA_TARGET */ flag_if_conversion = opt1; flag_if_conversion2 = opt1; +#ifndef EXTRA_TARGET flag_ipa_pure_const = opt1; flag_ipa_reference = opt1; flag_merge_constants = opt1; @@ -876,18 +892,23 @@ decode_options (unsigned int argc, const char **argv) flag_tree_copy_prop = opt1; flag_tree_sink = opt1; flag_tree_ch = opt1; +#endif /* !EXTRA_TARGET */ /* -O2 optimizations. */ opt2 = (optimize >= 2); +#ifndef EXTRA_TARGET flag_inline_small_functions = opt2; flag_indirect_inlining = opt2; +#endif /* !EXTRA_TARGET */ flag_thread_jumps = opt2; flag_crossjumping = opt2; +#ifndef EXTRA_TARGET flag_optimize_sibling_calls = opt2; flag_forward_propagate = opt2; flag_cse_follow_jumps = opt2; flag_gcse = opt2; flag_expensive_optimizations = opt2; +#endif /* !EXTRA_TARGET */ flag_rerun_cse_after_loop = opt2; flag_caller_saves = opt2; flag_peephole2 = opt2; @@ -896,6 +917,7 @@ decode_options (unsigned int argc, const char **argv) flag_schedule_insns_after_reload = opt2; #endif flag_regmove = opt2; +#ifndef EXTRA_TARGET flag_strict_aliasing = opt2; flag_strict_overflow = opt2; flag_delete_null_pointer_checks = opt2; @@ -904,7 +926,7 @@ decode_options (unsigned int argc, const char **argv) flag_tree_vrp = opt2; flag_tree_builtin_call_dce = opt2; flag_tree_pre = opt2; - flag_tree_switch_conversion = 1; + flag_tree_switch_conversion = opt2; flag_ipa_cp = opt2; /* Allow more virtual operators to increase alias precision. */ @@ -928,6 +950,7 @@ decode_options (unsigned int argc, const char **argv) flag_gcse_after_reload = opt3; flag_tree_vectorize = opt3; flag_ipa_cp_clone = opt3; + flag_tree_pre_partial_partial = opt3; if (flag_ipa_cp_clone) flag_ipa_cp = 1; @@ -937,6 +960,7 @@ decode_options (unsigned int argc, const char **argv) set_param_value ("max-aliased-vops", 1000); set_param_value ("avg-aliased-vops", (opt3) ? 3 : initial_avg_aliased_vops); +#endif /* !EXTRA_TARGET */ /* Just -O1/-O0 optimizations. */ opt1_max = (optimize <= 1); @@ -945,16 +969,20 @@ decode_options (unsigned int argc, const char **argv) align_labels = opt1_max; align_functions = opt1_max; +#ifndef EXTRA_TARGET if (optimize_size) { /* Inlining of functions reducing size is a good idea regardless of them being declared inline. */ flag_inline_functions = 1; - /* Basic optimization options. */ - optimize_size = 1; + /* Basic optimization options at -Os are almost the same as -O2. The + only difference is that we disable PRE, because it sometimes still + increases code size. If the user want to run PRE with -Os, he/she + will have to indicate so explicitly. */ if (optimize > 2) optimize = 2; + flag_tree_pre = 0; /* We want to crossjump as much as possible. */ set_param_value ("min-crossjump-insns", 1); @@ -962,7 +990,9 @@ decode_options (unsigned int argc, const char **argv) else set_param_value ("min-crossjump-insns", initial_min_crossjump_insns); +#endif /* !EXTRA_TARGET */ if (first_time_p) +#ifndef EXTRA_TARGET { /* Initialize whether `char' is signed. */ flag_signed_char = DEFAULT_SIGNED_CHAR; @@ -970,18 +1000,23 @@ decode_options (unsigned int argc, const char **argv) set after target options have been processed. */ flag_short_enums = 2; +#endif /* !EXTRA_TARGET */ /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can modify it. */ - target_flags = targetm.default_target_flags; + target_flags = this_targetm.default_target_flags; +#ifndef EXTRA_TARGET /* Some targets have ABI-specified unwind tables. */ flag_unwind_tables = targetm.unwind_tables_default; } + EXTRA_TARGETS_CALL (decode_options (argc, argv)); +#endif /* !EXTRA_TARGET */ #ifdef OPTIMIZATION_OPTIONS /* Allow default optimizations to be specified on a per-machine basis. */ OPTIMIZATION_OPTIONS (optimize, optimize_size); #endif +#ifndef EXTRA_TARGET handle_options (argc, argv, lang_mask); @@ -1073,8 +1108,9 @@ decode_options (unsigned int argc, const char **argv) capabilities are requested. */ if (!flag_sel_sched_pipelining) flag_sel_sched_pipelining_outer_loops = 0; +#endif /* !EXTRA_TARGET */ - if (!targetm.ira_cover_classes + if (!this_targetm.ira_cover_classes && flag_ira_algorithm == IRA_ALGORITHM_CB) { inform (input_location, @@ -1082,12 +1118,15 @@ decode_options (unsigned int argc, const char **argv) flag_ira_algorithm = IRA_ALGORITHM_PRIORITY; } +#ifndef EXTRA_TARGET /* Save the current optimization options if this is the first call. */ if (first_time_p) { optimization_default_node = build_optimization_node (); optimization_current_node = optimization_default_node; +#endif /* !EXTRA_TARGET */ first_time_p = false; +#ifndef EXTRA_TARGET } if (flag_conserve_stack) { @@ -1097,7 +1136,9 @@ decode_options (unsigned int argc, const char **argv) PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40; } +#endif /* !EXTRA_TARGET */ } +#ifndef EXTRA_TARGET #define LEFT_COLUMN 27 @@ -2220,15 +2261,17 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg) if (*arg == '\0') { if (!debug_info_level) - debug_info_level = 2; + debug_info_level = DINFO_LEVEL_NORMAL; } else { - debug_info_level = integral_argument (arg); - if (debug_info_level == (unsigned int) -1) + int argval = integral_argument (arg); + if (argval == -1) error ("unrecognised debug output level \"%s\"", arg); - else if (debug_info_level > 3) + else if (argval > 3) error ("debug output level %s is too high", arg); + else + debug_info_level = (enum debug_info_level) argval; } } @@ -2314,7 +2357,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask) } else { - int kind = value ? DK_ERROR : DK_WARNING; + diagnostic_t kind = value ? DK_ERROR : DK_WARNING; diagnostic_classify_diagnostic (global_dc, option_index, kind); /* -Werror=foo implies -Wfoo. */ @@ -2325,3 +2368,6 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask) } free (new_option); } + +#endif /* !EXTRA_TARGET */ +END_TARGET_SPECIFIC |