Commit c6d9a88c by Mark Mitchell Committed by Mark Mitchell

Makefile.in (toplev.o): Depend on params.h.

	* 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.

From-SVN: r39683
parent 4806765e
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> Wed Feb 14 11:13:45 CET 2001 Jan Hubicka <jh@suse.cz>
* i386.md (pushsf, pushdf_nointeger): Fix constraint. * i386.md (pushsf, pushdf_nointeger): Fix constraint.
......
...@@ -1340,7 +1340,8 @@ toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) function.h \ ...@@ -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 \ 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 \ 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) \ 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) \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
-DTARGET_NAME=\"$(target_alias)\" \ -DTARGET_NAME=\"$(target_alias)\" \
-c $(srcdir)/toplev.c -c $(srcdir)/toplev.c
...@@ -1406,7 +1407,8 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ ...@@ -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 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.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) \ $(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) \ 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 \ insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
toplev.h $(INSN_ATTR_H) toplev.h $(INSN_ATTR_H)
...@@ -1527,6 +1529,7 @@ ifcvt.o : ifcvt.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) \ ...@@ -1527,6 +1529,7 @@ ifcvt.o : ifcvt.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) \
output.h output.h
dependence.o : dependence.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \ dependence.o : dependence.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
$(C_COMMON_H) flags.h varray.h $(EXPR_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) \ $(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 \ $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
......
...@@ -579,10 +579,6 @@ extern int flag_prefix_function_name; ...@@ -579,10 +579,6 @@ extern int flag_prefix_function_name;
extern int g_switch_value; extern int g_switch_value;
extern int g_switch_set; 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. /* Values of the -falign-* flags: how much to align labels in code.
0 means `use default', 1 means `don't align'. 0 means `use default', 1 means `don't align'.
For each variable, there is an _log variant which is the power For each variable, there is an _log variant which is the power
......
...@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "intl.h" #include "intl.h"
#include "loop.h" #include "loop.h"
#include "params.h"
#include "obstack.h" #include "obstack.h"
#define obstack_chunk_alloc xmalloc #define obstack_chunk_alloc xmalloc
...@@ -89,15 +90,6 @@ static void copy_insn_list PARAMS ((rtx, struct inline_remap *, ...@@ -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 compare_blocks PARAMS ((const PTR, const PTR));
static int find_block 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 /* 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 called for the purpose of inlining or some other purpose (i.e. loop
unrolling). This affects how constant pool references are handled. unrolling). This affects how constant pool references are handled.
...@@ -135,11 +127,11 @@ function_cannot_inline_p (fndecl) ...@@ -135,11 +127,11 @@ function_cannot_inline_p (fndecl)
tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl))); tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
/* For functions marked as inline increase the maximum size to /* 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. */ use the limit given by INTEGRATE_THRESHOLD. */
int max_insns = (DECL_INLINE (fndecl)) int max_insns = (DECL_INLINE (fndecl))
? (inline_max_insns ? (MAX_INLINE_INSNS
+ 8 * list_length (DECL_ARGUMENTS (fndecl))) + 8 * list_length (DECL_ARGUMENTS (fndecl)))
: INTEGRATE_THRESHOLD (fndecl); : INTEGRATE_THRESHOLD (fndecl);
......
/* 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);
}
/* 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: */
/* 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 */
...@@ -63,6 +63,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -63,6 +63,7 @@ Boston, MA 02111-1307, USA. */
#include "timevar.h" #include "timevar.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "ssa.h" #include "ssa.h"
#include "params.h"
#ifndef ACCUMULATE_OUTGOING_ARGS #ifndef ACCUMULATE_OUTGOING_ARGS
#define ACCUMULATE_OUTGOING_ARGS 0 #define ACCUMULATE_OUTGOING_ARGS 0
...@@ -958,6 +959,14 @@ int flag_leading_underscore = -1; ...@@ -958,6 +959,14 @@ int flag_leading_underscore = -1;
/* The user symbol prefix after having resolved same. */ /* The user symbol prefix after having resolved same. */
const char *user_label_prefix; 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. */ /* A default for same. */
#ifndef USER_LABEL_PREFIX #ifndef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "" #define USER_LABEL_PREFIX ""
...@@ -4034,8 +4043,12 @@ decode_f_option (arg) ...@@ -4034,8 +4043,12 @@ decode_f_option (arg)
if ((option_value = skip_leading_substring (arg, "inline-limit-")) if ((option_value = skip_leading_substring (arg, "inline-limit-"))
|| (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 #ifdef INSN_SCHEDULING
else if ((option_value = skip_leading_substring (arg, "sched-verbose="))) else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
fix_sched_param ("verbose", option_value); fix_sched_param ("verbose", option_value);
...@@ -4321,6 +4334,40 @@ independent_decode_option (argc, argv) ...@@ -4321,6 +4334,40 @@ independent_decode_option (argc, argv)
exit (0); 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') if (*arg == 'Y')
arg++; arg++;
...@@ -4562,6 +4609,9 @@ main (argc, argv) ...@@ -4562,6 +4609,9 @@ main (argc, argv)
/* Initialize the diagnostics reporting machinery. */ /* Initialize the diagnostics reporting machinery. */
initialize_diagnostics (); initialize_diagnostics ();
/* Register the language-independent parameters. */
add_params (lang_independent_params, LAST_PARAM);
/* Perform language-specific options intialization. */ /* Perform language-specific options intialization. */
if (lang_hooks.init_options) if (lang_hooks.init_options)
(*lang_hooks.init_options) (); (*lang_hooks.init_options) ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment