A unified approach to global program optimization

A technique is presented for global analysis of program structure in order to perform compile time optimization of object code generated for expressions. The global expression optimization presented includes constant propagation, common subexpression elimination, elimination of redundant register load operations, and live expression analysis. A general purpose program flow analysis algorithm is developed which depends upon the existence of an "optimizing function." The algorithm is defined formally using a directed graph model of program flow structure, and is shown to be correct. Several optimizing functions are defined which, when used in conjunction with the flow analysis algorithm, provide the various forms of code optimization. The flow analysis algorithm is sufficiently general that additional functions can easily be defined for other forms of global code optimization.

[1]  Harry D. Huskey,et al.  Compiling techniques for Boolean expressions and conditional statements in ALGOL 60 , 1961, CACM.

[2]  Martin Hopkins An Optimizing Compiler Design , 1971, IFIP Congress.

[3]  Mark Finkelstein A compiler optimization technique , 1968, Comput. J..

[4]  Frances E. Allen,et al.  Control-flow analysis , 2022 .

[5]  John Cocke Global common subexpression elimination , 1970 .

[6]  Fabrizio Luccio,et al.  A comment on index register allocation , 1967, CACM.

[7]  Peter Bachmann A Contribution to the Problem of the Optimization of Programs , 1971, IFIP Congress.

[8]  C. William Gear,et al.  High speed compilation of efficient object code , 1965, Commun. ACM.

[9]  Andrei P. Ershov On programming of arithmetic operations , 1958, CACM.

[10]  C. P. Earnest,et al.  Analysis of Graphs by Ordering of Nodes , 1972, JACM.

[11]  Mark Elson,et al.  Code-Generation Technique for Large-Language Compilers , 1970, IBM Syst. J..

[12]  Ikuo Nakata,et al.  On compiling algorithms for arithmetic expressions , 1967, CACM.

[13]  Melvin A. Breuer,et al.  Generation of optimal code for expressions via factorization , 1969, CACM.

[14]  W. M. McKeeman,et al.  Peephole optimization , 1965, CACM.

[15]  William H. E. Day,et al.  Compiler Assignment of Data Items to Registers , 1970, IBM Syst. J..

[16]  Edward S. Lowry,et al.  Object code optimization , 1969, CACM.

[17]  Jürg Nievergelt,et al.  On the automatic simplification of computer programs , 1965, CACM.

[18]  Dennis Tsichritzis,et al.  Transformations of Programs , 1971, IFIP Congress.

[19]  Joseph T. Ryan A Direction-Independent Algorithm for Determining the Forward and Backward Compute Point for A Term or Subscript During Compilation , 1966, Comput. J..

[20]  Brian Randall,et al.  ALGOL 60 implementation , 1964 .

[21]  Roman R. Redziejowski On arithmetic expressions and trees , 1969, CACM.

[22]  Dennis John Frailey,et al.  A study of code optimization using a general purpose optimizer , 1971 .

[23]  Frances E. Allen,et al.  A Basis for Program Optimization , 1971, IFIP Congress.

[24]  Robert W. Floyd,et al.  An algorithm for coding efficient arithmetic operations , 1961, CACM.

[25]  Ken Kennedy,et al.  A global flow analysis algorithm , 1972 .

[26]  Gary Arlen Kildall,et al.  Global expression optimization during compilation , 1972 .

[27]  Harry D. Huskey Compiling Techniques for Algebraic Expressions , 1961, Comput. J..

[28]  Alfred V. Aho,et al.  A formal approach to code optimization , 1970 .

[29]  Dennis J. Frailey Expression optimization using unary complement operators , 1970 .

[30]  Jeffrey D. Ullman,et al.  The Generation of Optimal Code for Arithmetic Expressions , 1970, JACM.

[31]  Richard M. Karp,et al.  Index Register Allocation , 1966, JACM.

[32]  James P. Anderson A note on some compiling algorithms , 1964, CACM.

[33]  Richard J. Fateman Optimal code for serial and parallel computation , 1969, CACM.

[34]  Sidney B. Gasser Program optimization , 1972 .

[35]  Vincent A. Busam,et al.  Optimization of expressions in Fortran , 1969, CACM.

[36]  Bernard A. Galler,et al.  An Algorithm for Translating Boolean Expressions , 1962, JACM.

[37]  David Gries,et al.  Compiler Construction for Digital Computers , 1971 .

[38]  A. P. Yershóv ALPHA—An Automatic Programming System of High Efficiency , 1966, JACM.

[39]  Robert Alan Wagner Some techniques for algorithm optimization with application to matrix arithmetic expressions , 1968 .

[40]  John Cocke,et al.  Programming languages and their compilers: Preliminary notes , 1969 .

[41]  R. A. Freiburghouse The multics PL/1 compiler , 1969, AFIPS '69 (Fall).

[42]  Victor B. Schneider,et al.  On the number of registers needed to evaluate arithmetic expressions , 1971 .