summaryrefslogtreecommitdiff
path: root/gcc/params.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 21:44:44 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 21:44:44 +0000
commit77d3568815aaad6487a295a42e0fce17c1c71b19 (patch)
treef9fd5b7f95f54528ed914ff8348f63ec1722000e /gcc/params.c
parent5f5dce8d85baa565d58eb34f4723b14b828417b4 (diff)
downloadgcc-77d3568815aaad6487a295a42e0fce17c1c71b19.tar.gz
2010-10-11 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 165329 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@165333 138bc75d-0d04-0410-961f-82ee72b054a4
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 cec5751a5f6..666913a7b25 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. */