params.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /* params.h - Run-time parameters.
  2. Copyright (C) 2001-2015 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 *const 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 *const help;
  43. };
  44. /* An array containing the compiler parameters and their current
  45. values. */
  46. extern param_info *compiler_params;
  47. /* Returns the number of entries in the table, for the use by plugins. */
  48. extern size_t get_num_compiler_params (void);
  49. /* Add the N PARAMS to the current list of compiler parameters. */
  50. extern void add_params (const param_info params[], size_t n);
  51. /* Set the VALUE associated with the parameter given by NAME in the
  52. table PARAMS using PARAMS_SET to indicate which have been
  53. explicitly set. */
  54. extern void set_param_value (const char *name, int value,
  55. int *params, int *params_set);
  56. /* The parameters in use by language-independent code. */
  57. enum compiler_param
  58. {
  59. #define DEFPARAM(enumerator, option, msgid, default, min, max) \
  60. enumerator,
  61. #include "params.def"
  62. #undef DEFPARAM
  63. LAST_PARAM
  64. };
  65. /* The value of the parameter given by ENUM. Not an lvalue. */
  66. #define PARAM_VALUE(ENUM) \
  67. ((int) global_options.x_param_values[(int) ENUM])
  68. /* Set the value of the parameter given by NUM to VALUE, implicitly,
  69. if it has not been set explicitly by the user, in the table PARAMS
  70. using PARAMS_SET to indicate which have been explicitly set. */
  71. extern void maybe_set_param_value (compiler_param num, int value,
  72. int *params, int *params_set);
  73. /* Set the default value of a parameter given by NUM to VALUE, before
  74. option processing. */
  75. extern void set_default_param_value (compiler_param num, int value);
  76. /* Add all parameters and default values that can be set in both the
  77. driver and the compiler proper. */
  78. extern void global_init_params (void);
  79. /* Note that all parameters have been added and all default values
  80. set. */
  81. extern void finish_params (void);
  82. /* Reset all state in params.c */
  83. extern void params_c_finalize (void);
  84. /* Return the default value of parameter NUM. */
  85. extern int default_param_value (compiler_param num);
  86. /* Initialize an array PARAMS with default values of the
  87. parameters. */
  88. extern void init_param_values (int *params);
  89. /* Macros for the various parameters. */
  90. #define MAX_INLINE_INSNS_SINGLE \
  91. PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
  92. #define MAX_INLINE_INSNS \
  93. PARAM_VALUE (PARAM_MAX_INLINE_INSNS)
  94. #define MAX_INLINE_SLOPE \
  95. PARAM_VALUE (PARAM_MAX_INLINE_SLOPE)
  96. #define MIN_INLINE_INSNS \
  97. PARAM_VALUE (PARAM_MIN_INLINE_INSNS)
  98. #define MAX_INLINE_INSNS_AUTO \
  99. PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO)
  100. #define MAX_VARIABLE_EXPANSIONS \
  101. PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS)
  102. #define MIN_VECT_LOOP_BOUND \
  103. PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
  104. #define MAX_DELAY_SLOT_INSN_SEARCH \
  105. PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH)
  106. #define MAX_DELAY_SLOT_LIVE_SEARCH \
  107. PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
  108. #define MAX_PENDING_LIST_LENGTH \
  109. PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
  110. #define MAX_GCSE_MEMORY \
  111. ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
  112. #define MAX_GCSE_INSERTION_RATIO \
  113. ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_INSERTION_RATIO))
  114. #define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
  115. PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
  116. #define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
  117. PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
  118. #define GCSE_COST_DISTANCE_RATIO \
  119. PARAM_VALUE (PARAM_GCSE_COST_DISTANCE_RATIO)
  120. #define GCSE_UNRESTRICTED_COST \
  121. PARAM_VALUE (PARAM_GCSE_UNRESTRICTED_COST)
  122. #define MAX_HOIST_DEPTH \
  123. PARAM_VALUE (PARAM_MAX_HOIST_DEPTH)
  124. #define MAX_UNROLLED_INSNS \
  125. PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
  126. #define MAX_SMS_LOOP_NUMBER \
  127. PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER)
  128. #define SMS_MAX_II_FACTOR \
  129. PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR)
  130. #define SMS_DFA_HISTORY \
  131. PARAM_VALUE (PARAM_SMS_DFA_HISTORY)
  132. #define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \
  133. PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD)
  134. #define INTEGER_SHARE_LIMIT \
  135. PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
  136. #define MAX_LAST_VALUE_RTL \
  137. PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
  138. #define MIN_VIRTUAL_MAPPINGS \
  139. PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
  140. #define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
  141. PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
  142. #define MAX_FIELDS_FOR_FIELD_SENSITIVE \
  143. ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
  144. #define MAX_SCHED_READY_INSNS \
  145. PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS)
  146. #define PREFETCH_LATENCY \
  147. PARAM_VALUE (PARAM_PREFETCH_LATENCY)
  148. #define SIMULTANEOUS_PREFETCHES \
  149. PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES)
  150. #define L1_CACHE_SIZE \
  151. PARAM_VALUE (PARAM_L1_CACHE_SIZE)
  152. #define L1_CACHE_LINE_SIZE \
  153. PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE)
  154. #define L2_CACHE_SIZE \
  155. PARAM_VALUE (PARAM_L2_CACHE_SIZE)
  156. #define USE_CANONICAL_TYPES \
  157. PARAM_VALUE (PARAM_USE_CANONICAL_TYPES)
  158. #define IRA_MAX_LOOPS_NUM \
  159. PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM)
  160. #define IRA_MAX_CONFLICT_TABLE_SIZE \
  161. PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
  162. #define IRA_LOOP_RESERVED_REGS \
  163. PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS)
  164. #define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \
  165. PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
  166. #define LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF \
  167. PARAM_VALUE (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF)
  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. #define MAX_STORES_TO_SINK \
  181. PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
  182. #define ALLOW_LOAD_DATA_RACES \
  183. PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES)
  184. #define ALLOW_STORE_DATA_RACES \
  185. PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
  186. #define ALLOW_PACKED_LOAD_DATA_RACES \
  187. PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
  188. #define ALLOW_PACKED_STORE_DATA_RACES \
  189. PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES)
  190. #define ASAN_STACK \
  191. PARAM_VALUE (PARAM_ASAN_STACK)
  192. #define ASAN_GLOBALS \
  193. PARAM_VALUE (PARAM_ASAN_GLOBALS)
  194. #define ASAN_INSTRUMENT_READS \
  195. PARAM_VALUE (PARAM_ASAN_INSTRUMENT_READS)
  196. #define ASAN_INSTRUMENT_WRITES \
  197. PARAM_VALUE (PARAM_ASAN_INSTRUMENT_WRITES)
  198. #define ASAN_MEMINTRIN \
  199. PARAM_VALUE (PARAM_ASAN_MEMINTRIN)
  200. #define ASAN_USE_AFTER_RETURN \
  201. PARAM_VALUE (PARAM_ASAN_USE_AFTER_RETURN)
  202. #define ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD \
  203. PARAM_VALUE (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD)
  204. #endif /* ! GCC_PARAMS_H */