Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

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

Published: 01 March 2014 Publication History

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.
[2]
Appel, A. W. 1998a. Modern Compiler Implementation: In ML. Cambridge University Press, New York.
[3]
Appel, A. W. 1998b. SSA is functional programming. SIGPLAN Not. 33, 17--20.
[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.
[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.
[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.
[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.
[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.
[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.
[10]
Briggs, P., Cooper, K. D., and Simpson, L. T. 1997. Value numbering. Softw. Pract. Exper. 27, 6, 701--724.
[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.
[12]
Brisk, P. 2006. Advances in static single assignment form and register allocation. Ph.D. dissertation AAI3254798, University of California, Los Angeles, CA.
[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.
[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.
[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.
[16]
CompCertSSA. 2012. Companion web page. http://compcertssa.gforge.inria.fr.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[24]
Leroy, X. 2009. A formally verified compiler back-end. J. Autom. Reason. 43, 4, 363--446.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[32]
Schneider, S. 2013. Semantics of an intermediate language for program transformation. Master’s thesis, Saarland University.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.

Cited By

View all
  • (2024)A Safe Low-Level Language for Computer Algebra and Its Formally Verified CompilerProceedings of the ACM on Programming Languages10.1145/36746298:ICFP(121-146)Online publication date: 15-Aug-2024
  • (2024)Hyperblock Scheduling for Verified High-Level SynthesisProceedings of the ACM on Programming Languages10.1145/36564558:PLDI(1929-1953)Online publication date: 20-Jun-2024
  • (2023)Pattern-Based Peephole Optimizations with Java JIT TestsProceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3597926.3598038(64-75)Online publication date: 12-Jul-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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: 01 March 2014
Accepted: 01 January 2014
Revised: 01 November 2013
Received: 01 April 2013
Published in TOPLAS Volume 36, Issue 1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Single static assignment
  2. compiler verification
  3. mechanized proof

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)121
  • Downloads (Last 6 weeks)20
Reflects downloads up to 26 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2024)A Safe Low-Level Language for Computer Algebra and Its Formally Verified CompilerProceedings of the ACM on Programming Languages10.1145/36746298:ICFP(121-146)Online publication date: 15-Aug-2024
  • (2024)Hyperblock Scheduling for Verified High-Level SynthesisProceedings of the ACM on Programming Languages10.1145/36564558:PLDI(1929-1953)Online publication date: 20-Jun-2024
  • (2023)Pattern-Based Peephole Optimizations with Java JIT TestsProceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3597926.3598038(64-75)Online publication date: 12-Jul-2023
  • (2023)Synthesizing Quantum-Circuit OptimizersProceedings of the ACM on Programming Languages10.1145/35912547:PLDI(835-859)Online publication date: 6-Jun-2023
  • (2023)Mechanised Semantics for Gated Static Single AssignmentProceedings of the 12th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3573105.3575681(182-196)Online publication date: 11-Jan-2023
  • (2023)SSA Translation Is an Abstract InterpretationProceedings of the ACM on Programming Languages10.1145/35712587:POPL(1895-1924)Online publication date: 11-Jan-2023
  • (2023)Formally Verified Native Code Generation in an Effectful JIT: Turning the CompCert Backend into a Formally Verified JIT CompilerProceedings of the ACM on Programming Languages10.1145/35712027:POPL(249-277)Online publication date: 11-Jan-2023
  • (2023)Verified Transformation of Continuation-Passing Style into Static Single Assignment FormTheoretical Aspects of Software Engineering10.1007/978-3-031-35257-7_2(20-37)Online publication date: 4-Jul-2023
  • (2022)Formally Verified Loop-Invariant Code Motion and Assorted OptimizationsACM Transactions on Embedded Computing Systems10.1145/352950722:1(1-27)Online publication date: 13-Dec-2022
  • (2021)Simple, light, yet formally verified, global common subexpression elimination and loop-invariant code motionProceedings of the 22nd ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems10.1145/3461648.3463850(85-96)Online publication date: 22-Jun-2021
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media