Functional Elimination of Phi-instructions

We present a functional analogue of the elimination of @F-instructions from Static Single Assignment (SSA) code. Extending earlier work on the relationship between SSA and functional languages we show that transformations from A-normal form (ANF) into a more restrictive form called GNF require the same compensating instructions to be inserted as are commonly inserted during the translation from SSA to machine code. Lifting the translation from the syntactic level to the type level, we introduce type systems that mediate the transition from ANF code into correctly register-allocated machine code and allow code optimisations and transformations to be performed in a typed functional setting.

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

[2]  Torben Amtoft,et al.  Inferring annotated types for inter-procedural register allocation with constructor flattening , 2003, TLDI '03.

[3]  Kenneth MacKenzie,et al.  Grail: a functional form for imperative mobile code , 2003, Electron. Notes Theor. Comput. Sci..

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

[5]  Axel Dold,et al.  Formal Verification of Transformations for Peephole Optimization , 1997, FME.

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

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

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

[9]  Peter Thiemann Formalizing Resourve Allocation in a Compiler , 1998, Types in Compilation.

[10]  Robin Milner,et al.  Co-Induction in Relational Semantics , 1991, Theor. Comput. Sci..

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

[12]  Johan Agat Type Based Techniques for Covert Channel Elimination and Register Allocation , 2000 .

[13]  Karl Crary,et al.  From system F to typed assembly language , 1999 .

[14]  Richard A. Kelsey A correspondence between continuation passing style and static single assignment form , 1995 .

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

[16]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

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

[18]  Axel Dold,et al.  Formal Verification of a Compiler Back-End Generic Checker Program , 1999, Ershov Memorial Conference.

[19]  Olivier Danvy,et al.  Lambda-dropping: transforming recursive equations into programs with block structure , 1997 .

[20]  John P. Gallagher,et al.  Proceedings of the 1997 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation , 1991 .

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

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

[23]  Konstantine Arkoudas,et al.  Machine-Checkable Correctness Proofs for Intra-procedural Dataflow Analyses , 2005, Electron. Notes Theor. Comput. Sci..

[24]  Raymond Lo,et al.  Register promotion by sparse partial redundancy elimination of loads and stores , 1998, PLDI.

[25]  Andrew W. Appel,et al.  Modern Compiler Implementation in ML , 1997 .

[26]  Atsushi Ohori,et al.  A Curry-Howard Isomorphism for Compilation and Program Execution , 1999, TLCA.

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

[28]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.