summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-14 16:24:45 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-14 16:24:45 +0000
commit9a33a2e86c17c6e282bf93c10eb768c410d584c7 (patch)
tree358938d277595e7cf94e5146dc0522239e45faf5 /gcc
parent97d8fa3dceef751544f84e1629937e0fc1c7a453 (diff)
downloadppe42-gcc-9a33a2e86c17c6e282bf93c10eb768c410d584c7.tar.gz
ppe42-gcc-9a33a2e86c17c6e282bf93c10eb768c410d584c7.zip
* Makefile.in (toplev.o): Depend on params.h.
(intergate.o): Likewise. (params.o): New target. * flags.h (inline_max_insns): Remove. * integrate.c: Include params.h. Use MAX_INLINE_INSNS instead of inline_max_insns. * params.c: New file. * params.h: Likewise. * params.def: Likewise. * toplev.c: Include params.h. (lang_independent_params): New variable. (decode_f_option): Use the param machinery instead of setting max_inline_insns. (independent_decode_option): Handle "--param name=value". (main): Register language-independent parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39683 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/Makefile.in7
-rw-r--r--gcc/flags.h4
-rw-r--r--gcc/integrate.c14
-rw-r--r--gcc/params.c84
-rw-r--r--gcc/params.def50
-rw-r--r--gcc/params.h85
-rw-r--r--gcc/toplev.c54
8 files changed, 297 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e77d4d8c927..07ab9265b52 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2001-02-14 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (toplev.o): Depend on params.h.
+ (intergate.o): Likewise.
+ (params.o): New target.
+ * flags.h (inline_max_insns): Remove.
+ * integrate.c: Include params.h.
+ Use MAX_INLINE_INSNS instead of inline_max_insns.
+ * params.c: New file.
+ * params.h: Likewise.
+ * params.def: Likewise.
+ * toplev.c: Include params.h.
+ (lang_independent_params): New variable.
+ (decode_f_option): Use the param machinery instead of setting
+ max_inline_insns.
+ (independent_decode_option): Handle "--param name=value".
+ (main): Register language-independent parameters.
+
Wed Feb 14 11:13:45 CET 2001 Jan Hubicka <jh@suse.cz>
* i386.md (pushsf, pushdf_nointeger): Fix constraint.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index bcc27ec979a..6f808c4c7b4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1340,7 +1340,8 @@ toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) function.h \
flags.h input.h $(INSN_ATTR_H) xcoffout.h output.h diagnostic.h \
insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
- graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) ssa.h
+ graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
+ ssa.h params.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
-DTARGET_NAME=\"$(target_alias)\" \
-c $(srcdir)/toplev.c
@@ -1406,7 +1407,8 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
$(INTEGRATE_H) insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
- intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H)
+ intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H) \
+ params.h
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
toplev.h $(INSN_ATTR_H)
@@ -1527,6 +1529,7 @@ ifcvt.o : ifcvt.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) \
output.h
dependence.o : dependence.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
$(C_COMMON_H) flags.h varray.h $(EXPR_H)
+params.o : params.c $(CONFIG_H) system.h params.h toplev.h
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
diff --git a/gcc/flags.h b/gcc/flags.h
index 99678ba5755..3ef556eb42b 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -579,10 +579,6 @@ extern int flag_prefix_function_name;
extern int g_switch_value;
extern int g_switch_set;
-/* Value of the -finline-limit flag. */
-
-extern int inline_max_insns;
-
/* Values of the -falign-* flags: how much to align labels in code.
0 means `use default', 1 means `don't align'.
For each variable, there is an _log variant which is the power
diff --git a/gcc/integrate.c b/gcc/integrate.c
index bfcd85bb39a..9f28a37258d 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "intl.h"
#include "loop.h"
+#include "params.h"
#include "obstack.h"
#define obstack_chunk_alloc xmalloc
@@ -89,15 +90,6 @@ static void copy_insn_list PARAMS ((rtx, struct inline_remap *,
static int compare_blocks PARAMS ((const PTR, const PTR));
static int find_block PARAMS ((const PTR, const PTR));
-/* The maximum number of instructions accepted for inlining a
- function. Increasing values mean more agressive inlining.
- This affects currently only functions explicitly marked as
- inline (or methods defined within the class definition for C++).
- The default value of 10000 is arbitrary but high to match the
- previously unlimited gcc capabilities. */
-
-int inline_max_insns = 10000;
-
/* Used by copy_rtx_and_substitute; this indicates whether the function is
called for the purpose of inlining or some other purpose (i.e. loop
unrolling). This affects how constant pool references are handled.
@@ -135,11 +127,11 @@ function_cannot_inline_p (fndecl)
tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
/* For functions marked as inline increase the maximum size to
- inline_max_insns (-finline-limit-<n>). For regular functions
+ MAX_INLINE_INSNS (-finline-limit-<n>). For regular functions
use the limit given by INTEGRATE_THRESHOLD. */
int max_insns = (DECL_INLINE (fndecl))
- ? (inline_max_insns
+ ? (MAX_INLINE_INSNS
+ 8 * list_length (DECL_ARGUMENTS (fndecl)))
: INTEGRATE_THRESHOLD (fndecl);
diff --git a/gcc/params.c b/gcc/params.c
new file mode 100644
index 00000000000..9b1b09ccc42
--- /dev/null
+++ b/gcc/params.c
@@ -0,0 +1,84 @@
+/* params.c - Run-time parameters.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Mark Mitchell <mark@codesourcery.com>.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+*/
+
+#include "config.h"
+#include "system.h"
+#include "params.h"
+#include "toplev.h"
+
+/* An array containing the compiler parameters and their current
+ values. */
+
+param_info *compiler_params;
+
+/* The number of entries in the table. */
+
+static size_t num_compiler_params;
+
+/* Add the N PARAMS to the current list of compiler parameters. */
+
+void
+add_params (params, n)
+ const param_info params[];
+ size_t n;
+{
+ /* Allocate enough space for the new parameters. */
+ compiler_params =
+ ((param_info *)
+ xrealloc (compiler_params,
+ (num_compiler_params + n) * sizeof (param_info)));
+ /* Copy them into the table. */
+ memcpy (compiler_params + num_compiler_params,
+ params,
+ n * sizeof (param_info));
+ /* Keep track of how many parameters we have. */
+ num_compiler_params += n;
+}
+
+/* Set the VALUE associated with the parameter given by NAME. */
+
+void
+set_param_value (name, value)
+ const char *name;
+ int value;
+{
+ size_t i;
+
+ /* Make sure nobody tries to set a parameter to an invalid value. */
+ if (value == INVALID_PARAM_VAL)
+ abort ();
+
+ /* Scan the parameter table to find a matching entry. */
+ for (i = 0; i < num_compiler_params; ++i)
+ if (strcmp (compiler_params[i].option, name) == 0)
+ {
+ compiler_params[i].value = value;
+ return;
+ }
+
+ /* If we didn't find this parameter, issue an error message. */
+ error ("invalid parameter `%s'", name);
+}
+
+
+
diff --git a/gcc/params.def b/gcc/params.def
new file mode 100644
index 00000000000..f96a89f69ae
--- /dev/null
+++ b/gcc/params.def
@@ -0,0 +1,50 @@
+/* params.def - Run-time parameters.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Mark Mitchell <mark@codesourcery.com>.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+*/
+
+/* This file contains definitions for language-independent
+ parameters. The DEFPARAM macro takes 4 arguments:
+
+ - The enumeral corresonding to this parameter.
+
+ - The name that can be used to set this parameter using the
+ command-line option `--param <name>=<value>'.
+
+ - A help string explaining how the parameter is used.
+
+ - A default value for the parameter. */
+
+/* The maximum number of instructions accepted for inlining a
+ function. Increasing values mean more agressive inlining.
+ This affects currently only functions explicitly marked as
+ inline (or methods defined within the class definition for C++).
+ The default value of 10000 is arbitrary but high to match the
+ previously unlimited gcc capabilities. */
+DEFPARAM (PARAM_MAX_INLINE_INSNS,
+ "max-inline-insns",
+ "The maximum number of instructions in a function that is eligible for inlining",
+ 10000)
+
+/*
+Local variables:
+mode:c
+End: */
diff --git a/gcc/params.h b/gcc/params.h
new file mode 100644
index 00000000000..c097ad1c489
--- /dev/null
+++ b/gcc/params.h
@@ -0,0 +1,85 @@
+/* params.h - Run-time parameters.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Mark Mitchell <mark@codesourcery.com>.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+*/
+
+/* This module provides a means for setting integral parameters
+ dynamically. Instead of encoding magic numbers in various places,
+ use this module to organize all the magic numbers in a single
+ place. The values of the parameters can be set on the
+ command-line, thereby providing a way to control the amount of
+ effort spent on particular optimization passes, or otherwise tune
+ the behavior of the compiler. */
+
+#ifndef PARAMS_H
+#define PARAMS_H
+
+/* No parameter shall have this value. */
+
+#define INVALID_PARAM_VAL (-1)
+
+/* The information associated with each parameter. */
+
+typedef struct param_info
+{
+ /* The name used with the `--param <name>=<value>' switch to set this
+ value. */
+ const char *option;
+ /* The associated value. */
+ int value;
+} param_info;
+
+/* An array containing the compiler parameters and their current
+ values. */
+
+extern param_info *compiler_params;
+
+/* Add the N PARAMS to the current list of compiler parameters. */
+
+extern void add_params
+ PARAMS ((const param_info params[], size_t n));
+
+/* Set the VALUE associated with the parameter given by NAME. */
+
+extern void set_param_value
+ PARAMS ((const char *name, int value));
+
+
+/* The parameters in use by language-independent code. */
+
+typedef enum compiler_param
+{
+#define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
+ ENUM,
+#include "params.def"
+#undef DEFPARAM
+ LAST_PARAM
+} compiler_param;
+
+/* The value of the parameter given by ENUM. */
+#define PARAM_VALUE(ENUM) \
+ (compiler_params[(int) ENUM].value)
+
+/* Macros for the various parameters. */
+#define MAX_INLINE_INSNS \
+ PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
+
+#endif /* PARAMS_H */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7c818bd0100..66c91d43fb1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -63,6 +63,7 @@ Boston, MA 02111-1307, USA. */
#include "timevar.h"
#include "diagnostic.h"
#include "ssa.h"
+#include "params.h"
#ifndef ACCUMULATE_OUTGOING_ARGS
#define ACCUMULATE_OUTGOING_ARGS 0
@@ -958,6 +959,14 @@ int flag_leading_underscore = -1;
/* The user symbol prefix after having resolved same. */
const char *user_label_prefix;
+static const param_info lang_independent_params[] = {
+#define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
+ { OPTION, DEFAULT },
+#include "params.def"
+#undef DEFPARAM
+ { NULL, 0 }
+};
+
/* A default for same. */
#ifndef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX ""
@@ -4034,8 +4043,12 @@ decode_f_option (arg)
if ((option_value = skip_leading_substring (arg, "inline-limit-"))
|| (option_value = skip_leading_substring (arg, "inline-limit=")))
- inline_max_insns =
- read_integral_parameter (option_value, arg - 2, inline_max_insns);
+ {
+ int val =
+ read_integral_parameter (option_value, arg - 2,
+ MAX_INLINE_INSNS);
+ set_param_value ("max-inline-insns", val);
+ }
#ifdef INSN_SCHEDULING
else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
fix_sched_param ("verbose", option_value);
@@ -4321,6 +4334,40 @@ independent_decode_option (argc, argv)
exit (0);
}
+ /* Handle '--param <name>=<value>'. */
+ if (strcmp (arg, "-param") == 0)
+ {
+ char *equal;
+
+ if (argc == 1)
+ {
+ error ("-param option missing argument");
+ return 1;
+ }
+
+ /* Get the '<name>=<value' parameter. */
+ arg = argv[1];
+ /* Look for the `='. */
+ equal = strchr (arg, '=');
+ if (!equal)
+ error ("invalid --param option: %s", arg);
+ else
+ {
+ int val;
+
+ /* Zero out the `=' sign so that we get two separate strings. */
+ *equal = '\0';
+ /* Figure out what value is specified. */
+ val = read_integral_parameter (equal + 1, NULL, INVALID_PARAM_VAL);
+ if (val != INVALID_PARAM_VAL)
+ set_param_value (arg, val);
+ else
+ error ("invalid parameter value `%s'", equal + 1);
+ }
+
+ return 2;
+ }
+
if (*arg == 'Y')
arg++;
@@ -4562,6 +4609,9 @@ main (argc, argv)
/* Initialize the diagnostics reporting machinery. */
initialize_diagnostics ();
+ /* Register the language-independent parameters. */
+ add_params (lang_independent_params, LAST_PARAM);
+
/* Perform language-specific options intialization. */
if (lang_hooks.init_options)
(*lang_hooks.init_options) ();
OpenPOWER on IntegriCloud