diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/common/common-target.def | 7 | ||||
-rw-r--r-- | gcc/common/common-targhooks.c | 9 | ||||
-rw-r--r-- | gcc/common/common-targhooks.h | 2 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 4 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 | ||||
-rw-r--r-- | gcc/params.c | 2 |
7 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0eafc63f..7ae7b90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2018-10-01 Tamar Christina <tamar.christina@arm.com> + * params.c (set_param_value): + Add index of parameter being validated. + * common/common-target.def (option_validate_param): New. + * common/common-targhooks.h (default_option_validate_param): New. + * common/common-targhooks.c (default_option_validate_param): New. + * doc/tm.texi.in (TARGET_OPTION_VALIDATE_PARAM): New. + * doc/tm.texi: Regenerate. + +2018-10-01 Tamar Christina <tamar.christina@arm.com> + PR target/86486 * config/aarch64/aarch64.c (aarch64_override_options_internal): Add validation for stack-clash parameters and set defaults. diff --git a/gcc/common/common-target.def b/gcc/common/common-target.def index 019b1e7..8a268b6 100644 --- a/gcc/common/common-target.def +++ b/gcc/common/common-target.def @@ -56,6 +56,13 @@ DEFHOOK void, (void), hook_void_void) +DEFHOOK +(option_validate_param, +"Validate target-dependent value for @option{--param} settings, using\ + calls to @code{set_param_value}.", + bool, (int, int), + default_option_validate_param) + /* The initial value of target_flags. */ DEFHOOKPOD (default_target_flags, diff --git a/gcc/common/common-targhooks.c b/gcc/common/common-targhooks.c index 1b1a015..990c495 100644 --- a/gcc/common/common-targhooks.c +++ b/gcc/common/common-targhooks.c @@ -86,6 +86,15 @@ default_get_valid_option_values (int, const char *) return vec<const char *> (); } +/* Default version of TARGET_OPTION_VALIDATE_PARAM. */ + +bool +default_option_validate_param (const int value ATTRIBUTE_UNUSED, + const int param ATTRIBUTE_UNUSED) +{ + return true; +} + const struct default_options empty_optimization_table[] = { { OPT_LEVELS_NONE, 0, NULL, 0 } diff --git a/gcc/common/common-targhooks.h b/gcc/common/common-targhooks.h index 4bdf8ef..b021ff0 100644 --- a/gcc/common/common-targhooks.h +++ b/gcc/common/common-targhooks.h @@ -30,6 +30,8 @@ extern bool default_target_handle_option (struct gcc_options *, location_t); extern vec<const char *> default_get_valid_option_values (int, const char *); +extern bool default_option_validate_param (const int, const int); + extern const struct default_options empty_optimization_table[]; #endif diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index b00e4b6..83965b2 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -753,6 +753,10 @@ Set target-dependent initial values of fields in @var{opts}. Set target-dependent default values for @option{--param} settings, using calls to @code{set_default_param_value}. @end deftypefn +@deftypefn {Common Target Hook} bool TARGET_OPTION_VALIDATE_PARAM (int, @var{int}) +Validate target-dependent value for @option{--param} settings, using calls to @code{set_param_value}. +@end deftypefn + @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index e2b6f94..e1966bd 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -729,6 +729,8 @@ options are changed via @code{#pragma GCC optimize} or by using the @hook TARGET_OPTION_DEFAULT_PARAMS +@hook TARGET_OPTION_VALIDATE_PARAM + @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for diff --git a/gcc/params.c b/gcc/params.c index 623296c..eb663be 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -209,7 +209,7 @@ set_param_value (const char *name, int value, error ("maximum value of parameter %qs is %u", compiler_params[i].option, compiler_params[i].max_value); - else + else if (targetm_common.option_validate_param (value, (int)i)) set_param_value_internal ((compiler_param) i, value, params, params_set, true); } |