2.4. Initialize Optimization Parameters
Back to general_init, at line 4264 add_params saves elements of lang_independent_params into compiler_params which contains the compiler parameters and their current values. Array lang_independent_params is expanded from params.def as following.
1022 static const param_info lang_independent_params[] = { in toplev.c
1023 #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) /
1024 { OPTION, DEFAULT, HELP },
1025 #include "params.def"
1026 #undef DEFPARAM
1027 { NULL, 0, NULL }
1028 };
lang_independent_params is an array of below type.
44 typedef struct param_info in params.h
45 {
46 /* The name used with the `--param <name>=<value>' switch to set this
47 value. */
48 const char *const option;
49 /* The associated value. */
50 int value;
51 /* A short description of the option. */
52 const char *const help;
53 } param_info;
And in the compiler to index this array, it also defines an enumerator compiler_param.
71 typedef enum compiler_param in params.h
72 {
73 #define DEFPARAM(enumerator, option, msgid, default) /
74 enumerator,
75 #include "params.def"
76 #undef DEFPARAM
77 LAST_PARAM
78 } compiler_param;
compiler_params has the same definition as lang_independent_params. At compiler starts up, it is initialized by lang_independent_params, however its content can be changed via compliation command line.
42 void
43 add_params (const param_info params[], size_t n) params.c
44 {
45 /* Allocate enough space for the new parameters. */
46 compiler_params = xrealloc (compiler_params,
47 (num_compiler_params + n) * sizeof (param_info));
48 /* Copy them into the table. */
49 memcpy (compiler_params + num_compiler_params,
50 params,
51 n * sizeof (param_info));
52 /* Keep track of how many parameters we have. */
53 num_compiler_params += n;
54 }
Following switches are referred within params.def, without using these switches within command line the default value will be used.
Optimization Options | Description (Help string) | Default Value |
max-inline-insns-single | The maximum number of instructions in a single function eligible for inlining | 500 |
max-inline-insns-auto | The maximum number of instructions when automatically inlining | 100 |
max-inline-insns-rtl | The maximum number of instructions for the RTL inliner | 600 |
max-delay-slot-insn-search | The maximum number of instructions to consider to fill a delay slot | 100 |
max-delay-slot-live-search | The maximum number of instructions to consider to find accurate live register information | 333 |
max-pending-list-length | The maximum length of scheduling's pending operations list | 32 |
large-function-insns | The size of function body to be considered large | 3000 |
large-function-growth | Maximal growth due to inlining of large function (in percent) | 100 |
inline-unit-growth | how much can given compilation unit grow because of the inlining (in percent) | 50 |
max-gcse-memory | The maximum amount of memory to be allocated by GCSE | 50*1024*1024 |
max-gcse-passes | The maximum number of passes to make when doing GCSE | 1 |
max-unrolled-insns | The maximum number of instructions to consider to unroll in a loop | 200 |
max-average-unrolled-insns | The maximum number of instructions to consider to unroll in a loop on average | 80 |
max-unroll-times | The maximum number of unrollings of a single loop | 8 |
max-peeled-insns | The maximum number of insns of a peeled loop | 400 |
max-peel-times | The maximum number of peelings of a single loop | 16 |
max-completely-peeled-insns | The maximum number of insns of a completely peeled loop | 400 |
max-completely-peel-times | The maximum number of peelings of a single loop that is peeled completely | 16 |
max-once-peeled-insns | The maximum number of insns of a peeled loop that rolls only once | 400 |
hot-bb-count-fraction | Select fraction of the maximal count of repetitions of basic block in program given basic block needs to have to be considered hot | 10000 |
hot-bb-frequency-fraction | Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot | 1000 |
tracer-dynamic-coverage-feedback | The percentage of function, weighted by execution frequency, that must be covered by trace formation. Used when profile feedback is available | 95 |
tracer-dynamic-coverage | The percentage of function, weighted by execution frequency, that must be covered by trace formation. Used when profile feedback is not available | 75 |
tracer-max-code-growth | Maximal code growth caused by tail duplication (in percent) | 100 |
tracer-min-branch-ratio | Stop reverse growth if the reverse probability of best edge is less than this threshold (in percent) | 10 |
tracer-min-branch-probability-feedback | Stop forward growth if the probability of best edge is less than this threshold (in percent). Used when profile feedback is available | 80 |
tracer-min-branch-probability | Stop forward growth if the probability of best edge is less than this threshold (in percent). Used when profile feedback is not available | 50 |
max-crossjump-edges | The maximum number of incoming edges to consider for crossjumping | 100 |
max-cse-path-length | The maximum length of path considered in cse | 10 |
max-cselib-memory-locations | The maximum memory locations recorded by cselib | 500 |
max-last-value-rtl | The maximum number of RTL nodes that can be recorded as combiner's last value | 10000 |
ggc-min-expand | Minimum heap expansion to trigger garbage collection, as a percentage of the total size of the heap | Note 1 |
ggc-min-heapsize | Minimum heap size before we start collecting garbage, in kilobytes | Note 2 |
max-reload-search-insns | The maximum number of instructions to search backward when looking for equivalent reload | 100 |
Note 1: GGC_MIN_EXPAND_DEFAULT
Note 2: GGC_MIN_HEAPSIZE_DEFAULT
Table 8: Data for Optimization Options
At last, init_ggc_heuristics is for GCC garbage collection usage. We just ignore it here.