skip to main content
research-article
Open Access

Formal Verification of an SSA-Based Middle-End for CompCert

Published:01 March 2014Publication History
Skip Abstract Section

Abstract

CompCert is a formally verified compiler that generates compact and efficient code for a large subset of the C language. However, CompCert foregoes using SSA, an intermediate representation employed by many compilers that enables writing simpler, faster optimizers. In fact, it has remained an open problem to verify formally an SSA-based compiler. We report on a formally verified, SSA-based middle-end for CompCert. In addition to providing a formally verified SSA-based middle-end, we address two problems raised by Leroy in [2009]: giving an intuitive formal semantics to SSA, and leveraging its global properties to reason locally about program optimizations.

References

  1. Alpern, B., Wegman, M. N., and Zadeck, F. K. 1988. Detecting equality of variables in programs. In Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’88). ACM Press, New York, 1--11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Appel, A. W. 1998a. Modern Compiler Implementation: In ML. Cambridge University Press, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Appel, A. W. 1998b. SSA is functional programming. SIGPLAN Not. 33, 17--20. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Aycock, J. and Horspool, N. 2000. Simple generation of static single-assignment form. In Proceedings of the 9th International Conference on Compiler Construction, held as part of the Joint European Conferences on Theory and Practice of Software (CC/ETAPS’00). Lecture Notes in Computer Science, vol. 1781, Springer, 110--124. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Barthe, G., Demange, D., and Pichardie, D. 2012. A formally verified SSA-based middle-end-static single assignment meets compcert. In Proceedings of the 21st European Conference on Programming Languages and Systems (ESOP’12). Lecture Notes in Computer Science, vol. 7211, Springer, 47--66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Blech, J. O., Glesner, S., Leitner, J., and Mülling, S. 2005. Optimizing code generation from SSA form: A comparison between two formal correctness proofs in isabelle/hol. J. Electron. Theor. Comput. Sci. 141, 2, 33--51. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Boissinot, B., Hack, S., Grund, D., Dupont De Dinechin, B., and Rastello, F. 2008. Fast liveness checking for ssa form programs. In Proceedings of the 6th Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO’08). ACM Press, New York, 35--44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Boissinot, B., Darte, A., Rastello, F., Dupont De Dinechin, B., and Guillon, C. 2009. Revisiting out-of-ssa translation for correctness, code quality and efficiency. In Proceeding of the 7th Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO’09). IEEE Computer Society, 114--125. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Brandis, M. M. and Mössenböck, H. 1994. Single-pass generation of static single-assignment form for structured languages. ACM Trans. Program. Lang. Syst. 16, 6, 1684--1698. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Briggs, P., Cooper, K. D., and Simpson, L. T. 1997. Value numbering. Softw. Pract. Exper. 27, 6, 701--724. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Briggs, P., Cooper, K. D., Harvey, T. J., and Simpson, L. T. 1998. Practical improvements to the construction and destruction of static single assignment form. Softw. Pract. Exper. 28, 8, 859--881. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Brisk, P. 2006. Advances in static single assignment form and register allocation. Ph.D. dissertation AAI3254798, University of California, Los Angeles, CA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Chlipala, A. 2008. Parametric higher-order abstract syntax for mechanized semantics. In Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP’08). ACM Press, New York, 143--156. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Chlipala, A. 2010. A verified compiler for an impure functional language. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’10). ACM Press, New York, 93--106. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Chow, F., Chan, S., Kennedy, R., Liu, S.-M., Lo, R., and Tu, P. 1997. A new algorithm for partial redundancy elimination based on ssa form. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’97). ACM Press, New York, 273--286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. CompCertSSA. 2012. Companion web page. http://compcertssa.gforge.inria.fr.Google ScholarGoogle Scholar
  17. Cooper, K. D., Harvey, T. J., and Kennedy, K. 2000. A simple, fast dominance algorithm. Tech. rep., Rice University. www.cs.rice.edu/~keith/Embed/dom.pdf.Google ScholarGoogle Scholar
  18. Cytron, R., Ferrante, J., Rosen, B. K., Wegman, M. N., and Zadeck, F. K. 1991. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13, 4, 451--490. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Dargaye, Z. and Leroy, X. 2007. Mechanized verification of CPS transformations. In Proceedings of the 14th International Conference on Logic for Programming, Artificial Intelligence and Reasoning (LPAR’07). 211--225. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Hack, S., Grund, D., and Goos, G. 2006. Register allocation for programs in SSA form. In Proceedings of the 15th International Conference on Compiler Construction (CC’06). 247--262. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Knoop, J., Rüthing, O., and Steffen, B. 1992. Lazy code motion. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’92). ACM Press, New York, 224--234. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Knoop, J., Koschützkil, D., and Steffen, B. 1998. Basic-block graphs: Living dinosaurs? In Proceedings of the 7th International Conference on Compiler Construction, held as part of the Joint European Conferences on Theory and Practice of Software (CC/ETAPS’98). 65--79. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Lengauer, T. and Tarjan, R. E. 1979. A fast algorithm for finding dominators in a flowgraph. ACM Trans. Program. Lang. Syst. 1, 1, 121--141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Leroy, X. 2009. A formally verified compiler back-end. J. Autom. Reason. 43, 4, 363--446. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Mansky, W. and Gunter, E. 2010. A framework for formal verification of compiler optimizations. In Proceedings of the 1st International Conference on Interactive Theorem Proving (ITP’10). 371--386. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Matsuno, Y. and Ohori, A. 2006. A type system equivalent to static single assignment. In Proceedings of the 8th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP’06). ACM Press, New York, 249--260. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Menon, V., Glew, N., Murphy, B. R., Mccreight, A., Shpeisman, T., Adl-Tabatabai, A. R., and Petersen, L. 2006. A verifiable ssa program representation for aggressive compiler optimization. In Proceedings of the Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’06). ACM Press, New York, 397--408. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Necula, G. 2000. Translation validation for an optimizing compiler. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’00). ACM Press, New York, 83--94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Pnueli, A., Siegel, M., and Singerman, E. 1998. Translation validation. In Proceedings of the 4th International Conference on Tools and Algorithms for Construction and Analysis of Systems (TACAS’98). 151--166. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Rideau, L., Serpette, B. P., and Leroy, X. 2008. Tilting at windmills with Coq: Formal verification of a compilation algorithm for parallel moves. J. Autom. Reason. 40, 4, 307--326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Samet, H. 1975. Automatically proving the correctness of translations involving optimized code. Ph.D. dissertation STAN-CS-75-498, Computer Science Department, Stanford University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Schneider, S. 2013. Semantics of an intermediate language for program transformation. Master’s thesis, Saarland University.Google ScholarGoogle Scholar
  33. Sreedhar, V. C., Ju, R., Gillies, D. M., and Santhanam, V. 1999. Translating out of static single assignment form. In Proceedings of the 6th International Symposium on Static Analysis (SAS’99). 194--210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Stepp, M., Tate, R., and Lerner, S. 2011. Equality-based translation validator for LLVM. In Proceedings of the 23rd International Conference on Computer Aided Verification (CAV’11). 737--742. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Tate, R., Stepp, M., Tatlock, Z., and Lerner, S. 2009. Equality saturation: A new approach to optimization. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’09). ACM Press, New York, 264--276. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Tristan, J. B. and Leroy, X. 2009. Verified validation of lazy code motion. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’09). ACM Press, New York, 316--326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Tristan, J. B. and Leroy, X. 2010. A simple, verified validator for software pipelining. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’10). ACM Press, New York, 83--92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Tristan, J. B., Govereau, P., and Morrisett, G. 2011. Evaluating value-graph translation validation for llvm. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11). ACM Press, New York, 295--305. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Zhao, J. 2013. Formalizing an SSA-based compiler for verified advanced program transformations. Ph.D. dissertation, University of Pennsylvania. http://www.cis.upenn.edu/~stevez/vellvm/Zhao13.pdf.Google ScholarGoogle Scholar
  40. Zhao, J. and Zdancewic, S. 2012. Mechanized verification of computing dominators for formalizing compilers. In Proceedings of the 2nd International Conference on Certified Programs and Proofs (CPP’12). 27--42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Zhao, J., Zdancewic, S., Nagarakatte, S., and Martin, M. 2012. Formalizing the LLVM intermediate representation for verified program transformation. In Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’12). ACM Press, New York, 427--440. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Zhao, J., Nagarakatte, S., Martin, M., and Zdancewic, S. 2013. Formal verification of SSA-based optimizations for LLVM. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’13). ACM Press, New York, 175--186. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Formal Verification of an SSA-Based Middle-End for CompCert

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Programming Languages and Systems
        ACM Transactions on Programming Languages and Systems  Volume 36, Issue 1
        March 2014
        186 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/2597180
        Issue’s Table of Contents

        Copyright © 2014 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 March 2014
        • Accepted: 1 January 2014
        • Revised: 1 November 2013
        • Received: 1 April 2013
        Published in toplas Volume 36, Issue 1

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader