OPTIMIZE [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
OPTIMIZE
OPTIMIZE is an HP Pascal Option.
The OPTIMIZE compiler option specifies level one, level two, or no
optimization for the program being compiled Refer to the HP Pascal/iX
Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending
on your implementation, for more information on the optimizer.
The command line options +O1, +O2, and -O also specify this option.
Syntax
{'LEVEL1' }
{'LEVEL2' }
$OPTIMIZE {'BASIC_BLOCKS num' }$
{'BASIC_BLOCKS_FENCE num'}
{ON }
{OFF }
Parameters
LEVEL1 The compiler compiles the program with level
one optimization.
LEVEL2 The compiler compiles the program with level
two optimization.
[REV BEG]
BASIC_BLOCKS num The compiler compiles the program with level
two optimization, but drops down to level
one for those procedures with more than num
basic blocks.
BASIC_BLOCKS_FENCE num No optimization is requested but when it is,
the number of basic blocks at which the
compiler drops to level one is num.
[REV END]
ON The compiler compiles the program with level
two optimization.
OFF The compiler compiles the program without
optimization.
Default OFF.
Location Anywhere, but in order to be effective, it must be before
the place in the code where label declarations or
directives can appear.
Scope All following source code, until overridden by another
OPTIMIZE option.
Basic Blocks
[REV BEG]
A basic block is a sequence of code with a single entry point and a
single exit point. A basic block has no internal branches. Optimizing
procedures with a large number of basic blocks can take a long time and
use a large amount of virtual memory. Therefore, the compiler behaves
differently on large procedures, when optimizing at Level 2. Any
procedure containing more than 500 basic blocks causes the optimizer to
drop down to Level 1 optimization for that procedure. A warning is
emitted that states the name of the procedure and the number of basic
blocks it contains:[REV END]
Optdriver: <num> basic blocks; dropping to level 1 optimization for <proc>. (6059)
OPTIMIZE 'BASIC_BLOCKS num' Compiler Option
This option allows you to request Level 2 optimization and change the
number of basic blocks at which the optimizer drops down to Level 1
optimization.
Syntax
$OPTIMIZE 'BASIC_BLOCKS num'$
where num is the number of basic blocks a procedure can have before the
optimizer drops down to Level 1 optimization.
NOTE To get the "old" behavior of -O, (for example, to disable
completely the basic blocks feature), you can use the following
form of the directive:
$OPTIMIZE 'BASIC_BLOCKS 0'$
Notice that 0 has a special meaning here; it does not mean zero
basic blocks.
On HP-UX, the +Obbnum command-line option can be specified instead of the
$OPTIMIZE 'BASIC_BLOCKS num'$ compiler option.
OPTIMIZE 'BASIC_BLOCK_FENCE num' Compiler Option
This option allows you to change the default level of basic blocks (500)
at which the optimizer drops down to Level 1 optimization.
Syntax
$OPTIMIZE 'BASIC_BLOCK_FENCE num'$
where num is the number of basic blocks at which the optimizer drops down
to Level 1 optimization.
This option does not request optimization; it only says that when Level 2
optimization is requested, to change the default level at which the
optimizer drops down to Level 1.
NOTE To disable completely the basic blocks feature (for example, to
disable the dropping from Level 2 to Level 1), you can use the
following form of the directive:
$OPTIMIZE 'BASIC_BLOCK_FENCE 0'$
When this form of the option is specified Level 2 is requested, the
"old" level 2 will be available; that is, no dropping from Level 2
to Level 1.
Notice that 0 has a special meaning here; it does not mean zero
basic blocks.
Example
$OPTIMIZE 'LEVEL1'$
PROGRAM x;
PROCEDURE y $OPTIMIZE 'LEVEL2'$; {Compiled with level two optimization}
BEGIN {y}
.
.
.
END; {y}
PROCEDURE z; {Compiled with level two optimization}
BEGIN {z}
.
.
.
END; {z}
PROCEDURE a $OPTIMIZE OFF$; {Compiled with no optimization}
PROCEDURE b; {Compiled with no optimization}
BEGIN {b};
.
.
.
END; {b};
BEGIN {a}
.
.
.
END; {a}
BEGIN {x} {Compiled with no optimization}
.
.
.
END. {x}
MPE/iX 5.0 Documentation