params.h revision 117395
1109998Smarkm/* params.h - Run-time parameters.
2109998Smarkm   Copyright (C) 2001 Free Software Foundation, Inc.
3109998Smarkm   Written by Mark Mitchell <mark@codesourcery.com>.
4109998Smarkm
5109998SmarkmThis file is part of GCC.
6109998Smarkm
7109998SmarkmGCC is free software; you can redistribute it and/or modify it under
8109998Smarkmthe terms of the GNU General Public License as published by the Free
9109998SmarkmSoftware Foundation; either version 2, or (at your option) any later
10109998Smarkmversion.
11109998Smarkm
12109998SmarkmGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13109998SmarkmWARRANTY; without even the implied warranty of MERCHANTABILITY or
14109998SmarkmFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15109998Smarkmfor more details.
16109998Smarkm
17109998SmarkmYou should have received a copy of the GNU General Public License
18109998Smarkmalong with GCC; see the file COPYING.  If not, write to the Free
19109998SmarkmSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20109998Smarkm02111-1307, USA.
21109998Smarkm
22109998Smarkm*/
23109998Smarkm
24109998Smarkm/* This module provides a means for setting integral parameters
25109998Smarkm   dynamically.  Instead of encoding magic numbers in various places,
26109998Smarkm   use this module to organize all the magic numbers in a single
27109998Smarkm   place.  The values of the parameters can be set on the
28109998Smarkm   command-line, thereby providing a way to control the amount of
29109998Smarkm   effort spent on particular optimization passes, or otherwise tune
30109998Smarkm   the behavior of the compiler.
31109998Smarkm
32109998Smarkm   Since their values can be set on the command-line, these parameters
33109998Smarkm   should not be used for non-dynamic memory allocation.  */
34109998Smarkm
35109998Smarkm#ifndef GCC_PARAMS_H
36109998Smarkm#define GCC_PARAMS_H
37109998Smarkm
38109998Smarkm/* No parameter shall have this value.  */
39109998Smarkm
40279264Sdelphij#define INVALID_PARAM_VAL (-1)
41109998Smarkm
42109998Smarkm/* The information associated with each parameter.  */
43109998Smarkm
44109998Smarkmtypedef struct param_info
45109998Smarkm{
46109998Smarkm  /* The name used with the `--param <name>=<value>' switch to set this
47109998Smarkm     value.  */
48109998Smarkm  const char *const option;
49109998Smarkm  /* The associated value.  */
50109998Smarkm  int value;
51109998Smarkm  /* A short description of the option.  */
52109998Smarkm  const char *const help;
53109998Smarkm} param_info;
54109998Smarkm
55109998Smarkm/* An array containing the compiler parameters and their current
56109998Smarkm   values.  */
57279264Sdelphij
58279264Sdelphijextern param_info *compiler_params;
59109998Smarkm
60109998Smarkm/* Add the N PARAMS to the current list of compiler parameters.  */
61109998Smarkm
62109998Smarkmextern void add_params
63109998Smarkm  PARAMS ((const param_info params[], size_t n));
64109998Smarkm
65109998Smarkm/* Set the VALUE associated with the parameter given by NAME.  */
66109998Smarkm
67109998Smarkmextern void set_param_value
68109998Smarkm  PARAMS ((const char *name, int value));
69279264Sdelphij
70109998Smarkm
71109998Smarkm/* The parameters in use by language-independent code.  */
72109998Smarkm
73109998Smarkmtypedef enum compiler_param
74109998Smarkm{
75109998Smarkm#define DEFPARAM(enumerator, option, msgid, default) \
76109998Smarkm  enumerator,
77109998Smarkm#include "params.def"
78109998Smarkm#undef DEFPARAM
79109998Smarkm  LAST_PARAM
80109998Smarkm} compiler_param;
81
82/* The value of the parameter given by ENUM.  */
83#define PARAM_VALUE(ENUM) \
84  (compiler_params[(int) ENUM].value)
85
86/* Macros for the various parameters.  */
87#define MAX_INLINE_INSNS_SINGLE \
88  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
89#define MAX_INLINE_INSNS \
90  PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
91#define MAX_INLINE_SLOPE \
92  PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
93#define MIN_INLINE_INSNS \
94  PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
95#define MAX_INLINE_INSNS_AUTO \
96  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
97#define MAX_INLINE_INSNS_RTL \
98  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_RTL)
99#define MAX_DELAY_SLOT_INSN_SEARCH \
100  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
101#define MAX_DELAY_SLOT_LIVE_SEARCH \
102  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
103#define MAX_PENDING_LIST_LENGTH \
104  PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
105#define MAX_GCSE_MEMORY \
106  ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
107#define MAX_GCSE_PASSES \
108  PARAM_VALUE (PARAM_MAX_GCSE_PASSES)
109#define MAX_UNROLLED_INSNS \
110  PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
111#endif /* ! GCC_PARAMS_H */
112