A type system equivalent to static single assignment

This paper develops a static type system equivalent to static single assignment (SSA) form. In this type system, a type of a variable at some program point represents the control flows from the assignment statements that reach the program point. For this type system, we show that a derivable typing of a program corresponds to the program in SSA form. By this result, any SSA transformation can be interpreted as a type inference process in our type system. By adopting a result on efficient SSA transformation, we develop a type inference algorithm that reconstructs a type annotated code from a given code. These results provide a static alternative to SSA based compiler optimization without performing code transformation. Since this process does not change the code, it does not incur overhead due to insertion of φ functions. Another advantage of this type based approach is that it is not constrained to naming mechanism of variables and can therefore be combined with other static properties useful for compilation and code optimization such as liveness information of variables. As an application, we express optimizations as type-directed code transformations

[1]  Manuel M. T. Chakravarty,et al.  A Functional Perspective on SSA Optimisation Algorithms , 2004, COCV@ETAPS.

[2]  Mark N. Wegman,et al.  Constant propagation with conditional branches , 1985, POPL.

[3]  Michael D. Ernst,et al.  Value dependence graphs: representation without taxation , 1994, POPL '94.

[4]  Timothy J. Harvey,et al.  AS imple, Fast Dominance Algorithm , 1999 .

[5]  Michael Wolfe,et al.  Beyond induction variables: detecting and classifying sequences using a demand-driven SSA form , 1995, TOPL.

[6]  Eric Van Wyk,et al.  Proving correctness of compiler optimizations by temporal logic , 2002, POPL '02.

[7]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

[8]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[9]  Atsushi Ohori,et al.  Register allocation by proof transformation , 2003, Sci. Comput. Program..

[10]  Xavier Leroy,et al.  Java bytecode verification : algorithms and formalizations Xavier Leroy INRIA Rocquencourt and Trusted Logic , 2003 .

[11]  Andrew McCreight,et al.  A verifiable SSA program representation for aggressive compiler optimization , 2006, POPL '06.

[12]  Keshav Pingali,et al.  Algorithms for computing the static single assignment form , 2003, JACM.

[13]  Timothy J. Harvey,et al.  Practical improvements to the construction and destruction of static single assignment form , 1998 .

[14]  Eric Van Wyk,et al.  Compiler Optimization Correctness by Temporal Logic , 2004, High. Order Symb. Comput..

[15]  Nick Benton,et al.  Simple relational correctness proofs for static analyses and program transformations , 2004, POPL.

[16]  Keith D. Cooper,et al.  Operator strength reduction , 2001, TOPL.

[17]  Roy Dz-Ching Ju,et al.  Translating Out of Static Single Assignment Form , 1999, SAS.

[18]  Mark N. Wegman,et al.  Static Single Assignment (SSA) Form , 1991 .

[19]  Martín Abadi,et al.  A type system for Java bytecode subroutines , 1999, TOPL.

[20]  Atsushi Ohori,et al.  The Logical Abstract Machine: A Curry-Howard Isomorphism for Machine Code , 1999, Fuji International Symposium on Functional and Logic Programming.

[21]  Richard Kelsey,et al.  A correspondence between continuation passing style and static single assignment form , 1995, IR '95.

[22]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[23]  Andrew W. Appel,et al.  SSA is functional programming , 1998, SIGP.

[24]  Raymond Lo,et al.  Partial redundancy elimination in SSA form , 1999, TOPL.

[25]  Bowen Alpern,et al.  Detecting equality of variables in programs , 1988, POPL '88.

[26]  Robin Milner,et al.  Definition of standard ML , 1990 .

[27]  Sorin Lerner,et al.  Automated soundness proofs for dataflow analyses and transformations via local rules , 2005, POPL '05.

[28]  Michael Weiss The transitive closure of control dependence: the iterated join , 1992, LOPL.

[29]  Jong-Deok Choi,et al.  Automatic construction of sparse data flow evaluation graphs , 1991, POPL '91.

[30]  Ramakrishna Upadrasta,et al.  A practical and fast iterative algorithm for φ-function computation using DJ graphs , 2005, TOPL.

[31]  Bernhard Steffen,et al.  Lazy code motion , 1992, PLDI '92.

[32]  Atsushi Ohori A proof theory for machine code , 2007, TOPL.

[33]  Sorin Lerner,et al.  Automatically proving the correctness of compiler optimizations , 2003, PLDI '03.

[34]  B. Courcelle Fundamental properties of infinite trees , 1983 .