On the 900 Series, a branc h does not tak e e￿ect until the second machine cycle after the branch instruction. The instruction immediately after a branc h instruction is called the delay slot. Even when you do not select optimization, the compiler tries to sc hedule a useful instruction in the dela y slot. However, the MPE/iX Optimizer does a better job of branc h delay scheduling and ma y be able to completely eliminate some branc hes.

Optimizer Levels

The levels of code optimization that the MPE/iX Optimizer pro vides are Level 0, Level 1, and Level 2.

Level 0 optimization is the default optimization lev el and provides simple optimizations that minimize compile time. Use this lev el when debugging a program or running a program that will not be run man y times (for example, a studen t job program that is run a few times and discarded). Level 0 functions include:

Simple branch delay slot scheduling.

Dead code elimination.

Faster register allocation (including cop y elimination).

Level 1 optimization is local to basic bloc ks, but does not optimize globally . Use Level 1 to achieve some optimization without spending excessiv e time compiling. Lev el 1 functions include:

Branch optimization.

Dead code elimination.

Faster register allocation (including cop y elimination).

Instruction scheduling.

Peephole optimization.

Level 2 optimization is global optimization. It pro vides the greatest sa ving of space and time achievable with the Optimizer and produces the most compact and fastest running program of all the levels. Use Level 2 when running a debugged program a large n umber of times. This is the correct level to choose for most applications. Lev el 2 functions are:

All Level 1 optimizations.

Coloring register allocation.

Induction variable elaboration and strength reduction. (An induction v ariable is a variable dependent on the value of a loop coun ter.)

Common subexpression elimination.

Constant folding.

Loop invariant code motion.

Unused de￿nition elimination. Promotion of variables to registers.

5-2 Optimizing a Program