|
ABSTRACT
We propose a new optimization technique applicable to set-oriented languages, which we shall call general common subexpression elimination. It involves the computation of the IAVAIL(n) function for all nodes n in a flow graph, where IAVAIL(n) is the set of expressions such that along every path leading to n, there will be found a computation of the expression followed by only incidental assignments (i.e. A = A ∪ {x} or A = A - {x}) to its operands and that the number of such assignments is bounded, independent of the path taken. We shall try to justify our definitions and demonstrate the usefulness of this technique by several examples. We shall show that this optimization problem does not fit into the semilattice-theoretic model for global program optimization [Ki, KU, GW], and that the standard iterative algorithm for such problems does not work in this case. We then give several theorems which allow the problem to be solved for reducible flow graphs. The formulae given in the theorems are in such a form that an efficient algorithm can be found by adapting an algorithm given in [U]. The resulting algorithm takes 0(e log e) steps of an extended type, where bit vector operations are regarded as one step, and e is the number of edges of the flow graph. It takes 0(n log n) extended steps for a program flow graph of n nodes.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
{A1} F. E. Allen, "Program Optimization," in Annual Review in Automatic Programming, Vol. 5, Pergamon, 1969, pp. 239-307.
|
| |
2
|
{A2} F. E. Allen and J. Cocke, "A Catalogue of Optimizing transformations," in Design and Optimization of Compilers (R. Rustin, ed.), Prentice Hall, 1972, pp. 1-30.
|
| |
3
|
|
| |
4
|
|
 |
5
|
|
| |
6
|
|
 |
7
|
|
 |
8
|
|
 |
9
|
|
 |
10
|
|
| |
11
|
{HU} J. E. Hopcroft and J. D. Ullman, "An n log n Algorithm for Reduction of Flow Graphs," 6th Annl. Princeton Conference on Information Sciences and Systems, 1972.
|
 |
12
|
|
| |
13
|
{KU} J. B. Kam and J. D. Ullman, "Global Optimization Problems and Iterative Algorithms," JACM, Jan., 1976.
|
| |
14
|
{R} B. K. Rosen, Private Communication.
|
 |
15
|
|
| |
16
|
{U} J. D. Ullman, "Fast Algorithms for the Elimination of Common Subexpressions," Acta Informatica, 2:4, 1973, pp. 191-213.
|
|