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