International Conference on Interactive Theorem Proving

ITP 2015: Interactive Theorem Proving pp 344-358 | Cite as

A Linear First-Order Functional Intermediate Language for Verified Compilers

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9236)

Abstract

We present the linear first-order intermediate language IL for verified compilers. IL is a functional language with calls to a nondeterministic environment. We give IL terms a second, imperative semantic interpretation and obtain a register transfer language. For the imperative interpretation we establish a notion of live variables. Based on live variables, we formulate a decidable property called coherence ensuring that the functional and the imperative interpretation of a term coincide. We formulate a register assignment algorithm for IL and prove its correctness. The algorithm translates a functional IL program into an equivalent imperative IL program. Correctness follows from the fact that the algorithm reaches a coherent program after consistently renaming local variables. We prove that the maximal number of live variables in the initial program bounds the number of different variables in the final coherent program. The entire development is formalized in Coq.

References

  1. 1.
    Appel, A.W.: Compiling with Continuations. Cambridge University Press, Cambridge (1992)Google Scholar
  2. 2.
    Appel, A.W.: SSA is functional programming. In: SIGPLAN Notices, vol. 33, no. 4 (1998)Google Scholar
  3. 3.
    Barthe, G., Demange, D., Pichardie, D.: A formally verified SSA-based middle-end. In: Seidl, H. (ed.) Programming Languages and Systems. LNCS, vol. 7211, pp. 47–66. Springer, Heidelberg (2012) CrossRefGoogle Scholar
  4. 4.
    Beringer, L., MacKenzie, K., Stark, I.: Grail: a functional form for imperative mobile code. In: ENTCS, vol. 85, no. 1 (2003)Google Scholar
  5. 5.
    Blazy, S., Robillard, B., Appel, A.W.: Formal verification of coalescing graph-coloring register allocation. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 145–164. Springer, Heidelberg (2010) CrossRefGoogle Scholar
  6. 6.
    Chakravarty, M.M.T., Keller, G., Zadarnowski, P.: A functional perspective on SSA optimisation algorithms. In: ENTCS, vol. 82, no. 2 (2003)Google Scholar
  7. 7.
    Chlipala, A.: A verified compiler for an impure functional language. In: POPL (2010)Google Scholar
  8. 8.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. In: TOPLAS, vol. 13, no. 4 (1991)Google Scholar
  9. 9.
    Hack, S., Grund, D., Goos, G.: Register allocation for programs in SSA-Form. In: CC (2006)Google Scholar
  10. 10.
    Kelsey, R.A.: A correspondence between continuation passing style and static single assignment form. In: SIGPLAN Notices, vol. 30, no. 3 (1995)Google Scholar
  11. 11.
    Landin, P.J.: Correspondence between ALGOL 60 and Church’s Lambda-notation: part I. In: CACM, vol. 8, no. 2 (1965)Google Scholar
  12. 12.
    Lattner, C., Adve, V.S.: LLVM: a Compilation framework for lifelong program analysis and transformation. In: CGO (2004)Google Scholar
  13. 13.
    Leroy, X.: Formal verification of a realistic compiler. In: CACM, vol. 52, no. 7 (2009)Google Scholar
  14. 14.
    Nipkow, T., Klein, G.: Concrete Semantics: With Isabelle/HOL. Springer Publishing Company, Incorporated, Switzerland (2014)CrossRefGoogle Scholar
  15. 15.
    Reynolds, J.C.: The discoveries of continuations. LSC 6(3–4), 23–247 (1993)MATHGoogle Scholar
  16. 16.
    Sabry, A., Felleisen, M.: Reasoning about programs in continuation-passing style. In: LSC, vol. 6, no. (3-4) (1993)Google Scholar
  17. 17.
    Zhao, J., Nagarakatte, S., Martin, M.M.K., Zdancewic, S.: Formal verification of SSA-based Optimizations for LLVM. In: PLDI (2013)Google Scholar
  18. 18.
    Zhao, J., Nagarakatte, S., Martin, M.M.K., Zdancewic, S.: Formalizing LLVM intermediate representation for verified program transformations. In: POPL (2012)Google Scholar
  19. 19.
    Schneider, S., Smolka, G., Hack, S.: A first-order functional intermediate language for verified compilers. CoRR (2015). 1503.08665

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Saarland UniversitySaarbrückenGermany

Personalised recommendations