2012-01-31 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / params.h
blob0bf8961fd0e3e8e866e40e6bc9c60fd170ca3c52
1 /* params.h - Run-time parameters.
2 Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
4 Written by Mark Mitchell <mark@codesourcery.com>.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* This module provides a means for setting integral parameters
23 dynamically. Instead of encoding magic numbers in various places,
24 use this module to organize all the magic numbers in a single
25 place. The values of the parameters can be set on the
26 command-line, thereby providing a way to control the amount of
27 effort spent on particular optimization passes, or otherwise tune
28 the behavior of the compiler.
30 Since their values can be set on the command-line, these parameters
31 should not be used for non-dynamic memory allocation. */
33 #ifndef GCC_PARAMS_H
34 #define GCC_PARAMS_H
36 /* No parameter shall have this value. */
38 #define INVALID_PARAM_VAL (-1)
40 /* The information associated with each parameter. */
42 typedef struct param_info
44 /* The name used with the `--param <name>=<value>' switch to set this
45 value. */
46 const char *const option;
48 /* The default value. */
49 int default_value;
51 /* Minimum acceptable value. */
52 int min_value;
54 /* Maximum acceptable value, if greater than minimum */
55 int max_value;
57 /* A short description of the option. */
58 const char *const help;
59 } param_info;
61 /* An array containing the compiler parameters and their current
62 values. */
64 extern param_info *compiler_params;
66 /* Returns the number of entries in the table, for the use by plugins. */
67 extern size_t get_num_compiler_params (void);
69 /* Add the N PARAMS to the current list of compiler parameters. */
71 extern void add_params (const param_info params[], size_t n);
73 /* Set the VALUE associated with the parameter given by NAME in the
74 table PARAMS using PARAMS_SET to indicate which have been
75 explicitly set. */
77 extern void set_param_value (const char *name, int value,
78 int *params, int *params_set);
81 /* The parameters in use by language-independent code. */
83 typedef enum compiler_param
85 #define DEFPARAM(enumerator, option, msgid, default, min, max) \
86 enumerator,
87 #include "params.def"
88 #undef DEFPARAM
89 LAST_PARAM
90 } compiler_param;
92 /* The value of the parameter given by ENUM. Not an lvalue. */
93 #define PARAM_VALUE(ENUM) \
94 ((int) global_options.x_param_values[(int) ENUM])
96 /* Set the value of the parameter given by NUM to VALUE, implicitly,
97 if it has not been set explicitly by the user, in the table PARAMS
98 using PARAMS_SET to indicate which have been explicitly set. */
100 extern void maybe_set_param_value (compiler_param num, int value,
101 int *params, int *params_set);
103 /* Set the default value of a parameter given by NUM to VALUE, before
104 option processing. */
106 extern void set_default_param_value (compiler_param num, int value);
108 /* Add all parameters and default values that can be set in both the
109 driver and the compiler proper. */
111 extern void global_init_params (void);
113 /* Note that all parameters have been added and all default values
114 set. */
115 extern void finish_params (void);
117 /* Return the default value of parameter NUM. */
119 extern int default_param_value (compiler_param num);
121 /* Initialize an array PARAMS with default values of the
122 parameters. */
123 extern void init_param_values (int *params);
125 /* Macros for the various parameters. */
126 #define MAX_INLINE_INSNS_SINGLE \
127 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
128 #define MAX_INLINE_INSNS \
129 PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
130 #define MAX_INLINE_SLOPE \
131 PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
132 #define MIN_INLINE_INSNS \
133 PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
134 #define MAX_INLINE_INSNS_AUTO \
135 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
136 #define MAX_VARIABLE_EXPANSIONS \
137 PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
138 #define MIN_VECT_LOOP_BOUND \
139 PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
140 #define MAX_DELAY_SLOT_INSN_SEARCH \
141 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
142 #define MAX_DELAY_SLOT_LIVE_SEARCH \
143 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
144 #define MAX_PENDING_LIST_LENGTH \
145 PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
146 #define MAX_GCSE_MEMORY \
147 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
148 #define MAX_GCSE_INSERTION_RATIO \
149 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_INSERTION_RATIO))
150 #define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
151 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
152 #define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
153 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
154 #define GCSE_COST_DISTANCE_RATIO \
155 PARAM_VALUE (PARAM_GCSE_COST_DISTANCE_RATIO)
156 #define GCSE_UNRESTRICTED_COST \
157 PARAM_VALUE (PARAM_GCSE_UNRESTRICTED_COST)
158 #define MAX_HOIST_DEPTH \
159 PARAM_VALUE (PARAM_MAX_HOIST_DEPTH)
160 #define MAX_UNROLLED_INSNS \
161 PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
162 #define MAX_SMS_LOOP_NUMBER \
163 PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
164 #define SMS_MAX_II_FACTOR \
165 PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
166 #define SMS_DFA_HISTORY \
167 PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
168 #define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
169 PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
170 #define INTEGER_SHARE_LIMIT \
171 PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
172 #define MAX_LAST_VALUE_RTL \
173 PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
174 #define MIN_VIRTUAL_MAPPINGS \
175 PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
176 #define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
177 PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
178 #define MAX_FIELDS_FOR_FIELD_SENSITIVE \
179 ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
180 #define MAX_SCHED_READY_INSNS \
181 PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
182 #define PREFETCH_LATENCY \
183 PARAM_VALUE (PARAM_PREFETCH_LATENCY)
184 #define SIMULTANEOUS_PREFETCHES \
185 PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES)
186 #define L1_CACHE_SIZE \
187 PARAM_VALUE (PARAM_L1_CACHE_SIZE)
188 #define L1_CACHE_LINE_SIZE \
189 PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE)
190 #define L2_CACHE_SIZE \
191 PARAM_VALUE (PARAM_L2_CACHE_SIZE)
192 #define USE_CANONICAL_TYPES \
193 PARAM_VALUE (PARAM_USE_CANONICAL_TYPES)
194 #define IRA_MAX_LOOPS_NUM \
195 PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM)
196 #define IRA_MAX_CONFLICT_TABLE_SIZE \
197 PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
198 #define IRA_LOOP_RESERVED_REGS \
199 PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS)
200 #define SWITCH_CONVERSION_BRANCH_RATIO \
201 PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO)
202 #define LOOP_INVARIANT_MAX_BBS_IN_LOOP \
203 PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP)
204 #define SLP_MAX_INSNS_IN_BB \
205 PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)
206 #define MIN_INSN_TO_PREFETCH_RATIO \
207 PARAM_VALUE (PARAM_MIN_INSN_TO_PREFETCH_RATIO)
208 #define PREFETCH_MIN_INSN_TO_MEM_RATIO \
209 PARAM_VALUE (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO)
210 #define MIN_NONDEBUG_INSN_UID \
211 PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID)
212 #define MAX_STORES_TO_SINK \
213 PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
214 #define ALLOW_LOAD_DATA_RACES \
215 PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES)
216 #define ALLOW_STORE_DATA_RACES \
217 PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
218 #define ALLOW_PACKED_LOAD_DATA_RACES \
219 PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
220 #define ALLOW_PACKED_STORE_DATA_RACES \
221 PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES)
223 #endif /* ! GCC_PARAMS_H */