next up previous
Next: Dead Code Elimination Up: Optimization Previous: Partial Redundancy Elimination

Strength Reduction

Strength Reduction (SR) [2] replaces expensive operations by equivalent cheaper ones from the target machine language. Some machine instructions are considerably cheaper than others and can often be used as special cases of more expensive operators. For instance, $x^2$ is invariably cheaper to implement as than as a call to an exponentiation routine. Moreover, an additive operator is generally cheaper than a multiplicative operator.

SR is a very powerful algorithm to transform computations involving multiplications and additions together into computations only using additions. It is a natural candidate to optimize the current HPJava compiler because of the complexity of the terms in the subscript expression of a multiarray element access.

Bryan Carpenter 2004-04-24