const struct cl_decoded_option *decoded,
unsigned int lang_mask, int kind,
const struct cl_option_handlers *handlers);
-static void handle_param (const char *);
+static void handle_param (struct gcc_options *opts,
+ struct gcc_options *opts_set, const char *carg);
static char *write_langs (unsigned int lang_mask);
static void complain_wrong_lang (const struct cl_decoded_option *,
unsigned int lang_mask);
static void set_debug_level (enum debug_info_type type, int extended,
const char *arg);
+static void set_fast_math_flags (int set);
+static void set_unsafe_math_optimizations_flags (int set);
/* Return a malloced slash-separated list of languages in MASK. */
static char *
/* Language mask determined at initialization. */
static unsigned int initial_lang_mask;
-/* Initial values of parameters we reset. */
-static int initial_min_crossjump_insns;
-static int initial_max_fields_for_field_sensitive;
-static int initial_loop_invariant_max_bbs_in_loop;
-
/* Initialize global options-related settings at start-up. */
void
initial_lang_mask = lang_hooks.option_lang_mask ();
lang_hooks.initialize_diagnostics (global_dc);
-
- /* Save initial values of parameters we reset. */
- initial_min_crossjump_insns
- = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
- initial_max_fields_for_field_sensitive
- = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
- initial_loop_invariant_max_bbs_in_loop
- = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value;
}
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
void
init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
{
+ size_t num_params = get_num_compiler_params ();
+
*opts = global_options_init;
memset (opts_set, 0, sizeof (*opts_set));
+ opts->x_param_values = XNEWVEC (int, num_params);
+ opts_set->x_param_values = XCNEWVEC (int, num_params);
+ init_param_values (opts->x_param_values);
+
/* Use priority coloring if cover classes is not defined for the
target. */
if (targetm.ira_cover_classes == NULL)
/* Some targets have ABI-specified unwind tables. */
opts->x_flag_unwind_tables = targetm.unwind_tables_default;
+
+ /* Some targets have other target-specific initialization. */
+ targetm.target_option.init_struct (opts);
}
/* Decode command-line options to an array, like
flag_ipa_sra = opt2;
/* Track fields in field-sensitive alias analysis. */
- set_param_value ("max-fields-for-field-sensitive",
- (opt2) ? 100 : initial_max_fields_for_field_sensitive);
+ maybe_set_param_value
+ (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE,
+ opt2 ? 100 : default_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE),
+ opts->x_param_values, opts_set->x_param_values);
/* For -O1 only do loop invariant motion for very small loops. */
- set_param_value ("loop-invariant-max-bbs-in-loop",
- (opt2) ? initial_loop_invariant_max_bbs_in_loop : 1000);
+ maybe_set_param_value
+ (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
+ opt2 ? default_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) : 1000,
+ opts->x_param_values, opts_set->x_param_values);
/* -O3 optimizations. */
opt3 = (optimize >= 3);
optimize = 2;
/* We want to crossjump as much as possible. */
- set_param_value ("min-crossjump-insns", 1);
+ maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
+ opts->x_param_values, opts_set->x_param_values);
}
else
- set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
+ maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS,
+ default_param_value (PARAM_MIN_CROSSJUMP_INSNS),
+ opts->x_param_values, opts_set->x_param_values);
/* -Ofast adds optimizations to -O3. */
if (ofast)
section-anchors. */
if (!flag_unit_at_a_time)
{
- if (flag_section_anchors == 1)
+ if (flag_section_anchors && opts_set->x_flag_section_anchors)
error ("Section anchors must be disabled when unit-at-a-time "
"is disabled.");
flag_section_anchors = 0;
/* Unless the user has asked for section anchors, we disable toplevel
reordering at -O0 to disable transformations that might be surprising
to end users and to get -fno-toplevel-reorder tested. */
- if (!optimize && flag_toplevel_reorder == 2 && flag_section_anchors != 1)
+ if (!optimize
+ && flag_toplevel_reorder == 2
+ && !(flag_section_anchors && opts_set->x_flag_section_anchors))
{
flag_toplevel_reorder = 0;
flag_section_anchors = 0;
}
if (!flag_toplevel_reorder)
{
- if (flag_section_anchors == 1)
+ if (flag_section_anchors && opts_set->x_flag_section_anchors)
error ("section anchors must be disabled when toplevel reorder"
" is disabled");
flag_section_anchors = 0;
if (flag_conserve_stack)
{
- if (!PARAM_SET_P (PARAM_LARGE_STACK_FRAME))
- PARAM_VALUE (PARAM_LARGE_STACK_FRAME) = 100;
- if (!PARAM_SET_P (PARAM_STACK_FRAME_GROWTH))
- PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40;
+ maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 100,
+ opts->x_param_values, opts_set->x_param_values);
+ maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40,
+ opts->x_param_values, opts_set->x_param_values);
}
if (flag_wpa || flag_ltrans)
{
switch (code)
{
case OPT__param:
- handle_param (arg);
+ handle_param (opts, opts_set, arg);
break;
case OPT_v:
break;
case OPT_finline_limit_:
- set_param_value ("max-inline-insns-single", value / 2);
- set_param_value ("max-inline-insns-auto", value / 2);
+ set_param_value ("max-inline-insns-single", value / 2,
+ opts->x_param_values, opts_set->x_param_values);
+ set_param_value ("max-inline-insns-auto", value / 2,
+ opts->x_param_values, opts_set->x_param_values);
break;
case OPT_finstrument_functions_exclude_function_list_:
/* Handle --param NAME=VALUE. */
static void
-handle_param (const char *carg)
+handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
+ const char *carg)
{
char *equal, *arg;
int value;
else
{
*equal = '\0';
- set_param_value (arg, value);
+ set_param_value (arg, value,
+ opts->x_param_values, opts_set->x_param_values);
}
}
/* The following routines are useful in setting all the flags that
-ffast-math and -fno-fast-math imply. */
-void
+static void
set_fast_math_flags (int set)
{
flag_unsafe_math_optimizations = set;
/* When -funsafe-math-optimizations is set the following
flags are set as well. */
-void
+static void
set_unsafe_math_optimizations_flags (int set)
{
flag_trapping_math = !set;