Summary of Major Optimization Levels [ HP C Programmer's Guide ] MPE/iX 5.0 Documentation
HP C Programmer's Guide
Summary of Major Optimization Levels
The HP C major optimization options are summarized in Table 4-1 .
Table 4-1. HP C Major Optimization Options
----------------------------------------------------------------------------------------------
| | | |
| Option | Description | Benefits |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| +O0 | Constant folding and simple register | Compiles fastest. |
| (default) | assignment. | |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| +O1 | Level 0 optimizations plus | Produces faster programs than level |
| | instruction scheduling and | 0. Compiles faster than level 2. |
| | optimizations that can be performed | |
| | on small sections of code. | |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| +O2 or -O | Level 1 optimizations, plus | Can produce faster run-time code |
| | optimizations performed over entire | than level 1 if programs use loops |
| | functions in a single file. | extensively. Compiles faster than |
| | Optimizes loops in order to reduce | level 3. Loop-oriented floating |
| | pipeline stalls. Performs analysis | point intensive applications may see |
| | of data-flow, memory usage, loops | run times reduced by 50%. Operating |
| | and expressions. | system and interactive applications |
| | | that use the already optimized |
| | | system libraries can achieve 30% to |
| | | 50% additional improvement. |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| +O3 (1) | Level 2 optimizations, plus full | Can produce faster run-time code |
| | optimization across all subprograms | than level 2 on code that frequently |
| | within a single file. Includes | calls small functions. Links faster |
| | subprogram inlining. | than level 4. |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| +O4 (1) | Level 3 optimizations, plus full | Produces faster run-time code than |
| | optimizations across the entire | level 3 if programs use many global |
| | application program. Includes | variables or if there are many |
| | global and static variable | opportunities for inlining procedure |
| | optimization and inlining across the | calls. |
| | entire program. Optimizations are | |
| | performed at link-time. | |
| | | |
----------------------------------------------------------------------------------------------
(1) This option is only available in HP C/HP-UX.
MPE/iX 5.0 Documentation