From 03ced4ab9f729cc4d5854439f136d84d1343b32d Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 1 Oct 2018 13:06:53 +0000 Subject: Allow back-ends to be able to do custom validations on params. This patch adds the ability for backends to add custom constrains to the param values by defining a new hook option_validate_param. This hook is invoked on every set_param_value which allows the back-end to ensure that the parameters are always within it's desired state. gcc/ * 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. From-SVN: r264755 --- gcc/doc/tm.texi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/doc/tm.texi') 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 -- cgit v1.1