TAL Reference Manual
Compiler Directives
TAL Reference Manual—526371-001
16-64
OPTIMIZE Directive
OPTIMIZE Directive
OPTIMIZE specifies the level at which the compiler optimizes the object code.
level
is the level of optimization, specified as 0, 1, or 2. The default level is 1.
Usage Considerations
OPTIMIZE can appear in a compilation command or anywhere in the source code.
If OPTIMIZE is in effect, the compiler replaces short instruction sequences with
equivalent but more efficient instruction sequences. The compiler does not perform
global code optimizations such as removing invariant expressions from loops.
Specifying higher optimization levels does not appreciably increase compilation time
nor affect compiler use of resources such as memory and disk space. Usually,
optimization slightly decreases the object code size and increases the execution speed
by some small amount.
The listing generated by the INNERLIST directive reports the optimizations, showing
first the original instructions and then the revised ones.
Examples of OPTIMIZE Directive
1. Level 1 transforms the code for loading an index register with a constant value
from two instructions into one:
LDI 1 !Transform to LDXI 1,7
STAR 7
Level Optimization When to use:
0 None When an internal compiler error is exposed by
another optimization level
1 Within a statement When you are developing and testing a
program
2 Within and across
statement
boundaries
When you want to produce the most efficient
code
VST1642.vsd
=
OPTIMIZE
level