mirror of git://gcc.gnu.org/git/gcc.git
params.c (params_finished): New.
* params.c (params_finished): New. (add_params): Assert !params_finished. (finish_params): New. (set_param_value_internal): Take params and params_set parameters. Assert params_finished. (set_param_value, maybe_set_param_value): Take params and params_set parameters. Update calls to set_param_value_internal. (set_default_param_value): Assert !params_finished. Don't use set_param_value_internal. (default_param_value, init_param_values): New. * params.h (struct param_info): Change value to default_value. Remove set. (set_param_value, maybe_set_param_value): Add params and params_set parameters. (PARAM_VALUE): Get parameters from global_options. (PARAM_SET_P): Remove. (finish_params, default_param_value, init_param_values): New. * common.opt (param_values): New Variable. * config/arm/arm.c (arm_option_override): Pass extra arguments to maybe_set_param_value. * config/i386/i386.c (ix86_option_override_internal): Pass extra arguments to maybe_set_param_value. * config/picochip/picochip.c (picochip_option_override): Pass extra arguments to maybe_set_param_value. * config/rs6000/rs6000.c (rs6000_option_override_internal): Pass extra arguments to maybe_set_param_value. * config/s390/s390.c (s390_option_override): Use maybe_set_param_value instead of set_param_value. Pass extra arguments to maybe_set_param_value. * config/sparc/sparc.c (sparc_option_override): Pass extra arguments to maybe_set_param_value. * config/spu/spu.c (spu_option_override): Pass extra arguments to maybe_set_param_value. * opts.c (handle_param): Take opts and opts_set parameters. Update call to set_param_value. (initial_min_crossjump_insns, initial_max_fields_for_field_sensitive, initial_loop_invariant_max_bbs_in_loop): Remove. (init_options_once): Don't set them. (init_options_struct): Initialize parameters structures. (default_options_optimization): Use default_param_value when restoring defaults. Update calls to maybe_set_param_value. (finish_options): Update calls to maybe_set_param_value. (common_handle_option): Update calls to handle_param and set_param_value. * toplev.c (DEFPARAM): Update definition for changes to param_info. (general_init): Call finish_params. From-SVN: r165460
This commit is contained in:
parent
4af476d7f2
commit
48476d13b2
|
@ -1,3 +1,54 @@
|
||||||
|
2010-10-14 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* params.c (params_finished): New.
|
||||||
|
(add_params): Assert !params_finished.
|
||||||
|
(finish_params): New.
|
||||||
|
(set_param_value_internal): Take params and params_set
|
||||||
|
parameters. Assert params_finished.
|
||||||
|
(set_param_value, maybe_set_param_value): Take params and
|
||||||
|
params_set parameters. Update calls to set_param_value_internal.
|
||||||
|
(set_default_param_value): Assert !params_finished. Don't use
|
||||||
|
set_param_value_internal.
|
||||||
|
(default_param_value, init_param_values): New.
|
||||||
|
* params.h (struct param_info): Change value to default_value.
|
||||||
|
Remove set.
|
||||||
|
(set_param_value, maybe_set_param_value): Add params and
|
||||||
|
params_set parameters.
|
||||||
|
(PARAM_VALUE): Get parameters from global_options.
|
||||||
|
(PARAM_SET_P): Remove.
|
||||||
|
(finish_params, default_param_value, init_param_values): New.
|
||||||
|
* common.opt (param_values): New Variable.
|
||||||
|
* config/arm/arm.c (arm_option_override): Pass extra arguments to
|
||||||
|
maybe_set_param_value.
|
||||||
|
* config/i386/i386.c (ix86_option_override_internal): Pass extra
|
||||||
|
arguments to maybe_set_param_value.
|
||||||
|
* config/picochip/picochip.c (picochip_option_override): Pass
|
||||||
|
extra arguments to maybe_set_param_value.
|
||||||
|
* config/rs6000/rs6000.c (rs6000_option_override_internal): Pass
|
||||||
|
extra arguments to maybe_set_param_value.
|
||||||
|
* config/s390/s390.c (s390_option_override): Use
|
||||||
|
maybe_set_param_value instead of set_param_value. Pass extra
|
||||||
|
arguments to maybe_set_param_value.
|
||||||
|
* config/sparc/sparc.c (sparc_option_override): Pass extra
|
||||||
|
arguments to maybe_set_param_value.
|
||||||
|
* config/spu/spu.c (spu_option_override): Pass extra arguments to
|
||||||
|
maybe_set_param_value.
|
||||||
|
* opts.c (handle_param): Take opts and opts_set parameters.
|
||||||
|
Update call to set_param_value.
|
||||||
|
(initial_min_crossjump_insns,
|
||||||
|
initial_max_fields_for_field_sensitive,
|
||||||
|
initial_loop_invariant_max_bbs_in_loop): Remove.
|
||||||
|
(init_options_once): Don't set them.
|
||||||
|
(init_options_struct): Initialize parameters structures.
|
||||||
|
(default_options_optimization): Use default_param_value when
|
||||||
|
restoring defaults. Update calls to maybe_set_param_value.
|
||||||
|
(finish_options): Update calls to maybe_set_param_value.
|
||||||
|
(common_handle_option): Update calls to handle_param and
|
||||||
|
set_param_value.
|
||||||
|
* toplev.c (DEFPARAM): Update definition for changes to
|
||||||
|
param_info.
|
||||||
|
(general_init): Call finish_params.
|
||||||
|
|
||||||
2010-10-14 Nick Clifton <nickc@redhat.com>
|
2010-10-14 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* config/mn10300/mn10300.h (CONSTANT_ALIGNMENT): Define.
|
* config/mn10300/mn10300.h (CONSTANT_ALIGNMENT): Define.
|
||||||
|
|
|
@ -55,6 +55,9 @@ enum ira_region flag_ira_region = IRA_REGION_MIXED
|
||||||
Variable
|
Variable
|
||||||
bool flag_warn_unused_result = false
|
bool flag_warn_unused_result = false
|
||||||
|
|
||||||
|
Variable
|
||||||
|
int *param_values
|
||||||
|
|
||||||
###
|
###
|
||||||
Driver
|
Driver
|
||||||
|
|
||||||
|
|
|
@ -1958,7 +1958,9 @@ arm_option_override (void)
|
||||||
but measurable, size reduction for PIC code. Therefore, we decrease
|
but measurable, size reduction for PIC code. Therefore, we decrease
|
||||||
the bar for unrestricted expression hoisting to the cost of PIC address
|
the bar for unrestricted expression hoisting to the cost of PIC address
|
||||||
calculation, which is 2 instructions. */
|
calculation, which is 2 instructions. */
|
||||||
maybe_set_param_value (PARAM_GCSE_UNRESTRICTED_COST, 2);
|
maybe_set_param_value (PARAM_GCSE_UNRESTRICTED_COST, 2,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
|
||||||
/* Register global variables with the garbage collector. */
|
/* Register global variables with the garbage collector. */
|
||||||
arm_add_gc_roots ();
|
arm_add_gc_roots ();
|
||||||
|
|
|
@ -3633,10 +3633,18 @@ ix86_option_override_internal (bool main_args_p)
|
||||||
flag_schedule_insns_after_reload = flag_schedule_insns = 0;
|
flag_schedule_insns_after_reload = flag_schedule_insns = 0;
|
||||||
|
|
||||||
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES,
|
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES,
|
||||||
ix86_cost->simultaneous_prefetches);
|
ix86_cost->simultaneous_prefetches,
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, ix86_cost->prefetch_block);
|
global_options.x_param_values,
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_SIZE, ix86_cost->l1_cache_size);
|
global_options_set.x_param_values);
|
||||||
maybe_set_param_value (PARAM_L2_CACHE_SIZE, ix86_cost->l2_cache_size);
|
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, ix86_cost->prefetch_block,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_L1_CACHE_SIZE, ix86_cost->l1_cache_size,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_L2_CACHE_SIZE, ix86_cost->l2_cache_size,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
|
||||||
/* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
|
/* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
|
||||||
if (flag_prefetch_loop_arrays < 0
|
if (flag_prefetch_loop_arrays < 0
|
||||||
|
|
|
@ -354,8 +354,12 @@ picochip_option_override (void)
|
||||||
that could potentially increase stack size.*/
|
that could potentially increase stack size.*/
|
||||||
if (flag_conserve_stack)
|
if (flag_conserve_stack)
|
||||||
{
|
{
|
||||||
maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 0);
|
maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 0,
|
||||||
maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 0);
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 0,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn off the elimination of unused types. The elaborator
|
/* Turn off the elimination of unused types. The elaborator
|
||||||
|
|
|
@ -3159,11 +3159,19 @@ rs6000_option_override_internal (const char *default_cpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES,
|
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES,
|
||||||
rs6000_cost->simultaneous_prefetches);
|
rs6000_cost->simultaneous_prefetches,
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_SIZE, rs6000_cost->l1_cache_size);
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_L1_CACHE_SIZE, rs6000_cost->l1_cache_size,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE,
|
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE,
|
||||||
rs6000_cost->cache_line_size);
|
rs6000_cost->cache_line_size,
|
||||||
maybe_set_param_value (PARAM_L2_CACHE_SIZE, rs6000_cost->l2_cache_size);
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_L2_CACHE_SIZE, rs6000_cost->l2_cache_size,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
|
||||||
/* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
|
/* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
|
||||||
can be optimized to ap = __builtin_next_arg (0). */
|
can be optimized to ap = __builtin_next_arg (0). */
|
||||||
|
|
|
@ -1687,22 +1687,42 @@ s390_option_override (void)
|
||||||
if (s390_tune == PROCESSOR_2097_Z10
|
if (s390_tune == PROCESSOR_2097_Z10
|
||||||
|| s390_tune == PROCESSOR_2817_Z196)
|
|| s390_tune == PROCESSOR_2817_Z196)
|
||||||
{
|
{
|
||||||
maybe_set_param_value (PARAM_MAX_UNROLLED_INSNS, 100);
|
maybe_set_param_value (PARAM_MAX_UNROLLED_INSNS, 100,
|
||||||
maybe_set_param_value (PARAM_MAX_UNROLL_TIMES, 32);
|
global_options.x_param_values,
|
||||||
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEELED_INSNS, 2000);
|
global_options_set.x_param_values);
|
||||||
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 64);
|
maybe_set_param_value (PARAM_MAX_UNROLL_TIMES, 32,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEELED_INSNS, 2000,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 64,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_param_value ("max-pending-list-length", 256);
|
maybe_set_param_value (PARAM_MAX_PENDING_LIST_LENGTH, 256,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
/* values for loop prefetching */
|
/* values for loop prefetching */
|
||||||
set_param_value ("l1-cache-line-size", 256);
|
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, 256,
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_SIZE, 128);
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_L1_CACHE_SIZE, 128,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
/* s390 has more than 2 levels and the size is much larger. Since
|
/* s390 has more than 2 levels and the size is much larger. Since
|
||||||
we are always running virtualized assume that we only get a small
|
we are always running virtualized assume that we only get a small
|
||||||
part of the caches above l1. */
|
part of the caches above l1. */
|
||||||
maybe_set_param_value (PARAM_L2_CACHE_SIZE, 1500);
|
maybe_set_param_value (PARAM_L2_CACHE_SIZE, 1500,
|
||||||
maybe_set_param_value (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO, 2);
|
global_options.x_param_values,
|
||||||
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 6);
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO, 2,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 6,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
|
||||||
/* This cannot reside in s390_option_optimization since HAVE_prefetch
|
/* This cannot reside in s390_option_optimization since HAVE_prefetch
|
||||||
requires the arch flags to be evaluated already. Since prefetching
|
requires the arch flags to be evaluated already. Since prefetching
|
||||||
|
|
|
@ -922,13 +922,17 @@ sparc_option_override (void)
|
||||||
|| sparc_cpu == PROCESSOR_NIAGARA2)
|
|| sparc_cpu == PROCESSOR_NIAGARA2)
|
||||||
? 2
|
? 2
|
||||||
: (sparc_cpu == PROCESSOR_ULTRASPARC3
|
: (sparc_cpu == PROCESSOR_ULTRASPARC3
|
||||||
? 8 : 3)));
|
? 8 : 3)),
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE,
|
maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE,
|
||||||
((sparc_cpu == PROCESSOR_ULTRASPARC
|
((sparc_cpu == PROCESSOR_ULTRASPARC
|
||||||
|| sparc_cpu == PROCESSOR_ULTRASPARC3
|
|| sparc_cpu == PROCESSOR_ULTRASPARC3
|
||||||
|| sparc_cpu == PROCESSOR_NIAGARA
|
|| sparc_cpu == PROCESSOR_NIAGARA
|
||||||
|| sparc_cpu == PROCESSOR_NIAGARA2)
|
|| sparc_cpu == PROCESSOR_NIAGARA2)
|
||||||
? 64 : 32));
|
? 64 : 32),
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Miscellaneous utilities. */
|
/* Miscellaneous utilities. */
|
||||||
|
|
|
@ -514,7 +514,9 @@ spu_option_override (void)
|
||||||
/* Small loops will be unpeeled at -O3. For SPU it is more important
|
/* Small loops will be unpeeled at -O3. For SPU it is more important
|
||||||
to keep code small by default. */
|
to keep code small by default. */
|
||||||
if (!flag_unroll_loops && !flag_peel_loops)
|
if (!flag_unroll_loops && !flag_peel_loops)
|
||||||
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 1);
|
maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 1,
|
||||||
|
global_options.x_param_values,
|
||||||
|
global_options_set.x_param_values);
|
||||||
|
|
||||||
flag_omit_frame_pointer = 1;
|
flag_omit_frame_pointer = 1;
|
||||||
|
|
||||||
|
|
60
gcc/opts.c
60
gcc/opts.c
|
@ -362,7 +362,8 @@ static bool common_handle_option (struct gcc_options *opts,
|
||||||
const struct cl_decoded_option *decoded,
|
const struct cl_decoded_option *decoded,
|
||||||
unsigned int lang_mask, int kind,
|
unsigned int lang_mask, int kind,
|
||||||
const struct cl_option_handlers *handlers);
|
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 char *write_langs (unsigned int lang_mask);
|
||||||
static void complain_wrong_lang (const struct cl_decoded_option *,
|
static void complain_wrong_lang (const struct cl_decoded_option *,
|
||||||
unsigned int lang_mask);
|
unsigned int lang_mask);
|
||||||
|
@ -652,11 +653,6 @@ read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set,
|
||||||
/* Language mask determined at initialization. */
|
/* Language mask determined at initialization. */
|
||||||
static unsigned int initial_lang_mask;
|
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. */
|
/* Initialize global options-related settings at start-up. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -666,14 +662,6 @@ init_options_once (void)
|
||||||
initial_lang_mask = lang_hooks.option_lang_mask ();
|
initial_lang_mask = lang_hooks.option_lang_mask ();
|
||||||
|
|
||||||
lang_hooks.initialize_diagnostics (global_dc);
|
lang_hooks.initialize_diagnostics (global_dc);
|
||||||
|
|
||||||
/* Save initial values of parameters we reset. */
|
|
||||||
initial_min_crossjump_insns
|
|
||||||
= PARAM_VALUE (PARAM_MIN_CROSSJUMP_INSNS);
|
|
||||||
initial_max_fields_for_field_sensitive
|
|
||||||
= PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE);
|
|
||||||
initial_loop_invariant_max_bbs_in_loop
|
|
||||||
= PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
|
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
|
||||||
|
@ -681,9 +669,15 @@ init_options_once (void)
|
||||||
void
|
void
|
||||||
init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
|
init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
|
||||||
{
|
{
|
||||||
|
size_t num_params = get_num_compiler_params ();
|
||||||
|
|
||||||
*opts = global_options_init;
|
*opts = global_options_init;
|
||||||
memset (opts_set, 0, sizeof (*opts_set));
|
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
|
/* Use priority coloring if cover classes is not defined for the
|
||||||
target. */
|
target. */
|
||||||
if (targetm.ira_cover_classes == NULL)
|
if (targetm.ira_cover_classes == NULL)
|
||||||
|
@ -853,12 +847,16 @@ default_options_optimization (struct gcc_options *opts,
|
||||||
flag_ipa_sra = opt2;
|
flag_ipa_sra = opt2;
|
||||||
|
|
||||||
/* Track fields in field-sensitive alias analysis. */
|
/* Track fields in field-sensitive alias analysis. */
|
||||||
maybe_set_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE,
|
maybe_set_param_value
|
||||||
opt2 ? 100 : initial_max_fields_for_field_sensitive);
|
(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. */
|
/* For -O1 only do loop invariant motion for very small loops. */
|
||||||
maybe_set_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
|
maybe_set_param_value
|
||||||
opt2 ? initial_loop_invariant_max_bbs_in_loop : 1000);
|
(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. */
|
/* -O3 optimizations. */
|
||||||
opt3 = (optimize >= 3);
|
opt3 = (optimize >= 3);
|
||||||
|
@ -891,11 +889,13 @@ default_options_optimization (struct gcc_options *opts,
|
||||||
optimize = 2;
|
optimize = 2;
|
||||||
|
|
||||||
/* We want to crossjump as much as possible. */
|
/* We want to crossjump as much as possible. */
|
||||||
maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1);
|
maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
|
||||||
|
opts->x_param_values, opts_set->x_param_values);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS,
|
maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS,
|
||||||
initial_min_crossjump_insns);
|
default_param_value (PARAM_MIN_CROSSJUMP_INSNS),
|
||||||
|
opts->x_param_values, opts_set->x_param_values);
|
||||||
|
|
||||||
/* -Ofast adds optimizations to -O3. */
|
/* -Ofast adds optimizations to -O3. */
|
||||||
if (ofast)
|
if (ofast)
|
||||||
|
@ -1115,8 +1115,10 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set)
|
||||||
|
|
||||||
if (flag_conserve_stack)
|
if (flag_conserve_stack)
|
||||||
{
|
{
|
||||||
maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 100);
|
maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 100,
|
||||||
maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40);
|
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)
|
if (flag_wpa || flag_ltrans)
|
||||||
{
|
{
|
||||||
|
@ -1506,7 +1508,7 @@ common_handle_option (struct gcc_options *opts,
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case OPT__param:
|
case OPT__param:
|
||||||
handle_param (arg);
|
handle_param (opts, opts_set, arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_v:
|
case OPT_v:
|
||||||
|
@ -1826,8 +1828,10 @@ common_handle_option (struct gcc_options *opts,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_finline_limit_:
|
case OPT_finline_limit_:
|
||||||
set_param_value ("max-inline-insns-single", value / 2);
|
set_param_value ("max-inline-insns-single", value / 2,
|
||||||
set_param_value ("max-inline-insns-auto", 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;
|
break;
|
||||||
|
|
||||||
case OPT_finstrument_functions_exclude_function_list_:
|
case OPT_finstrument_functions_exclude_function_list_:
|
||||||
|
@ -2122,7 +2126,8 @@ common_handle_option (struct gcc_options *opts,
|
||||||
|
|
||||||
/* Handle --param NAME=VALUE. */
|
/* Handle --param NAME=VALUE. */
|
||||||
static void
|
static void
|
||||||
handle_param (const char *carg)
|
handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
|
||||||
|
const char *carg)
|
||||||
{
|
{
|
||||||
char *equal, *arg;
|
char *equal, *arg;
|
||||||
int value;
|
int value;
|
||||||
|
@ -2139,7 +2144,8 @@ handle_param (const char *carg)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*equal = '\0';
|
*equal = '\0';
|
||||||
set_param_value (arg, value);
|
set_param_value (arg, value,
|
||||||
|
opts->x_param_values, opts_set->x_param_values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
76
gcc/params.c
76
gcc/params.c
|
@ -35,11 +35,17 @@ param_info *compiler_params;
|
||||||
/* The number of entries in the table. */
|
/* The number of entries in the table. */
|
||||||
static size_t num_compiler_params;
|
static size_t num_compiler_params;
|
||||||
|
|
||||||
|
/* Whether the parameters have all been initialized and had their
|
||||||
|
default values determined. */
|
||||||
|
static bool params_finished;
|
||||||
|
|
||||||
/* Add the N PARAMS to the current list of compiler parameters. */
|
/* Add the N PARAMS to the current list of compiler parameters. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_params (const param_info params[], size_t n)
|
add_params (const param_info params[], size_t n)
|
||||||
{
|
{
|
||||||
|
gcc_assert (!params_finished);
|
||||||
|
|
||||||
/* Allocate enough space for the new parameters. */
|
/* Allocate enough space for the new parameters. */
|
||||||
compiler_params = XRESIZEVEC (param_info, compiler_params,
|
compiler_params = XRESIZEVEC (param_info, compiler_params,
|
||||||
num_compiler_params + n);
|
num_compiler_params + n);
|
||||||
|
@ -51,25 +57,39 @@ add_params (const param_info params[], size_t n)
|
||||||
num_compiler_params += n;
|
num_compiler_params += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the value of the parameter given by NUM to VALUE. If
|
/* Note that all parameters have been added and all default values
|
||||||
EXPLICIT_P, this is being set by the user; otherwise it is being
|
set. */
|
||||||
set implicitly by the compiler. */
|
|
||||||
|
void
|
||||||
|
finish_params (void)
|
||||||
|
{
|
||||||
|
params_finished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the value of the parameter given by NUM to VALUE in PARAMS and
|
||||||
|
PARAMS_SET. If EXPLICIT_P, this is being set by the user;
|
||||||
|
otherwise it is being set implicitly by the compiler. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_param_value_internal (compiler_param num, int value,
|
set_param_value_internal (compiler_param num, int value,
|
||||||
|
int *params, int *params_set,
|
||||||
bool explicit_p)
|
bool explicit_p)
|
||||||
{
|
{
|
||||||
size_t i = (size_t) num;
|
size_t i = (size_t) num;
|
||||||
|
|
||||||
compiler_params[i].value = value;
|
gcc_assert (params_finished);
|
||||||
|
|
||||||
|
params[i] = value;
|
||||||
if (explicit_p)
|
if (explicit_p)
|
||||||
compiler_params[i].set = true;
|
params_set[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the VALUE associated with the parameter given by NAME. */
|
/* Set the VALUE associated with the parameter given by NAME in PARAMS
|
||||||
|
and PARAMS_SET. */
|
||||||
|
|
||||||
void
|
void
|
||||||
set_param_value (const char *name, int value)
|
set_param_value (const char *name, int value,
|
||||||
|
int *params, int *params_set)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -90,7 +110,8 @@ set_param_value (const char *name, int value)
|
||||||
compiler_params[i].option,
|
compiler_params[i].option,
|
||||||
compiler_params[i].max_value);
|
compiler_params[i].max_value);
|
||||||
else
|
else
|
||||||
set_param_value_internal ((compiler_param) i, value, true);
|
set_param_value_internal ((compiler_param) i, value,
|
||||||
|
params, params_set, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,14 +119,16 @@ set_param_value (const char *name, int value)
|
||||||
error ("invalid parameter %qs", name);
|
error ("invalid parameter %qs", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the value of the parameter given by NUM to VALUE, implicitly,
|
/* Set the value of the parameter given by NUM to VALUE in PARAMS and
|
||||||
if it has not been set explicitly by the user. */
|
PARAMS_SET, implicitly, if it has not been set explicitly by the
|
||||||
|
user. */
|
||||||
|
|
||||||
void
|
void
|
||||||
maybe_set_param_value (compiler_param num, int value)
|
maybe_set_param_value (compiler_param num, int value,
|
||||||
|
int *params, int *params_set)
|
||||||
{
|
{
|
||||||
if (!PARAM_SET_P (num))
|
if (!params_set[(int) num])
|
||||||
set_param_value_internal (num, value, false);
|
set_param_value_internal (num, value, params, params_set, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the default value of a parameter given by NUM to VALUE, before
|
/* Set the default value of a parameter given by NUM to VALUE, before
|
||||||
|
@ -114,8 +137,31 @@ maybe_set_param_value (compiler_param num, int value)
|
||||||
void
|
void
|
||||||
set_default_param_value (compiler_param num, int value)
|
set_default_param_value (compiler_param num, int value)
|
||||||
{
|
{
|
||||||
gcc_assert (!PARAM_SET_P (num));
|
gcc_assert (!params_finished);
|
||||||
set_param_value_internal (num, value, false);
|
|
||||||
|
compiler_params[(int) num].default_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the default value of parameter NUM. */
|
||||||
|
|
||||||
|
int
|
||||||
|
default_param_value (compiler_param num)
|
||||||
|
{
|
||||||
|
return compiler_params[(int) num].default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize an array PARAMS with default values of the
|
||||||
|
parameters. */
|
||||||
|
|
||||||
|
void
|
||||||
|
init_param_values (int *params)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
gcc_assert (params_finished);
|
||||||
|
|
||||||
|
for (i = 0; i < num_compiler_params; i++)
|
||||||
|
params[i] = compiler_params[i].default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the current value of num_compiler_params, for the benefit of
|
/* Return the current value of num_compiler_params, for the benefit of
|
||||||
|
|
36
gcc/params.h
36
gcc/params.h
|
@ -44,11 +44,9 @@ typedef struct param_info
|
||||||
/* The name used with the `--param <name>=<value>' switch to set this
|
/* The name used with the `--param <name>=<value>' switch to set this
|
||||||
value. */
|
value. */
|
||||||
const char *const option;
|
const char *const option;
|
||||||
/* The associated value. */
|
|
||||||
int value;
|
|
||||||
|
|
||||||
/* True if the parameter was explicitly set. */
|
/* The default value. */
|
||||||
bool set;
|
int default_value;
|
||||||
|
|
||||||
/* Minimum acceptable value. */
|
/* Minimum acceptable value. */
|
||||||
int min_value;
|
int min_value;
|
||||||
|
@ -72,9 +70,12 @@ extern size_t get_num_compiler_params (void);
|
||||||
|
|
||||||
extern void add_params (const param_info params[], size_t n);
|
extern void add_params (const param_info params[], size_t n);
|
||||||
|
|
||||||
/* Set the VALUE associated with the parameter given by NAME. */
|
/* Set the VALUE associated with the parameter given by NAME in the
|
||||||
|
table PARAMS using PARAMS_SET to indicate which have been
|
||||||
|
explicitly set. */
|
||||||
|
|
||||||
extern void set_param_value (const char *name, int value);
|
extern void set_param_value (const char *name, int value,
|
||||||
|
int *params, int *params_set);
|
||||||
|
|
||||||
|
|
||||||
/* The parameters in use by language-independent code. */
|
/* The parameters in use by language-independent code. */
|
||||||
|
@ -90,22 +91,31 @@ typedef enum compiler_param
|
||||||
|
|
||||||
/* The value of the parameter given by ENUM. Not an lvalue. */
|
/* The value of the parameter given by ENUM. Not an lvalue. */
|
||||||
#define PARAM_VALUE(ENUM) \
|
#define PARAM_VALUE(ENUM) \
|
||||||
((int) compiler_params[(int) ENUM].value)
|
((int) global_options.x_param_values[(int) ENUM])
|
||||||
|
|
||||||
/* Set the value of the parameter given by NUM to VALUE, implicitly,
|
/* Set the value of the parameter given by NUM to VALUE, implicitly,
|
||||||
if it has not been set explicitly by the user. */
|
if it has not been set explicitly by the user, in the table PARAMS
|
||||||
|
using PARAMS_SET to indicate which have been explicitly set. */
|
||||||
|
|
||||||
extern void maybe_set_param_value (compiler_param num, int value);
|
extern void maybe_set_param_value (compiler_param num, int value,
|
||||||
|
int *params, int *params_set);
|
||||||
|
|
||||||
/* Set the default value of a parameter given by NUM to VALUE, before
|
/* Set the default value of a parameter given by NUM to VALUE, before
|
||||||
option processing. */
|
option processing. */
|
||||||
|
|
||||||
extern void set_default_param_value (compiler_param num, int value);
|
extern void set_default_param_value (compiler_param num, int value);
|
||||||
|
|
||||||
/* True if the value of the parameter was explicitly changed. Not an
|
/* Note that all parameters have been added and all default values
|
||||||
lvalue. */
|
set. */
|
||||||
#define PARAM_SET_P(ENUM) \
|
extern void finish_params (void);
|
||||||
((bool) compiler_params[(int) ENUM].set)
|
|
||||||
|
/* Return the default value of parameter NUM. */
|
||||||
|
|
||||||
|
extern int default_param_value (compiler_param num);
|
||||||
|
|
||||||
|
/* Initialize an array PARAMS with default values of the
|
||||||
|
parameters. */
|
||||||
|
extern void init_param_values (int *params);
|
||||||
|
|
||||||
/* Macros for the various parameters. */
|
/* Macros for the various parameters. */
|
||||||
#define STRUCT_REORG_COLD_STRUCT_RATIO \
|
#define STRUCT_REORG_COLD_STRUCT_RATIO \
|
||||||
|
|
|
@ -286,10 +286,10 @@ const char *user_label_prefix;
|
||||||
|
|
||||||
static const param_info lang_independent_params[] = {
|
static const param_info lang_independent_params[] = {
|
||||||
#define DEFPARAM(ENUM, OPTION, HELP, DEFAULT, MIN, MAX) \
|
#define DEFPARAM(ENUM, OPTION, HELP, DEFAULT, MIN, MAX) \
|
||||||
{ OPTION, DEFAULT, false, MIN, MAX, HELP },
|
{ OPTION, DEFAULT, MIN, MAX, HELP },
|
||||||
#include "params.def"
|
#include "params.def"
|
||||||
#undef DEFPARAM
|
#undef DEFPARAM
|
||||||
{ NULL, 0, false, 0, 0, NULL }
|
{ NULL, 0, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Output files for assembler code (real compiler output)
|
/* Output files for assembler code (real compiler output)
|
||||||
|
@ -1698,6 +1698,7 @@ general_init (const char *argv0)
|
||||||
init_ggc_heuristics();
|
init_ggc_heuristics();
|
||||||
init_optimization_passes ();
|
init_optimization_passes ();
|
||||||
statistics_early_init ();
|
statistics_early_init ();
|
||||||
|
finish_params ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if the current target supports -fsection-anchors. */
|
/* Return true if the current target supports -fsection-anchors. */
|
||||||
|
|
Loading…
Reference in New Issue