params.h 8.8 KB

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