1/* params.h - Run-time parameters.
2   Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009
3   Free Software Foundation, Inc.
4   Written by Mark Mitchell <mark@codesourcery.com>.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3.  If not see
20<http://www.gnu.org/licenses/>.  */
21
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.
29
30   Since their values can be set on the command-line, these parameters
31   should not be used for non-dynamic memory allocation.  */
32
33#ifndef GCC_PARAMS_H
34#define GCC_PARAMS_H
35
36/* No parameter shall have this value.  */
37
38#define INVALID_PARAM_VAL (-1)
39
40/* The information associated with each parameter.  */
41
42typedef struct param_info
43{
44  /* The name used with the `--param <name>=<value>' switch to set this
45     value.  */
46  const char *const option;
47  /* The associated value.  */
48  int value;
49
50  /* True if the parameter was explicitly set.  */
51  bool set;
52
53  /* Minimum acceptable value.  */
54  int min_value;
55
56  /* Maximum acceptable value, if greater than minimum  */
57  int max_value;
58
59  /* A short description of the option.  */
60  const char *const help;
61} param_info;
62
63/* An array containing the compiler parameters and their current
64   values.  */
65
66extern param_info *compiler_params;
67
68/* Returns the number of entries in the table, for the use by plugins.  */
69extern size_t get_num_compiler_params (void);
70
71/* Add the N PARAMS to the current list of compiler parameters.  */
72
73extern void add_params (const param_info params[], size_t n);
74
75/* Set the VALUE associated with the parameter given by NAME.  */
76
77extern void set_param_value (const char *name, int value);
78
79
80/* The parameters in use by language-independent code.  */
81
82typedef enum compiler_param
83{
84#define DEFPARAM(enumerator, option, msgid, default, min, max) \
85  enumerator,
86#include "params.def"
87#undef DEFPARAM
88  LAST_PARAM
89} compiler_param;
90
91/* The value of the parameter given by ENUM.  */
92#define PARAM_VALUE(ENUM) \
93  (compiler_params[(int) ENUM].value)
94
95/* True if the value of the parameter was explicitly changed.  */
96#define PARAM_SET_P(ENUM) \
97  (compiler_params[(int) ENUM].set)
98
99/* Macros for the various parameters.  */
100#define STRUCT_REORG_COLD_STRUCT_RATIO \
101  PARAM_VALUE (PARAM_STRUCT_REORG_COLD_STRUCT_RATIO)
102#define MAX_INLINE_INSNS_SINGLE \
103  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
104#define MAX_INLINE_INSNS \
105  PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
106#define MAX_INLINE_SLOPE \
107  PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
108#define MIN_INLINE_INSNS \
109  PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
110#define MAX_INLINE_INSNS_AUTO \
111  PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
112#define MAX_VARIABLE_EXPANSIONS \
113  PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
114#define MIN_VECT_LOOP_BOUND \
115  PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
116#define MAX_DELAY_SLOT_INSN_SEARCH \
117  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
118#define MAX_DELAY_SLOT_LIVE_SEARCH \
119  PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
120#define MAX_PENDING_LIST_LENGTH \
121  PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
122#define MAX_GCSE_MEMORY \
123  ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
124#define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
125  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
126#define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
127  PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
128#define MAX_UNROLLED_INSNS \
129  PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
130#define MAX_SMS_LOOP_NUMBER \
131  PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
132#define SMS_MAX_II_FACTOR \
133  PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
134#define SMS_DFA_HISTORY \
135  PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
136#define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
137  PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
138#define INTEGER_SHARE_LIMIT \
139  PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
140#define MAX_LAST_VALUE_RTL \
141  PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
142#define MIN_VIRTUAL_MAPPINGS \
143  PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
144#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
145  PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
146#define MAX_FIELDS_FOR_FIELD_SENSITIVE \
147  ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
148#define MAX_SCHED_READY_INSNS \
149  PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
150#define PREFETCH_LATENCY \
151  PARAM_VALUE (PARAM_PREFETCH_LATENCY)
152#define SIMULTANEOUS_PREFETCHES \
153  PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES)
154#define L1_CACHE_SIZE \
155  PARAM_VALUE (PARAM_L1_CACHE_SIZE)
156#define L1_CACHE_LINE_SIZE \
157  PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE)
158#define L2_CACHE_SIZE \
159  PARAM_VALUE (PARAM_L2_CACHE_SIZE)
160#define USE_CANONICAL_TYPES \
161  PARAM_VALUE (PARAM_USE_CANONICAL_TYPES)
162#define IRA_MAX_LOOPS_NUM \
163  PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM)
164#define IRA_MAX_CONFLICT_TABLE_SIZE \
165  PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
166#define IRA_LOOP_RESERVED_REGS \
167  PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS)
168#define SWITCH_CONVERSION_BRANCH_RATIO \
169  PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO)
170#define LOOP_INVARIANT_MAX_BBS_IN_LOOP \
171  PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP)
172#define SLP_MAX_INSNS_IN_BB \
173  PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)
174#define MIN_INSN_TO_PREFETCH_RATIO \
175  PARAM_VALUE (PARAM_MIN_INSN_TO_PREFETCH_RATIO)
176#define PREFETCH_MIN_INSN_TO_MEM_RATIO \
177  PARAM_VALUE (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO)
178#define MIN_NONDEBUG_INSN_UID \
179  PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID)
180#endif /* ! GCC_PARAMS_H */
181