1 /* params.h - Run-time parameters. 2 Copyright (C) 2001-2016 Free Software Foundation, Inc. 3 Written by Mark Mitchell <mark@codesourcery.com>. 4 5 This file is part of GCC. 6 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. 11 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. 16 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/>. */ 20 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. 28 29 Since their values can be set on the command-line, these parameters 30 should not be used for non-dynamic memory allocation. */ 31 32 #ifndef GCC_PARAMS_H 33 #define GCC_PARAMS_H 34 35 /* No parameter shall have this value. */ 36 37 #define INVALID_PARAM_VAL (-1) 38 39 /* The information associated with each parameter. */ 40 41 struct param_info 42 { 43 /* The name used with the `--param <name>=<value>' switch to set this 44 value. */ 45 const char *const option; 46 47 /* The default value. */ 48 int default_value; 49 50 /* Minimum acceptable value. */ 51 int min_value; 52 53 /* Maximum acceptable value, if greater than minimum */ 54 int max_value; 55 56 /* A short description of the option. */ 57 const char *const help; 58 59 /* The optional names corresponding to the values. */ 60 const char **value_names; 61 }; 62 63 /* An array containing the compiler parameters and their current 64 values. */ 65 66 extern param_info *compiler_params; 67 68 /* Returns the number of entries in the table, for the use by plugins. */ 69 extern size_t get_num_compiler_params (void); 70 71 /* Add the N PARAMS to the current list of compiler parameters. */ 72 73 extern void add_params (const param_info params[], size_t n); 74 75 /* Set the VALUE associated with the parameter given by NAME in the 76 table PARAMS using PARAMS_SET to indicate which have been 77 explicitly set. */ 78 79 extern void set_param_value (const char *name, int value, 80 int *params, int *params_set); 81 82 83 /* The parameters in use by language-independent code. */ 84 85 enum compiler_param 86 { 87 #include "params.list" 88 LAST_PARAM 89 }; 90 91 extern bool find_param (const char *, enum compiler_param *); 92 extern bool param_string_value_p (enum compiler_param, const char *, int *); 93 94 /* The value of the parameter given by ENUM. Not an lvalue. */ 95 #define PARAM_VALUE(ENUM) \ 96 ((int) global_options.x_param_values[(int) ENUM]) 97 98 /* Set the value of the parameter given by NUM to VALUE, implicitly, 99 if it has not been set explicitly by the user, in the table PARAMS 100 using PARAMS_SET to indicate which have been explicitly set. */ 101 102 extern void maybe_set_param_value (compiler_param num, int value, 103 int *params, int *params_set); 104 105 /* Set the default value of a parameter given by NUM to VALUE, before 106 option processing. */ 107 108 extern void set_default_param_value (compiler_param num, int value); 109 110 /* Add all parameters and default values that can be set in both the 111 driver and the compiler proper. */ 112 113 extern void global_init_params (void); 114 115 /* Note that all parameters have been added and all default values 116 set. */ 117 extern void finish_params (void); 118 119 /* Reset all state in params.c */ 120 121 extern void params_c_finalize (void); 122 123 /* Return the default value of parameter NUM. */ 124 125 extern int default_param_value (compiler_param num); 126 127 /* Initialize an array PARAMS with default values of the 128 parameters. */ 129 extern void init_param_values (int *params); 130 131 /* Macros for the various parameters. */ 132 #define MAX_INLINE_INSNS_SINGLE \ 133 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE) 134 #define MAX_INLINE_INSNS \ 135 PARAM_VALUE (PARAM_MAX_INLINE_INSNS) 136 #define MAX_INLINE_SLOPE \ 137 PARAM_VALUE (PARAM_MAX_INLINE_SLOPE) 138 #define MIN_INLINE_INSNS \ 139 PARAM_VALUE (PARAM_MIN_INLINE_INSNS) 140 #define MAX_INLINE_INSNS_AUTO \ 141 PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO) 142 #define MAX_VARIABLE_EXPANSIONS \ 143 PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS) 144 #define MIN_VECT_LOOP_BOUND \ 145 PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND) 146 #define MAX_DELAY_SLOT_INSN_SEARCH \ 147 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH) 148 #define MAX_DELAY_SLOT_LIVE_SEARCH \ 149 PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH) 150 #define MAX_PENDING_LIST_LENGTH \ 151 PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH) 152 #define MAX_GCSE_MEMORY \ 153 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY)) 154 #define MAX_GCSE_INSERTION_RATIO \ 155 ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_INSERTION_RATIO)) 156 #define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \ 157 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION) 158 #define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \ 159 PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION) 160 #define GCSE_COST_DISTANCE_RATIO \ 161 PARAM_VALUE (PARAM_GCSE_COST_DISTANCE_RATIO) 162 #define GCSE_UNRESTRICTED_COST \ 163 PARAM_VALUE (PARAM_GCSE_UNRESTRICTED_COST) 164 #define MAX_HOIST_DEPTH \ 165 PARAM_VALUE (PARAM_MAX_HOIST_DEPTH) 166 #define MAX_UNROLLED_INSNS \ 167 PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) 168 #define MAX_SMS_LOOP_NUMBER \ 169 PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER) 170 #define SMS_MAX_II_FACTOR \ 171 PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR) 172 #define SMS_DFA_HISTORY \ 173 PARAM_VALUE (PARAM_SMS_DFA_HISTORY) 174 #define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \ 175 PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD) 176 #define INTEGER_SHARE_LIMIT \ 177 PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT) 178 #define MAX_LAST_VALUE_RTL \ 179 PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL) 180 #define MIN_VIRTUAL_MAPPINGS \ 181 PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS) 182 #define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \ 183 PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO) 184 #define MAX_FIELDS_FOR_FIELD_SENSITIVE \ 185 ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE)) 186 #define MAX_SCHED_READY_INSNS \ 187 PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS) 188 #define PREFETCH_LATENCY \ 189 PARAM_VALUE (PARAM_PREFETCH_LATENCY) 190 #define SIMULTANEOUS_PREFETCHES \ 191 PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES) 192 #define L1_CACHE_SIZE \ 193 PARAM_VALUE (PARAM_L1_CACHE_SIZE) 194 #define L1_CACHE_LINE_SIZE \ 195 PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE) 196 #define L2_CACHE_SIZE \ 197 PARAM_VALUE (PARAM_L2_CACHE_SIZE) 198 #define USE_CANONICAL_TYPES \ 199 PARAM_VALUE (PARAM_USE_CANONICAL_TYPES) 200 #define IRA_MAX_LOOPS_NUM \ 201 PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM) 202 #define IRA_MAX_CONFLICT_TABLE_SIZE \ 203 PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE) 204 #define IRA_LOOP_RESERVED_REGS \ 205 PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS) 206 #define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \ 207 PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS) 208 #define LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF \ 209 PARAM_VALUE (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF) 210 #define SWITCH_CONVERSION_BRANCH_RATIO \ 211 PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO) 212 #define LOOP_INVARIANT_MAX_BBS_IN_LOOP \ 213 PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) 214 #define SLP_MAX_INSNS_IN_BB \ 215 PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB) 216 #define MIN_INSN_TO_PREFETCH_RATIO \ 217 PARAM_VALUE (PARAM_MIN_INSN_TO_PREFETCH_RATIO) 218 #define PREFETCH_MIN_INSN_TO_MEM_RATIO \ 219 PARAM_VALUE (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO) 220 #define MIN_NONDEBUG_INSN_UID \ 221 PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID) 222 #define MAX_STORES_TO_SINK \ 223 PARAM_VALUE (PARAM_MAX_STORES_TO_SINK) 224 #define ALLOW_LOAD_DATA_RACES \ 225 PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES) 226 #define ALLOW_STORE_DATA_RACES \ 227 PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES) 228 #define ALLOW_PACKED_LOAD_DATA_RACES \ 229 PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES) 230 #define ALLOW_PACKED_STORE_DATA_RACES \ 231 PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES) 232 #define ASAN_STACK \ 233 PARAM_VALUE (PARAM_ASAN_STACK) 234 #define ASAN_GLOBALS \ 235 PARAM_VALUE (PARAM_ASAN_GLOBALS) 236 #define ASAN_INSTRUMENT_READS \ 237 PARAM_VALUE (PARAM_ASAN_INSTRUMENT_READS) 238 #define ASAN_INSTRUMENT_WRITES \ 239 PARAM_VALUE (PARAM_ASAN_INSTRUMENT_WRITES) 240 #define ASAN_MEMINTRIN \ 241 PARAM_VALUE (PARAM_ASAN_MEMINTRIN) 242 #define ASAN_USE_AFTER_RETURN \ 243 PARAM_VALUE (PARAM_ASAN_USE_AFTER_RETURN) 244 #define ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD \ 245 PARAM_VALUE (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD) 246 247 #endif /* ! GCC_PARAMS_H */ 248