1275970Scy/* params.h - Run-time parameters.
2275970Scy   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
3275970Scy   Written by Mark Mitchell <mark@codesourcery.com>.
4275970Scy
5275970ScyThis file is part of GCC.
6275970Scy
7275970ScyGCC is free software; you can redistribute it and/or modify it under
8275970Scythe terms of the GNU General Public License as published by the Free
9275970ScySoftware Foundation; either version 2, or (at your option) any later
10275970Scyversion.
11275970Scy
12275970ScyGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13275970ScyWARRANTY; without even the implied warranty of MERCHANTABILITY or
14275970ScyFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15275970Scyfor more details.
16275970Scy
17275970ScyYou should have received a copy of the GNU General Public License
18275970Scyalong with GCC; see the file COPYING.  If not, write to the Free
19275970ScySoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20275970Scy02110-1301, USA.
21275970Scy
22275970Scy*/
23275970Scy
24275970Scy/* This module provides a means for setting integral parameters
25275970Scy   dynamically.  Instead of encoding magic numbers in various places,
26275970Scy   use this module to organize all the magic numbers in a single
27275970Scy   place.  The values of the parameters can be set on the
28275970Scy   command-line, thereby providing a way to control the amount of
29275970Scy   effort spent on particular optimization passes, or otherwise tune
30275970Scy   the behavior of the compiler.
31275970Scy
32275970Scy   Since their values can be set on the command-line, these parameters
33275970Scy   should not be used for non-dynamic memory allocation.  */
34275970Scy
35275970Scy#ifndef GCC_PARAMS_H
36275970Scy#define GCC_PARAMS_H
37275970Scy
38275970Scy/* No parameter shall have this value.  */
39275970Scy
40275970Scy#define INVALID_PARAM_VAL (-1)
41275970Scy
42275970Scy/* The information associated with each parameter.  */
43275970Scy
44275970Scytypedef struct param_info
45275970Scy{
46275970Scy  /* The name used with the `--param <name>=<value>' switch to set this
47275970Scy     value.  */
48275970Scy  const char *const option;
49275970Scy  /* The associated value.  */
50275970Scy  int value;
51275970Scy
52275970Scy  /* Minimum acceptable value.  */
53275970Scy  int min_value;
54275970Scy
55275970Scy  /* Maximum acceptable value, if greater than minimum  */
56275970Scy  int max_value;
57275970Scy
58275970Scy  /* A short description of the option.  */
59275970Scy  const char *const help;
60275970Scy} param_info;
61275970Scy
62275970Scy/* An array containing the compiler parameters and their current
63275970Scy   values.  */
64275970Scy
65275970Scyextern param_info *compiler_params;
66275970Scy
67275970Scy/* Add the N PARAMS to the current list of compiler parameters.  */
68275970Scy
69275970Scyextern void add_params (const param_info params[], size_t n);
70275970Scy
71275970Scy/* Set the VALUE associated with the parameter given by NAME.  */
72275970Scy
73275970Scyextern void set_param_value (const char *name, int value);
74275970Scy
75275970Scy
76275970Scy/* The parameters in use by language-independent code.  */
77285612Sdelphij
78275970Scytypedef enum compiler_param
79275970Scy{
80275970Scy#define DEFPARAM(enumerator, option, msgid, default, min, max) \
81275970Scy  enumerator,
82275970Scy#include "params.def"
83275970Scy#undef DEFPARAM
84275970Scy  LAST_PARAM
85275970Scy} compiler_param;
86275970Scy
87275970Scy/* The value of the parameter given by ENUM.  */
88275970Scy#define PARAM_VALUE(ENUM) \
89275970Scy  (compiler_params[(int) ENUM].value)
90275970Scy
91275970Scy/* Macros for the various parameters.  */
92275970Scy#define SALIAS_MAX_IMPLICIT_FIELDS \
93275970Scy  PARAM_VALUE (PARAM_SALIAS_MAX_IMPLICIT_FIELDS)
94275970Scy#define SRA_MAX_STRUCTURE_SIZE \
95275970Scy  PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_SIZE)
96275970Scy#define SRA_MAX_STRUCTURE_COUNT \
97275970Scy  PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_COUNT)
98275970Scy#define SRA_FIELD_STRUCTURE_RATIO \
99275970Scy  PARAM_VALUE (PARAM_SRA_FIELD_STRUCTURE_RATIO)
100275970Scy#define MAX_INLINE_INSNS_SINGLE \
101275970Scy  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
102275970Scy#define MAX_INLINE_INSNS \
103285612Sdelphij  PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
104275970Scy#define MAX_INLINE_SLOPE \
105275970Scy  PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
106275970Scy#define MIN_INLINE_INSNS \
107275970Scy  PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
108275970Scy#define MAX_INLINE_INSNS_AUTO \
109275970Scy  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
110275970Scy#define MAX_VARIABLE_EXPANSIONS \
111275970Scy  PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
112275970Scy#define MAX_DELAY_SLOT_INSN_SEARCH \
113275970Scy  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
114275970Scy#define MAX_DELAY_SLOT_LIVE_SEARCH \
115275970Scy  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
116275970Scy#define MAX_PENDING_LIST_LENGTH \
117275970Scy  PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
118275970Scy#define MAX_GCSE_MEMORY \
119275970Scy  ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
120275970Scy#define MAX_GCSE_PASSES \
121275970Scy  PARAM_VALUE (PARAM_MAX_GCSE_PASSES)
122275970Scy#define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
123275970Scy  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
124275970Scy#define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
125275970Scy  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
126275970Scy#define MAX_UNROLLED_INSNS \
127275970Scy  PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
128275970Scy#define MAX_SMS_LOOP_NUMBER \
129275970Scy  PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
130275970Scy#define SMS_MAX_II_FACTOR \
131275970Scy  PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
132275970Scy#define SMS_DFA_HISTORY \
133275970Scy  PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
134275970Scy#define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
135275970Scy  PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
136275970Scy#define GLOBAL_VAR_THRESHOLD \
137275970Scy  PARAM_VALUE (PARAM_GLOBAL_VAR_THRESHOLD)
138275970Scy#define MAX_ALIASED_VOPS \
139275970Scy  PARAM_VALUE (PARAM_MAX_ALIASED_VOPS)
140275970Scy#define INTEGER_SHARE_LIMIT \
141275970Scy  PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
142275970Scy#define MAX_LAST_VALUE_RTL \
143275970Scy  PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
144275970Scy#define MIN_VIRTUAL_MAPPINGS \
145275970Scy  PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
146275970Scy#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
147275970Scy  PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
148275970Scy#define MAX_FIELDS_FOR_FIELD_SENSITIVE \
149275970Scy  ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
150275970Scy#define MAX_SCHED_READY_INSNS \
151275970Scy  PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
152275970Scy#endif /* ! GCC_PARAMS_H */
153275970Scy