Some Optimization Techniques
Some good optimization techniques include:
- Generation of good code for common special cases, such as
I := 0. These occur frequently enough to provide a good
savings, and testing for them is fairly easy.
- Generation of good code for subscript expressions.
These often occur in loops.
- Assigning variables to registers.
- Much of code is loads and stores.
- Easy case: assign a loop index variable to a register inside the loop.
- General case: graph coloring.
- Moving invariant code out of loops:
for i := 1 to 1000 do
x[i] := y[i] * sqrt(a);
The code sqrt(a) does not change within the loop, so it could be
moved above the loop and its value reused.
- Reduction in strength:
x * 8 &rarr x < < 3
Contents   
Page-10   
Prev   
Next   
Page+10   
Index