The Compcert verified compiler

Commented Coq development

Version 1.2, 2008-02-13

Introduction

Compcert is a compiler that generates PowerPC assembly code from Clight, a large subset of the C programming language. The particularity of this compiler is that it is written mostly within the specification language of the Coq proof assistant, and its correctness --- the fact that the generated assembly code is semantically equivalent to its source program --- was entirely proved within the Coq proof assistant.

A high-level overview of the Compcert compiler and its proof of correctness can be found in the following papers:

This Web site gives a commented listing of the underlying Coq specifications and proofs. Proof scripts and the parts of the compiler written directly in Caml are omitted. This development is a work in progress; some parts have substantially changed since the overview papers above were written.

The complete sources for Compcert can be downloaded from the Compcert Web site.

This document and the Compcert sources are copyright 2005, 2006, 2007, 2008 Institut National de Recherche en Informatique et en Automatique (INRIA) and distributed under the terms of the following license.

Table of contents

General-purpose libraries, data structures and algorithms

Definitions and properties used in many parts of the development

Source, intermediate and target languages: syntax and semantics

Compiler passes

Pass Source & target Compiler code Correctness proof
Simplification of control structures;
explication of type-dependent computations
Clight to Csharpminor Cshmgen Cshmgenproof1
Cshmgenproof2
Cshmgenproof3
Stack allocation of local variables
whose address is taken
Csharpminor to Cminor Cminorgen Cminorgenproof
Recognition of operators
and addressing modes
Cminor to CminorSel Selection Selectionproof
Construction of the CFG,
3-address code generation
Cminor to RTL RTLgen RTLgenspec
RTLgenproof
Constant propagation RTL to RTL Constprop Constpropproof
Common subexpression elimination RTL to RTL CSE CSEproof
Register allocation by coloring
of an interference graph
RTL to LTL InterfGraph
Coloring
Allocation

Coloringproof
Allocproof
Branch tunneling LTL to LTL Tunneling Tunnelingproof
Linearization of the CFG LTL to LTLin Linearize Linearizeproof
Spilling, reloading, calling conventions LTLin to Linear Conventions
Reload
Parallelmove
Reloadproof
Laying out the activation records Linear to Mach Bounds
Stacking
Stackingproof
Storing the activation records in memory Mach to Mach (none) PPCgenretaddr
Machabstr2concr
Emission of PowerPC assembly Mach to PPC PPCgen PPCgenproof1
PPCgenproof

Type systems

Trivial type systems are used to statically capture well-formedness conditions on the source and intermediate languages. Proofs that compiler passes are type-preserving:

All together


Xavier.Leroy@inria.fr