diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-10-14 11:22:43 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-10-14 11:22:43 +0100 |
commit | 48476d13b2878a02ffcb38df139594a2477989f1 (patch) | |
tree | 9b340b8d6c331d28e231ef93373d6e4219525626 /gcc/params.c | |
parent | 4af476d7f2d3571c981b629995d3b3f1f8ffd3ab (diff) | |
download | gcc-48476d13b2878a02ffcb38df139594a2477989f1.zip gcc-48476d13b2878a02ffcb38df139594a2477989f1.tar.gz gcc-48476d13b2878a02ffcb38df139594a2477989f1.tar.bz2 |
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
Diffstat (limited to 'gcc/params.c')
-rw-r--r-- | gcc/params.c | 76 |
1 files changed, 61 insertions, 15 deletions
diff --git a/gcc/params.c b/gcc/params.c index 666913a..07950b3 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -35,11 +35,17 @@ param_info *compiler_params; /* The number of entries in the table. */ 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. */ void add_params (const param_info params[], size_t n) { + gcc_assert (!params_finished); + /* Allocate enough space for the new parameters. */ compiler_params = XRESIZEVEC (param_info, compiler_params, num_compiler_params + n); @@ -51,25 +57,39 @@ add_params (const param_info params[], size_t n) num_compiler_params += n; } -/* Set the value of the parameter given by NUM to VALUE. If - EXPLICIT_P, this is being set by the user; otherwise it is being - set implicitly by the compiler. */ +/* Note that all parameters have been added and all default values + set. */ + +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 set_param_value_internal (compiler_param num, int value, + int *params, int *params_set, bool explicit_p) { size_t i = (size_t) num; - compiler_params[i].value = value; + gcc_assert (params_finished); + + params[i] = value; 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 -set_param_value (const char *name, int value) +set_param_value (const char *name, int value, + int *params, int *params_set) { size_t i; @@ -90,7 +110,8 @@ set_param_value (const char *name, int value) compiler_params[i].option, compiler_params[i].max_value); else - set_param_value_internal ((compiler_param) i, value, true); + set_param_value_internal ((compiler_param) i, value, + params, params_set, true); return; } @@ -98,14 +119,16 @@ set_param_value (const char *name, int value) error ("invalid parameter %qs", name); } -/* Set the value of the parameter given by NUM to VALUE, implicitly, - if it has not been set explicitly by the user. */ +/* Set the value of the parameter given by NUM to VALUE in PARAMS and + PARAMS_SET, implicitly, if it has not been set explicitly by the + user. */ 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)) - set_param_value_internal (num, value, false); + if (!params_set[(int) num]) + set_param_value_internal (num, value, params, params_set, false); } /* 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 set_default_param_value (compiler_param num, int value) { - gcc_assert (!PARAM_SET_P (num)); - set_param_value_internal (num, value, false); + gcc_assert (!params_finished); + + 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 |