The document discusses machine-independent code optimization, highlighting inefficiencies in intermediate code generation and various optimization techniques to improve performance in terms of time, space, or power consumption. It lists specific optimization methods such as global common sub-expression elimination, loop unrolling, and function inlining, among others. Additionally, it provides examples and explanations of these techniques in practice.
The document discusses machine-independent code optimization, highlighting inefficiencies in intermediate code generation and various optimization techniques to improve performance in terms of time, space, or power consumption. It lists specific optimization methods such as global common sub-expression elimination, loop unrolling, and function inlining, among others. Additionally, it provides examples and explanations of these techniques in practice.
Intermediate code generation process introduces many
inefficiencies Extra copies of variables, using variables instead of constants, repeated evaluation of expressions, etc. Code optimization removes such inefficiencies and improves code Improvement may be time, space, or power consumption It changes the structure of programs, sometimes of beyond recognition Inlines functions, unrolls loops, eliminates some programmer-defined variables, etc. Code optimization consists of a bunch of heuristics and percentage of improvement depends on programs (may be zero also)
Y.N. Srikant Introduction to Optimizations
Examples of Machine-Independant Optimizations
Global common sub-expression elimination
Copy propagation Constant propagation and constant folding Loop invariant code motion Induction variable elimination and strength reduction Partial redundancy elimination Loop unrolling Function inlining Tail recursion removal Vectorization and Concurrentization Loop interchange, and loop blocking