![]() |
|||
Optimization Passes for Machine SuifLaurent RolazWhat does the term
optimization mean ? it implies that the code produced is optimal. In
reality, the optimizer transforms the intermediate representation in a way that
is believed to improve the program. Typically, improvements focus on the
execution speed of the program. However, other improvements, such as reducing
memory requirements, are also possible. But there is no guarantee that the
resulting code cannot be improved. In fact, it is possible that the optimizer
will make the program worse. Therefore, many tradeoffs must be considered when
designing an optimizer. The fundamental responsibility of the optimizer is to
preserve the observable behavior of the program. In other words, the optimized
program must produce the same results as the unoptimized program for all
possible inputs.
Constant Propagation The goal of constant propagation is to discover values that are constants on all possible executions of a program and to propagate these constants values as far through the program as possible. Expressions whose operands are all constants can be evaluated at compile time and the result propagated further. Sparse Conditional Constant Propagation (SCCP) is an algorithm developed by Wegman and Zadeck. This variant of constant propagation is a powerful algorithm for determining constants in a single procedure. It can discovers all constants that can be found by evaluating all conditional branches with all constant operands. SCCP operates on particular form of the intermediate representation called the static single assignment form. Download:
On-line Documentation:
Partial Redundancy Elimination Optimizing compiler often attempts to eliminate redundant computations either by removing instructions or by moving instructions to less frequently executed locations. The code removing optimization attempts to determine when two instructions compute the same value, and then decides if one of the instructions can be eliminated. The code motion optimization rely on data-flow analysis to determine the set of locations where each computation will produce the same value and to select the ones that are expected to be least frequently executed. Lazy Code Motion (LCM) is an algorithm developed by Knoop, Rüthing and Steffen. It is a descendant of partial redundancy elimination that avoids unnecessary code motion. Download:
On-line Documentation:
If-Conversion If-conversion is a transformation that consits in eliminating branch instructions by introducing conditional instructions. In our approach, partial predicate support is assumed through the select operation. Notice that there is no select opcode in suifvm, so this pass use the opcode ANY to model a select, and then the back-end for a specific architecture should implement these instructions by a specific select instruction. Our task was to develop an algorithm to perform a simple if-conversion to study the improvement of such a transformation. The literature is not plentiful on algorithm that perform if-conversion, so a sketch of solution is given. Download:
On-line Documentation:
A Possible Sequence of these Optimizations About the authorLaurent Rolaz is the author of these optimization passes which have been written at LAP, EPFL during winter 2002-2003. This work is part of a diploma project.
|
|||