Easy 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 easy.
- Generation of good code for subscript expressions.
- Code can be substantially shortened.
- Subscript expressions occur frequently.
- Subscript expressions occur inside loops.
- Assigning variables to registers.
- Much of code is loads and stores. A variable that is in a register
does not have to be loaded or stored.
- Easy case: assign a loop index variable to a register inside the loop.
- General case: graph coloring for register assignment.
- Reduction in
x * 8 → x << 3