Verifying the Correctness of Compiler Transformations on Basic Blocks using Abstract Interpretation

We seek to develop thorough and reliable methods for testing compiler transformations by systematically generating a set of test cases, and then for each case, automatically proving that the transformation preserves correctness. We have implemented a specialized program equivalence prover for the domain of assembly language programs emitted by the Connection Machine Fortran compiler and targeted for the CM-2 massively parallel SIMD computer. Using abstract interpretation, the prover removes details such as register and stack usage, as well as explicit evaluation order within functional blocks, thereby reducing the problem to a trivial tree comparison. By performing limited loop unrolling, the prover also verifies that the compiler transformation preserves the inductive properties of simple loops. We have used this prover to successfully validate the register allocation phase of our compiler, uncovering numerous bugs without running a single test program, and without preparing sample data and expected results, which would be necessary for validation by means of running the test pro grams.

[1]  M.N. Sastry,et al.  Structure and interpretation of computer programs , 1986, Proceedings of the IEEE.

[2]  MannaZohar,et al.  Fixpoint approach to the theory of computation , 1972 .

[3]  James C. King,et al.  A Program Verifier , 1971, IFIP Congress.

[4]  John McCarthy,et al.  Correctness of a compiler for arithmetic expressions , 1966 .

[5]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[6]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[7]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[8]  Gerald J. Sussman,et al.  Structure and interpretation of computer programs , 1985, Proceedings of the IEEE.

[9]  Williams Ludwell Harrison,et al.  Automatic recognition of induction variables and recurrence relations by abstract interpretation , 1990, PLDI '90.

[10]  Rod M. Burstall,et al.  Program Proving as Hand Simulation with a Little Induction , 1974, IFIP Congress.

[11]  Robin Milner,et al.  Proving compiler correctness in a mechanised logic , 1972 .

[12]  Andrew Berlin A Compilation Strategy for Numerical Programs Based on Partial Evaluation , 1989 .

[13]  W. Daniel Hillis,et al.  The connection machine , 1985 .

[14]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[15]  Neil D. Jones,et al.  A relational framework for abstract interpretation , 1985, Programs as Data Objects.

[16]  William D. Clinger,et al.  Revised3 report on the algorithmic language scheme , 1986, SIGP.

[17]  M. Schönfinkel Über die Bausteine der mathematischen Logik , 1924 .

[18]  Jacques Loeckx,et al.  Correctness of Programs , 1987 .

[19]  Peter B. Kessler,et al.  Discovering machine-specific code improvements , 1986, SIGPLAN '86.