 |
» |
|
|
 |
|  |  |
Additional general and specific/advanced parameters
allow you to enable or disable certain types of optimization techniques
according to their effect on code size, compilation time,
run-time performance, and other user-visible effects.
In addition to the general parameters that control types of optimizations,
there are specific parameters that control optimizations within those types.
These specific parameters are advanced in that
they may require an analysis of the program to determine
if the specific optimization is appropriate.
The general optimization parameters are described in
Table 1-2 “General Optimization Options”.
The specific/advanced optimization parameters are described in
Table 1-3 “Advanced Optimization Options”.
The tables list the optimization levels where each parameter can be used.
The optional no disables the particular optimization.
These parameters do not override a specified level of optimization,
nor do they imply a particular level.
To use any of these parameters,
you must include the +On option on the command line,
where n specifies the level at which
the type of optimization is effective,
as described in Table 1-1 “Optimization Levels”.
For example, to compile your program with the +Osize parameter at level 2,
you would use the command:
If an parameter is mistakenly used with a level
for which the corresponding optimization is not performed,
a warning message is issued.
Table 1-2 “General Optimization Options” describes the general optimization parameters
and lists the levels at which they are permitted.
Table 1-2 General Optimization Options
General Option | Optimization Performed
|
|---|
+O[no]aggressive
Levels 2, 3, 4
| +Oaggressive enables optimizations
that can result in significant performance improvement,
but can change a program's behavior.
These optimizations include newly released optimizations
and the optimizations invoked
by the following advanced optimization parameters
(see Table 1-3 “Advanced Optimization Options”):
The default is +Onoaggressive.
| +O[no]all
Level 4
| +Oall performs maximum optimization,
including aggressive optimizations and optimizations
that can significantly increase compile time and memory usage.
The default is +Onoall.
| +O[no]conservative
Levels 2, 3, 4
| +Oconservative causes the optimizer to
make conservative assumptions about the code when optimizing.
Use +Oconservative when conservative assumptions are necessary
due to the coding style, as with non-standard programs.
The default is +Onoconservative.
| +O[no]dataprefetch
Levels 2, 3, 4
| When +Odataprefetch is enabled, the optimizer will insert
instructions within innermost loops to explicitly prefetch data
from memory into the data cache. Data prefetch instructions will
be inserted only for data structures referenced within innermost
loops using simple loop varying addresses (that is, in a simple
arithmetic progression). It is only available for PA-RISC 2.0
targets.
Use this option for applications that have high data
cache miss overhead.
The default is +Onodataprefetch.
| +O[no]entrysched
Levels 2, 3, 4
| The +Oentrysched option optimizes instruction scheduling on
a procedure's entry and exit sequences.
Enabling this
option can speed up an application. The option has undefined
behavior for applications which handle asynchronous interrupts.
The option affects unwinding in the entry and exit regions.
At optimization level +02 and higher (using dataflow information),
save and restore operations
become more efficient.
This option can change the behavior of programs that perform
error handling or that handle asynchronous interrupts.
The behavior of setjmp() and longjmp() is not affected.
The default is +Onoentrysched.
| +O[no]limit
Levels 2, 3, 4
| +Olimit suppresses optimizations that significantly
increase compilation time or that can consume a lot of memory.
The +Onolimit parameter allows optimizations to be performed
regardless of their effect on compilation time or memory usage.
The default is +Olimit.
| +O[no]size
Levels 2, 3, 4
| +Osize suppresses optimizations that significantly
increase code size.
The +Onosize parameter allows optimizations that can
increase code size.
The default is +Onosize.
|
Table 1-3 Advanced Optimization Options | Advanced Option | Optimization Performed
|
|---|
| +O[no]fastaccess
Levels 0, 1, 2, 3, 4
| +Ofastaccess optimizes for fast access to global data items.
Use +Ofastaccess to improve execution speed at the expense of
longer compile and link times.
At all optimization levels, except level 4, the default is +Onofastaccess.
At optimization level 4, the default is +Ofastaccess.
| +O[no]fltacc
Levels 2, 3, 4
| The +Onofltacc option allows the compiler to perform
floating-point optimizations that are algebraically correct but
that may result in numerical differences. In general, these
differences will be insignificant.
The +Onofltacc option also enables the optimizer to generate
fused multiply-add (FMA) instructions. This optimization is
enabled by default at optimization level 2 or higher.
Specifying +Ofltacc disables the generation of FMA
instructions as well as other floating-point optimizations. Use
+Ofltacc if it is important that the compiler evaluate
floating-point expression according to the order specified by the
language standard.
Use the +Onofltacc option at optimization level 2 or higher.
If you are optimizing code at level 2 or higher and do not
specify +Onofltacc or +Ofltacc, the optimizer will use FMA
instructions, but will not perform floating-point optimizations
that involve expression reordering.
At optimization level 2 or higher, the optimizer fuses adjacent
multiply and add operations. Fused Multiply-Add (FMA) is
implemented by the FMPYFADD and FMPYNFADD instructions
and improves performance but occasionally produces results that
may differ in accuracy from results produced by code without FMA.
In general, the differences are slight.
FMA instructions are only available on PA-RISC 2.0 systems.
The +Ofltacc option disables fusing.
| +O[no]initcheck
Levels 2, 3, 4
| The initialization checking feature of the optimizer has three
possible states: on, off, or unspecified.
When on (+Oinitcheck), the optimizer
initializes to zero any local, scalar, non-static variables that are
uninitialized with respect to at least one path leading to a use of the
variable.
When off (+Onoinitcheck), the optimizer issues warning messages
when it discovers uninitialized variables, but does not
initialize them.
When unspecified, the optimizer initializes to zero any local,
scalar, non-static variables that are uninitialized with
respect to all paths leading to a use of the variable.
Use +Oinitcheck to look for uninitialized variables in a program.
| +O[no]libcalls
Levels 0, 1, 2, 3, 4
| +Olibcalls invokes faster versions
of a number of frequently called intrinsic functions.
It also moves invariant function expressions out of loops.
The sqrt function is executed as a hardware instruction.
If the code is compiled for the PA-RISC 1.0 architecture (e.g., with +DA1.1),
the following functions are executed in millicode:
The millicode versions have very low call overhead.
However, since they do not set errno,
no error handling is available in the event of an exception.
Regardless of architecture, error codes 627 (sqrt) and 628 (ln) will not occur.
An IEEE exception is raised instead.
Use this parameter only when your program
is not dependent on exception-handling.
The default is +Onolibcalls.
| +O[no]loop_unroll [=unroll factor]
Levels 2, 3, 4
| The +Oloopunroll option turns on loop unrolling. When you
use +Oloopunroll, you can also use the unroll factor to
control the code expansion. The default unroll factor is 4,
that is, four copies of the loop body. By experimenting with
different factors, you may improve the performance of your
program.
The default is +Oloopunroll.
| +O[no]moveflops
Levels 2, 3, 4
| +Omoveflops moves conditional floating point instructions out of loops.
The behavior of floating-point exception handling may be altered by this parameter.
Use +Onomoveflops if floating-point traps are enabled
and you do not want the behavior of floating-point exceptions to be altered
by the relocation of floating-point instructions.
This is the same as $ASSUME 'FLOAT_TRAPS_ON'$.
The default is +Omoveflops.
| +O[no]pipeline
Levels 2, 3, 4
| +Opipeline enables software pipelining.
Use +Onopipeline (disable software pipelining)
to conserve code space.
The default is +Opipeline.
| +O[no]procelim
Levels 0, 1, 2, 3, 4
| +Oprocelim removes routines from the executable file
that are not referenced by the application.
Use +Oprocelim to reduce the size of the executable file,
especially when optimizing at levels 3 and 4
when inlining may have removed calls to some routines.
The default is +Onoprocelim at optimization levels 0 through 3
and +Oprocelim at level 4.
| +O[no]regionsched
Levels 2, 3, 4
| +Oregionsched applies aggressive scheduling techniques
to move instructions across branches.
Note that it is not recommended that you use +Oregionsched
with the -z command-line option, which is the pc default.
If you use the parameter with -z, it may cause a
SIGSEGV error at run-time.
Use +Oregionsched to improve application run-time speed.
The default is +Onoregionsched.
| +O[no]regreassoc
Levels 2, 3, 4
| +Onoregreassoc turns off register reassociation.
Use +Onoregreassoc to disable register reassociation if this
optimization hinders the optimized application performance.
The default is +Oregreassoc.
|
Combining Optimization Options |  |
One use of the optimization parameters
is to turn off a specific optimization
that may not be appropriate for your program.
For example, if you want aggressive optimizations
applied to your program but do not want any optimizations
that depend upon entry scheduling,
you would combine the +Oaggressive and +Onoentrysched parameters
on the same command line, as follows:
pc +O4 +Oaggressive +Onoentrysched prog.p
|
The +Oconservative parameter is useful when optimizing programs
that do not conform to the Pascal ANSI standard.
Specifying this parameter disables any optimizations
that assume standard-conforming code.
For example, if you are importing a Pascal program
and wish to optimize it at level 3,
you could use the following command line:
pc +O3 +Oconservative prog.p
|
Note that the +Oaggressive and +Oconservative parameters
are incompatible and cannot be used on the same command line.
Obsolete Optimizer Options |  |
The following optimizer options are no longer supported by the
HP Pascal/HP-UX compiler:
+Obb (replaced by +Onosize)
+Os (replaced by +Onopipeline)
$OPTIMIZE 'BASIC_BLOCKSnum'$
$OPTIMIZE 'BASIC_BLOCK_FENCEnum'$
If you use these options,
the compiler issues a warning stating that the options are unrecognized.
|