Use of MPE/iX Optimizer with Languages

In MPE/iX Native Mode, HP C/iX, HP COBOL II/XL, HP F ORTRAN 77/iX, and HP Pascal/iX provide the optimizer option. Curren tly, HP COBOL II/XL pro vides only Levels 0 and 1. HP C/iX, HP P ascal/iX, and HP F ORTRAN 77/iX provide Levels 0, 1, and 2.

Optimizer Assumptions

During compilation, a compiler gathers information about the use of v ariables and passes it to the Optimizer. The MPE/iX Optimizer uses the information to ensure that eac h code transformation it performs main tains the correctness of the program (at least to the exten t that the original unoptimized program is correct).

The compiler assumes that inside a subroutine or function, only the follo wing variables can be accessed directly, indirectly, or by another function call:

Common variables declared in this routine.

Local variables (static and dynamic).

Parameters to this routine.

Global variables visible in this routine.

If you have code that violates these assumptions, Optimizer can c hange the behavior of the program in an undesirable w ay. Avoid the following coding practices to ensure correct program execution in optimized code:

Referencing outside the described bounds of an arra y. This can cause address corruption or cause the program to abort when it is run.

Using variables that can be accessed b y a process other than the program, suc h as shared common variables. The compiler assumes that the program is the only process accessing the data. (HP FORTRAN 77/iX has some exceptions.) HP C/iX, HP P ascal/iX, and HP FORTRAN 77/iX provide compiler options to c hange the assumptions about a routine.

Avoid using variables before they ha ve been initialized. The optimized v ersion of a program may run di￿erently than the unoptimized v ersion.

For detailed information, refer to HP FORTRAN 77/iX Programmer's Guide Supplement (31501-90002) and HP Pascal/iX Programmer's Guide (31502-90002).

Optimizing a Program 5-3