aboutsummaryrefslogtreecommitdiff
path: root/gcc/params.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-10-11 13:28:40 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-10-11 13:28:40 +0100
commit128dc8e23075f70721ff1cbe3294021e7dd82834 (patch)
tree10941206f59ba4ef8b1a814126f81d1e02f511d4 /gcc/params.c
parent4907769827b246d80145601c6fa5caf84f04f941 (diff)
downloadgcc-128dc8e23075f70721ff1cbe3294021e7dd82834.zip
gcc-128dc8e23075f70721ff1cbe3294021e7dd82834.tar.gz
gcc-128dc8e23075f70721ff1cbe3294021e7dd82834.tar.bz2
params.c (set_param_value_internal): New.
* params.c (set_param_value_internal): New. (set_param_value): Use set_param_value_internal. (maybe_set_param_value, set_default_param_value): New. * params.h (PARAM_VALUE, PARAM_SET_P): Make into rvalues. (maybe_set_param_value, set_default_param_value): Declare. * config/arm/arm.c (arm_option_override): Use maybe_set_param_value. * config/i386/i386.c (ix86_option_override_internal): Use maybe_set_param_value. * config/ia64/ia64.c (ia64_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (ia64_option_optimization): Move some code to ia64_option_default_params. * config/picochip/picochip.c (picochip_option_override): Use maybe_set_param_value. * config/rs6000/rs6000.c (rs6000_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (rs6000_option_override_internal): Use maybe_set_param_value. (rs6000_option_optimization): Move some code to rs6000_option_default_params. * config/s390/s390.c (s390_option_override): Use maybe_set_param_value. * config/sh/sh.c (sh_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (sh_option_optimization): Move some code to sh_option_default_params. * config/sparc/sparc.c (sparc_option_override): Use maybe_set_param_value. * config/spu/spu.c (spu_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (spu_option_optimization): Move some code to spu_option_default_params. (spu_option_override): Use maybe_set_param_value. * doc/tm.texi.in (TARGET_OPTION_DEFAULT_PARAMS): New @hook. * doc/tm.texi: Regenerate. * ggc-common.c (init_ggc_heuristics): Use set_default_param_value. * opts.c (init_options_once): Use PARAM_VALUE not direct access to compiler_params. (default_options_optimization): Use maybe_set_param_value. (finish_options): Use maybe_set_param_value. * target.def (target_option.default_params): New hook. * toplev.c (general_init): Call targetm.target_option.default_params. From-SVN: r165303
Diffstat (limited to 'gcc/params.c')
-rw-r--r--gcc/params.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/gcc/params.c b/gcc/params.c
index cec5751..666913a 100644
--- a/gcc/params.c
+++ b/gcc/params.c
@@ -1,5 +1,5 @@
/* params.c - Run-time parameters.
- Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>.
@@ -51,6 +51,21 @@ 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. */
+
+static void
+set_param_value_internal (compiler_param num, int value,
+ bool explicit_p)
+{
+ size_t i = (size_t) num;
+
+ compiler_params[i].value = value;
+ if (explicit_p)
+ compiler_params[i].set = true;
+}
+
/* Set the VALUE associated with the parameter given by NAME. */
void
@@ -75,10 +90,7 @@ set_param_value (const char *name, int value)
compiler_params[i].option,
compiler_params[i].max_value);
else
- {
- compiler_params[i].value = value;
- compiler_params[i].set = true;
- }
+ set_param_value_internal ((compiler_param) i, value, true);
return;
}
@@ -86,6 +98,26 @@ 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. */
+
+void
+maybe_set_param_value (compiler_param num, int value)
+{
+ if (!PARAM_SET_P (num))
+ set_param_value_internal (num, value, false);
+}
+
+/* Set the default value of a parameter given by NUM to VALUE, before
+ option processing. */
+
+void
+set_default_param_value (compiler_param num, int value)
+{
+ gcc_assert (!PARAM_SET_P (num));
+ set_param_value_internal (num, value, false);
+}
+
/* Return the current value of num_compiler_params, for the benefit of
plugins that use parameters as features. */