1331722Seadler/* params.h - Run-time parameters.
2341477Svmaffione   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
3341477Svmaffione   Written by Mark Mitchell <mark@codesourcery.com>.
4261909Sluigi
5261909SluigiThis file is part of GCC.
6261909Sluigi
7261909SluigiGCC is free software; you can redistribute it and/or modify it under
8261909Sluigithe terms of the GNU General Public License as published by the Free
9261909SluigiSoftware Foundation; either version 2, or (at your option) any later
10261909Sluigiversion.
11261909Sluigi
12261909SluigiGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13261909SluigiWARRANTY; without even the implied warranty of MERCHANTABILITY or
14261909SluigiFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15261909Sluigifor more details.
16261909Sluigi
17261909SluigiYou should have received a copy of the GNU General Public License
18261909Sluigialong with GCC; see the file COPYING.  If not, write to the Free
19261909SluigiSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20261909Sluigi02110-1301, USA.
21261909Sluigi
22261909Sluigi*/
23261909Sluigi
24261909Sluigi/* This module provides a means for setting integral parameters
25261909Sluigi   dynamically.  Instead of encoding magic numbers in various places,
26261909Sluigi   use this module to organize all the magic numbers in a single
27261909Sluigi   place.  The values of the parameters can be set on the
28261909Sluigi   command-line, thereby providing a way to control the amount of
29261909Sluigi   effort spent on particular optimization passes, or otherwise tune
30261909Sluigi   the behavior of the compiler.
31261909Sluigi
32261909Sluigi   Since their values can be set on the command-line, these parameters
33261909Sluigi   should not be used for non-dynamic memory allocation.  */
34261909Sluigi
35261909Sluigi#ifndef GCC_PARAMS_H
36261909Sluigi#define GCC_PARAMS_H
37261909Sluigi
38261909Sluigi/* No parameter shall have this value.  */
39261909Sluigi
40261909Sluigi#define INVALID_PARAM_VAL (-1)
41261909Sluigi
42261909Sluigi/* The information associated with each parameter.  */
43261909Sluigi
44261909Sluigitypedef struct param_info
45261909Sluigi{
46261909Sluigi  /* The name used with the `--param <name>=<value>' switch to set this
47261909Sluigi     value.  */
48261909Sluigi  const char *const option;
49261909Sluigi  /* The associated value.  */
50261909Sluigi  int value;
51261909Sluigi
52261909Sluigi  /* Minimum acceptable value.  */
53261909Sluigi  int min_value;
54261909Sluigi
55261909Sluigi  /* Maximum acceptable value, if greater than minimum  */
56261909Sluigi  int max_value;
57261909Sluigi
58341477Svmaffione  /* A short description of the option.  */
59341477Svmaffione  const char *const help;
60341477Svmaffione} param_info;
61261909Sluigi
62261909Sluigi/* An array containing the compiler parameters and their current
63261909Sluigi   values.  */
64261909Sluigi
65261909Sluigiextern param_info *compiler_params;
66261909Sluigi
67261909Sluigi/* Add the N PARAMS to the current list of compiler parameters.  */
68261909Sluigi
69261909Sluigiextern void add_params (const param_info params[], size_t n);
70261909Sluigi
71261909Sluigi/* Set the VALUE associated with the parameter given by NAME.  */
72261909Sluigi
73261909Sluigiextern void set_param_value (const char *name, int value);
74261909Sluigi
75261909Sluigi
76261909Sluigi/* The parameters in use by language-independent code.  */
77261909Sluigi
78341477Svmaffionetypedef enum compiler_param
79261909Sluigi{
80341477Svmaffione#define DEFPARAM(enumerator, option, msgid, default, min, max) \
81341477Svmaffione  enumerator,
82261909Sluigi#include "params.def"
83341477Svmaffione#undef DEFPARAM
84341477Svmaffione  LAST_PARAM
85341477Svmaffione} compiler_param;
86261909Sluigi
87261909Sluigi/* The value of the parameter given by ENUM.  */
88285349Sluigi#define PARAM_VALUE(ENUM) \
89285349Sluigi  (compiler_params[(int) ENUM].value)
90261909Sluigi
91341477Svmaffione/* Macros for the various parameters.  */
92285349Sluigi#define SALIAS_MAX_IMPLICIT_FIELDS \
93261909Sluigi  PARAM_VALUE (PARAM_SALIAS_MAX_IMPLICIT_FIELDS)
94285349Sluigi#define SALIAS_MAX_ARRAY_ELEMENTS \
95285349Sluigi  PARAM_VALUE (PARAM_SALIAS_MAX_ARRAY_ELEMENTS)
96261909Sluigi#define SRA_MAX_STRUCTURE_SIZE \
97341477Svmaffione  PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_SIZE)
98285349Sluigi#define SRA_MAX_STRUCTURE_COUNT \
99285349Sluigi  PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_COUNT)
100261909Sluigi#define SRA_FIELD_STRUCTURE_RATIO \
101341477Svmaffione  PARAM_VALUE (PARAM_SRA_FIELD_STRUCTURE_RATIO)
102341477Svmaffione#define MAX_INLINE_INSNS_SINGLE \
103341477Svmaffione  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
104285349Sluigi#define MAX_INLINE_INSNS \
105261909Sluigi  PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
106261909Sluigi#define MAX_INLINE_SLOPE \
107285349Sluigi  PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
108261909Sluigi#define MIN_INLINE_INSNS \
109261909Sluigi  PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
110261909Sluigi#define MAX_INLINE_INSNS_AUTO \
111261909Sluigi  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
112261909Sluigi#define MAX_VARIABLE_EXPANSIONS \
113261909Sluigi  PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
114261909Sluigi#define MAX_DELAY_SLOT_INSN_SEARCH \
115261909Sluigi  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
116261909Sluigi#define MAX_DELAY_SLOT_LIVE_SEARCH \
117261909Sluigi  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
118285349Sluigi#define MAX_PENDING_LIST_LENGTH \
119344047Svmaffione  PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
120344047Svmaffione#define MAX_GCSE_MEMORY \
121285349Sluigi  ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
122341477Svmaffione#define MAX_GCSE_PASSES \
123261909Sluigi  PARAM_VALUE (PARAM_MAX_GCSE_PASSES)
124261909Sluigi#define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
125261909Sluigi  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
126261909Sluigi#define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
127261909Sluigi  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
128261909Sluigi#define MAX_UNROLLED_INSNS \
129261909Sluigi  PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
130261909Sluigi#define MAX_SMS_LOOP_NUMBER \
131341477Svmaffione  PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
132261909Sluigi#define SMS_MAX_II_FACTOR \
133261909Sluigi  PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
134261909Sluigi#define SMS_DFA_HISTORY \
135261909Sluigi  PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
136261909Sluigi#define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
137341477Svmaffione  PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
138261909Sluigi#define GLOBAL_VAR_THRESHOLD \
139341477Svmaffione  PARAM_VALUE (PARAM_GLOBAL_VAR_THRESHOLD)
140341477Svmaffione#define MAX_ALIASED_VOPS \
141341477Svmaffione  PARAM_VALUE (PARAM_MAX_ALIASED_VOPS)
142341477Svmaffione#define INTEGER_SHARE_LIMIT \
143341477Svmaffione  PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
144261909Sluigi#define MAX_LAST_VALUE_RTL \
145261909Sluigi  PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
146261909Sluigi#define MIN_VIRTUAL_MAPPINGS \
147261909Sluigi  PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
148261909Sluigi#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
149261909Sluigi  PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
150261909Sluigi#define MAX_FIELDS_FOR_FIELD_SENSITIVE \
151261909Sluigi  ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
152261909Sluigi#define MAX_SCHED_READY_INSNS \
153261909Sluigi  PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
154261909Sluigi#endif /* ! GCC_PARAMS_H */
155285349Sluigi