OPTIMIZE
Use OPTIMIZE to reduce the run time of
your object program. Optimization might also reduce the amount of
storage your object program uses.
Default is: OPTIMIZE(0)
Abbreviations
are: OPT(0), OPT(1), or OPT(2)
USAGE DISPLAY must
be valid unless ZONEDATA(MIG | NOPFD) is
used to allow invalid zone bits. Digits and sign
codes must be valid no matter what options are used. If the program
or data is invalid, programs might behave differently at different
levels of optimization or between different versions of Enterprise
COBOL. OPTIMIZE(0)specifies limited optimizations, which result in the shortest compilation time. When theTESToption is specified, full debug capabilities are available.OPTIMIZE(1)specifies optimizations that improve application runtime performance. Optimizations at this level include basic inlining, strength reduction, simplification of complex operations into equivalent simpler operations, removal of some unreachable code and block rearrangement. Also,OPTIMIZE(1)includes some intrablock optimizations such as common subexpression elimination and value propagation. When theTESToption is specified, most debug capabilities are available.OPTIMIZE(2)specifies further optimizations, which include more aggressive simplifications and instruction scheduling. Also, some interblock optimizations such as global value propagation and loop invariant code motion are included. When theTESToption is specified, some debug capabilities are available.
When OPTIMIZE(1) or OPTIMIZE(2) is
used without the TEST compiler option, care must
be taken with user-written condition handlers registered via the Language Environment® service CEEHDLR.
In particular, if a condition handler accesses data items that are
not defined local to the condition handler program themselves (for
example, data items defined in the application as EXTERNAL),
such data items must be defined with the VOLATILE clause
to ensure that the handler uses the latest value of the data item, or the condition handler program can be compiled with
the TEST compiler option. The use
of the VOLATILE clause is preferred over the use
of the TEST option because the use of the TEST option
can reduce optimization for the entire program, while VOLATILE localizes
the reduced optimization. For more information about the VOLATILE clause,
see VOLATILE clause.
When OPTIMIZE(1) or OPTIMIZE(2) is
in effect, specifying INLINE causes the compiler
to consider inlining procedures for PERFORM statements. For details,
see INLINE.
NOOPTIMIZE, OPTIMIZE, OPTIMIZE(STD),
and OPTIMIZE(FULL) options are removed but
are tolerated for compatibility. If one of those options is specified,
it is mapped to the new option or options as
follows:
| Removed options | New options |
|---|---|
NOOPTIMIZE |
OPTIMIZE(0) |
OPTIMIZE |
OPTIMIZE(2) |
OPTIMIZE(STD) |
OPTIMIZE(2) |
OPTIMIZE(FULL) |
OPTIMIZE(2) and STGOPT |
Conflicting compiler options
INLINE
MAXPCF
TEST
STGOPT
VOLATILE clause (Enterprise COBOL for z/OS Language Reference)
