params.h revision 90075
1251881Speter/* params.h - Run-time parameters.
2251881Speter   Copyright (C) 2001 Free Software Foundation, Inc.
3251881Speter   Written by Mark Mitchell <mark@codesourcery.com>.
4251881Speter
5251881SpeterThis file is part of GCC.
6251881Speter
7251881SpeterGCC is free software; you can redistribute it and/or modify it under
8251881Speterthe terms of the GNU General Public License as published by the Free
9251881SpeterSoftware Foundation; either version 2, or (at your option) any later
10251881Speterversion.
11251881Speter
12251881SpeterGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13251881SpeterWARRANTY; without even the implied warranty of MERCHANTABILITY or
14251881SpeterFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15251881Speterfor more details.
16251881Speter
17251881SpeterYou should have received a copy of the GNU General Public License
18251881Speteralong with GCC; see the file COPYING.  If not, write to the Free
19251881SpeterSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20251881Speter02111-1307, USA.
21251881Speter
22251881Speter*/
23251881Speter
24251881Speter/* This module provides a means for setting integral parameters
25251881Speter   dynamically.  Instead of encoding magic numbers in various places,
26251881Speter   use this module to organize all the magic numbers in a single
27251881Speter   place.  The values of the parameters can be set on the
28251881Speter   command-line, thereby providing a way to control the amount of
29251881Speter   effort spent on particular optimization passes, or otherwise tune
30251881Speter   the behavior of the compiler.
31251881Speter
32251881Speter   Since their values can be set on the command-line, these parameters
33251881Speter   should not be used for non-dynamic memory allocation.  */
34251881Speter
35251881Speter#ifndef GCC_PARAMS_H
36251881Speter#define GCC_PARAMS_H
37251881Speter
38251881Speter/* No parameter shall have this value.  */
39251881Speter
40251881Speter#define INVALID_PARAM_VAL (-1)
41251881Speter
42251881Speter/* The information associated with each parameter.  */
43251881Speter
44251881Spetertypedef struct param_info
45251881Speter{
46251881Speter  /* The name used with the `--param <name>=<value>' switch to set this
47251881Speter     value.  */
48251881Speter  const char *const option;
49251881Speter  /* The associated value.  */
50251881Speter  int value;
51251881Speter  /* A short description of the option.  */
52251881Speter  const char *const help;
53251881Speter} param_info;
54251881Speter
55251881Speter/* An array containing the compiler parameters and their current
56251881Speter   values.  */
57251881Speter
58251881Speterextern param_info *compiler_params;
59251881Speter
60251881Speter/* Add the N PARAMS to the current list of compiler parameters.  */
61251881Speter
62251881Speterextern void add_params
63251881Speter  PARAMS ((const param_info params[], size_t n));
64251881Speter
65251881Speter/* Set the VALUE associated with the parameter given by NAME.  */
66251881Speter
67251881Speterextern void set_param_value
68251881Speter  PARAMS ((const char *name, int value));
69251881Speter
70251881Speter
71251881Speter/* The parameters in use by language-independent code.  */
72251881Speter
73251881Spetertypedef enum compiler_param
74251881Speter{
75251881Speter#define DEFPARAM(enumerator, option, msgid, default) \
76251881Speter  enumerator,
77251881Speter#include "params.def"
78251881Speter#undef DEFPARAM
79251881Speter  LAST_PARAM
80251881Speter} compiler_param;
81251881Speter
82251881Speter/* The value of the parameter given by ENUM.  */
83251881Speter#define PARAM_VALUE(ENUM) \
84251881Speter  (compiler_params[(int) ENUM].value)
85251881Speter
86251881Speter/* Macros for the various parameters.  */
87251881Speter#define MAX_INLINE_INSNS \
88251881Speter  PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
89251881Speter#define MAX_DELAY_SLOT_INSN_SEARCH \
90251881Speter  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
91251881Speter#define MAX_DELAY_SLOT_LIVE_SEARCH \
92251881Speter  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
93251881Speter#define MAX_PENDING_LIST_LENGTH \
94251881Speter  PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
95251881Speter#define MAX_GCSE_MEMORY \
96251881Speter  ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
97251881Speter#define MAX_GCSE_PASSES \
98251881Speter  PARAM_VALUE (PARAM_MAX_GCSE_PASSES)
99251881Speter#endif /* ! GCC_PARAMS_H */
100251881Speter