The -optimize
switch sets the base optimization and
code analysis level, ranging from 0 for no optimization to 5 for
maximum optimization. The optimization level can also be modified on
a loop-by-loop basis by the C*$* optimize
(<integer>)
directive. Some of the code analysis techniques can be enabled with
the -scalaropt
switch.
The meaning of each of the different optimization levels is as follows. Each optimization level is cumulative, for example, level 4 performs what is listed below for that level, in addition to what is listed for levels 0-3.
0
- KAP performs no loop optimization.
1
- KAP performs only simple analysis
and optimization. Induction variables are recognized. DO loop
interchanging techniques are applied.
2
- Lifetime analysis is performed to
determine when last-value assignment of subprogram-local scalar
variables is necessary. More powerful data dependence tests are
used.
3
- More loop interchanging is attempted,
such as interchanging of triangular loops. Special-case data
dependence tests are used. Special index sets called wraparound
variables are recognized.
4
- Loop interchanging around reductions is
attempted. More exact data dependence tests are used.
5
- Array expansion is enabled at this
point.
A higher optimization level results in more optimization, more analysis, and more ambitious transformations, along with increased compilation time.