Advertisement

A Formally Verified SSA-Based Middle-End

Static Single Assignment Meets CompCert
  • Gilles Barthe
  • Delphine Demange
  • David Pichardie
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7211)

Abstract

CompCert is a formally verified compiler that generates compact and efficient PowerPC, ARM and x86 code for a large and realistic subset of the C language. However, CompCert foregoes using Static Single Assignment (SSA), an intermediate representation that allows for writing simpler and faster optimizers, and is used by many compilers. In fact, it has remained an open problem to verify formally a SSA-based compiler middle-end. We report on a formally verified, SSA-based, middle-end for CompCert. Our middle-end performs conversion from CompCert intermediate form to SSA form, optimization of SSA programs, including Global Value Numbering, and transforming out of SSA to intermediate form. In addition to provide the first formally verified SSA-based middle-end, we address two problems raised by Leroy [13]: giving a simple and intuitive formal semantics to SSA, and leveraging the global properties of SSA to reason locally about program optimizations.

Keywords

Type System Operational Semantic Junction Point Typing Rule Program Point 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. 1.
    Alpern, B., Wegman, M.N., Zadeck, F.K.: Detecting equality of variables in programs. In: POPL 1988. ACM (1988)Google Scholar
  2. 2.
    Appel, A.W.: SSA is functional programming. SIGPLAN Notices 33 (1998)Google Scholar
  3. 3.
    Blech, J.O., Glesner, S., Leitner, J., Mülling, S.: Optimizing code generation from SSA form: A comparison between two formal correctness proofs in Isabelle/HOL. In: COCV 2005. ENTCS. Elsevier (2005)Google Scholar
  4. 4.
    Briggs, P., Cooper, K.D., Harvey, T.J., Simpson, L.T.: Practical improvements to the construction and destruction of static single assignment form. In: SPE (1998)Google Scholar
  5. 5.
    Briggs, P., Cooper, K.D., Simpson, L.T.: Value numbering. In: SPE (1997)Google Scholar
  6. 6.
  7. 7.
    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: ACM TOPLAS (1991)Google Scholar
  8. 8.
    Dargaye, Z., Leroy, X.: Mechanized Verification of CPS Transformations. In: Dershowitz, N., Voronkov, A. (eds.) LPAR 2007. LNCS (LNAI), vol. 4790, pp. 211–225. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  9. 9.
    Hack, S., Grund, D., Goos, G.: Register Allocation for Programs in SSA-Form. In: Mycroft, A., Zeller, A. (eds.) CC 2006. LNCS, vol. 3923, pp. 247–262. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  10. 10.
    Knoop, J., Koschützki, D., Steffen, B.: Basic-Block Graphs: Living Dinosaurs? In: Koskimies, K. (ed.) CC 1998. LNCS, vol. 1383, pp. 65–79. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  11. 11.
    Knoop, J., Rüthing, O., Steffen, B.: Lazy code motion. In: PLDI 1992 (1992)Google Scholar
  12. 12.
    Lengauer, T., Tarjan, R.E.: A fast algorithm for finding dominators in a flowgraph. In: ACM TOPLAS (1979)Google Scholar
  13. 13.
    Leroy, X.: A formally verified compiler back-end. JAR 43(4) (2009)Google Scholar
  14. 14.
    The LLVM compiler infrastructure, http://llvm.org/
  15. 15.
    Mansky, W., Gunter, E.: A Framework for Formal Verification of Compiler Optimizations. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 371–386. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  16. 16.
    Matsuno, Y., Ohori, A.: A type system equivalent to static single assignment. In: PPDP 2006. ACM (2006)Google Scholar
  17. 17.
    Menon, V., Glew, N., Murphy, B.R., McCreight, A., Shpeisman, T., Adl-Tabatabai, A.R., Petersen, L.: A verifiable SSA program representation for aggressive compiler optimization. In: POPL 2006, ACM (2006)Google Scholar
  18. 18.
    Necula, G.: Translation validation for an optimizing compiler. In: PLDI 2000. ACM (2000)Google Scholar
  19. 19.
    Pnueli, A., Siegel, M.D., Singerman, E.: Translation Validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  20. 20.
    Rideau, L., Serpette, B.P., Leroy, X.: Tilting at windmills with Coq: Formal verification of a compilation algorithm for parallel moves. In: JAR (2008)Google Scholar
  21. 21.
    Stepp, M., Tate, R., Lerner, S.: Equality-Based Translation Validator for LLVM. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 737–742. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  22. 22.
    Tate, R., Stepp, M., Tatlock, Z., Lerner, S.: Equality saturation: a new approach to optimization. In: POPL 2009. ACM (2009)Google Scholar
  23. 23.
    Tristan, J.B., Govereau, P., Morrisett, G.: Evaluating value-graph translation validation for LLVM. In: PLDI 2011. ACM (2011)Google Scholar
  24. 24.
    Tristan, J.B., Leroy, X.: Verified validation of lazy code motion. In: PLDI 2009. ACM (2009)Google Scholar
  25. 25.
    Tristan, J.B., Leroy, X.: A simple, verified validator for software pipelining. In: POPL 2010. ACM (2010)Google Scholar
  26. 26.
    Zhao, J., Zdancewic, S., Nagarakatte, S., Martin, M.: Formalizing the LLVM intermediate representation for verified program transformation. In: POPL 2012. ACM (2012)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Gilles Barthe
    • 1
  • Delphine Demange
    • 2
  • David Pichardie
    • 3
  1. 1.IMDEA Software InstituteMadridSpain
  2. 2.ENS Cachan Bretagne / IRISARennesFrance
  3. 3.INRIA, Centre Rennes-Bretagne AtlantiqueRennesFrance

Personalised recommendations