HP aC++/HP C A.06.20 Programmer's Guide

aCC +O3 +Onolimit sourcefile.C
or:
aCC +O4 +Onolimit sourcefile.C
By default, the optimizer limits the amount of time spent optimizing large programs
at levels 2, 3, and 4. Use this option if longer compile times are acceptable because you
want additional optimizations to be performed.
Limiting the Size of Optimized Code
You can disable optimizations that expand code size at the second, third, and fourth
optimization levels by using the +Osize suboption, as follows:
aCC +O2 +Osize sourcefile.C
or:
aCC +O3 +Osize sourcefile.C
or:
aCC +O4 +Osize sourcefile.C
Most optimizations improve execution speed and decrease executable code size. A few
optimizations significantly increase code size to gain execution speed. The +Osize
option disables these code-expanding optimizations.
Use this option if you have limited main memory, swap space, or disk space.
Combining Optimization Options
Optimization options that affect code size, (+Osize), compile-time (+Olimit), and
the aggressiveness of the optimizations performed can be combined at any of the
optimization levels 2 through 4.
Profile-Based Optimization
Profile-based optimization (PBO) is a set of performance-improving code
transformations based on the runtime characteristics of your application.
When using profile-based optimization, please note the following:
Because the linker performs code generation for profile-based optimization, linking
object files compiled with +Oprofile=collect and +Oprofile=use takes
more time than linking ordinary object files. However, compile-time will be
relatively fast. This is because the compiler is only generating the intermediate
code.
You can compile and instrument in one step, but you will have to recompile again
when optimizing. For example:
aCC +Oprofile=collect -O sample.C -o sample.exe
// Compile to instrumented executable.
sample.exe < input.file // Collect execution profile data.
204 Optimizing HP aC++ Programs