2015-06-23 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc.git] / gcc / params.h
blobf53426dfea69310880a4ffcf85ab80ef3e493d6e
1 /* params.h - Run-time parameters.
2 Copyright (C) 2001-2015 Free Software Foundation, Inc.
3 Written by Mark Mitchell <mark@codesourcery.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 /* This module provides a means for setting integral parameters
22 dynamically. Instead of encoding magic numbers in various places,
23 use this module to organize all the magic numbers in a single
24 place. The values of the parameters can be set on the
25 command-line, thereby providing a way to control the amount of
26 effort spent on particular optimization passes, or otherwise tune
27 the behavior of the compiler.
29 Since their values can be set on the command-line, these parameters
30 should not be used for non-dynamic memory allocation. */
32 #ifndef GCC_PARAMS_H
33 #define GCC_PARAMS_H
35 /* No parameter shall have this value. */
37 #define INVALID_PARAM_VAL (-1)
39 /* The information associated with each parameter. */
41 struct param_info
43 /* The name used with the `--param <name>=<value>' switch to set this
44 value. */
45 const char *const option;
47 /* The default value. */
48 int default_value;
50 /* Minimum acceptable value. */
51 int min_value;
53 /* Maximum acceptable value, if greater than minimum */
54 int max_value;
56 /* A short description of the option. */
57 const char *const help;
60 /* An array containing the compiler parameters and their current
61 values. */
63 extern param_info *compiler_params;
65 /* Returns the number of entries in the table, for the use by plugins. */
66 extern size_t get_num_compiler_params (void);
68 /* Add the N PARAMS to the current list of compiler parameters. */
70 extern void add_params (const param_info params[], size_t n);
72 /* Set the VALUE associated with the parameter given by NAME in the
73 table PARAMS using PARAMS_SET to indicate which have been
74 explicitly set. */
76 extern void set_param_value (const char *name, int value,
77 int *params, int *params_set);
80 /* The parameters in use by language-independent code. */
82 enum compiler_param
84 #define DEFPARAM(enumerator, option, nocmsgid, default, min, max) \
85 enumerator,
86 #include "params.def"
87 #undef DEFPARAM
88 LAST_PARAM
91 /* The value of the parameter given by ENUM. Not an lvalue. */
92 #define PARAM_VALUE(ENUM) \
93 ((int) global_options.x_param_values[(int) ENUM])
95 /* Set the value of the parameter given by NUM to VALUE, implicitly,
96 if it has not been set explicitly by the user, in the table PARAMS
97 using PARAMS_SET to indicate which have been explicitly set. */
99 extern void maybe_set_param_value (compiler_param num, int value,
100 int *params, int *params_set);
102 /* Set the default value of a parameter given by NUM to VALUE, before
103 option processing. */
105 extern void set_default_param_value (compiler_param num, int value);
107 /* Add all parameters and default values that can be set in both the
108 driver and the compiler proper. */
110 extern void global_init_params (void);
112 /* Note that all parameters have been added and all default values
113 set. */
114 extern void finish_params (void);
116 /* Reset all state in params.c */
118 extern void params_c_finalize (void);
120 /* Return the default value of parameter NUM. */
122 extern int default_param_value (compiler_param num);
124 /* Initialize an array PARAMS with default values of the
125 parameters. */
126 extern void init_param_values (int *params);
128 /* Macros for the various parameters. */
129 #define MAX_INLINE_INSNS_SINGLE \
130 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
131 #define MAX_INLINE_INSNS \
132 PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
133 #define MAX_INLINE_SLOPE \
134 PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
135 #define MIN_INLINE_INSNS \
136 PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
137 #define MAX_INLINE_INSNS_AUTO \
138 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
139 #define MAX_VARIABLE_EXPANSIONS \
140 PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
141 #define MIN_VECT_LOOP_BOUND \
142 PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
143 #define MAX_DELAY_SLOT_INSN_SEARCH \
144 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
145 #define MAX_DELAY_SLOT_LIVE_SEARCH \
146 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
147 #define MAX_PENDING_LIST_LENGTH \
148 PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
149 #define MAX_GCSE_MEMORY \
150 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
151 #define MAX_GCSE_INSERTION_RATIO \
152 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_INSERTION_RATIO))
153 #define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
154 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
155 #define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
156 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
157 #define GCSE_COST_DISTANCE_RATIO \
158 PARAM_VALUE (PARAM_GCSE_COST_DISTANCE_RATIO)
159 #define GCSE_UNRESTRICTED_COST \
160 PARAM_VALUE (PARAM_GCSE_UNRESTRICTED_COST)
161 #define MAX_HOIST_DEPTH \
162 PARAM_VALUE (PARAM_MAX_HOIST_DEPTH)
163 #define MAX_UNROLLED_INSNS \
164 PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
165 #define MAX_SMS_LOOP_NUMBER \
166 PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
167 #define SMS_MAX_II_FACTOR \
168 PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
169 #define SMS_DFA_HISTORY \
170 PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
171 #define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
172 PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
173 #define INTEGER_SHARE_LIMIT \
174 PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
175 #define MAX_LAST_VALUE_RTL \
176 PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
177 #define MIN_VIRTUAL_MAPPINGS \
178 PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
179 #define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
180 PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
181 #define MAX_FIELDS_FOR_FIELD_SENSITIVE \
182 ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
183 #define MAX_SCHED_READY_INSNS \
184 PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
185 #define PREFETCH_LATENCY \
186 PARAM_VALUE (PARAM_PREFETCH_LATENCY)
187 #define SIMULTANEOUS_PREFETCHES \
188 PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES)
189 #define L1_CACHE_SIZE \
190 PARAM_VALUE (PARAM_L1_CACHE_SIZE)
191 #define L1_CACHE_LINE_SIZE \
192 PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE)
193 #define L2_CACHE_SIZE \
194 PARAM_VALUE (PARAM_L2_CACHE_SIZE)
195 #define USE_CANONICAL_TYPES \
196 PARAM_VALUE (PARAM_USE_CANONICAL_TYPES)
197 #define IRA_MAX_LOOPS_NUM \
198 PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM)
199 #define IRA_MAX_CONFLICT_TABLE_SIZE \
200 PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
201 #define IRA_LOOP_RESERVED_REGS \
202 PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS)
203 #define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \
204 PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
205 #define LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF \
206 PARAM_VALUE (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF)
207 #define SWITCH_CONVERSION_BRANCH_RATIO \
208 PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO)
209 #define LOOP_INVARIANT_MAX_BBS_IN_LOOP \
210 PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP)
211 #define SLP_MAX_INSNS_IN_BB \
212 PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)
213 #define MIN_INSN_TO_PREFETCH_RATIO \
214 PARAM_VALUE (PARAM_MIN_INSN_TO_PREFETCH_RATIO)
215 #define PREFETCH_MIN_INSN_TO_MEM_RATIO \
216 PARAM_VALUE (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO)
217 #define MIN_NONDEBUG_INSN_UID \
218 PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID)
219 #define MAX_STORES_TO_SINK \
220 PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
221 #define ALLOW_LOAD_DATA_RACES \
222 PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES)
223 #define ALLOW_STORE_DATA_RACES \
224 PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
225 #define ALLOW_PACKED_LOAD_DATA_RACES \
226 PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
227 #define ALLOW_PACKED_STORE_DATA_RACES \
228 PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES)
229 #define ASAN_STACK \
230 PARAM_VALUE (PARAM_ASAN_STACK)
231 #define ASAN_GLOBALS \
232 PARAM_VALUE (PARAM_ASAN_GLOBALS)
233 #define ASAN_INSTRUMENT_READS \
234 PARAM_VALUE (PARAM_ASAN_INSTRUMENT_READS)
235 #define ASAN_INSTRUMENT_WRITES \
236 PARAM_VALUE (PARAM_ASAN_INSTRUMENT_WRITES)
237 #define ASAN_MEMINTRIN \
238 PARAM_VALUE (PARAM_ASAN_MEMINTRIN)
239 #define ASAN_USE_AFTER_RETURN \
240 PARAM_VALUE (PARAM_ASAN_USE_AFTER_RETURN)
241 #define ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD \
242 PARAM_VALUE (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD)
244 #endif /* ! GCC_PARAMS_H */