Introduction to the CompCert Certified Compiler
- S. Boulm´
e – March 2020
CompCert : C compilers you can formally trust
March 2020 Sylvain.Boulme@univ-grenoble-alpes.fr
1/24
CompCert : C compilers you can formally trust March 2020 - - PowerPoint PPT Presentation
Introduction to the CompCert Certified Compiler S. Boulm e March 2020 CompCert : C compilers you can formally trust March 2020 Sylvain.Boulme@univ-grenoble-alpes.fr 1/24 Introduction to the CompCert Certified Compiler S. Boulm e
Introduction to the CompCert Certified Compiler
e – March 2020
1/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 2/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 3/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 4/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 4/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 4/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 4/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 4/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 5/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 5/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 5/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 5/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 5/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 6/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 6/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 6/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 6/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 7/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 7/24
Introduction to the CompCert Certified Compiler
e – March 2020
Certifying compilers 7/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 8/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 9/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 9/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 9/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 9/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 10/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 11/24
Introduction to the CompCert Certified Compiler
e – March 2020
Inductive nat: Type := O | S(n:nat ). (* defines natural numbers *) Fixpoint plus (n m:nat ): nat := (* defines n+m recursively *) match n with O => m | (S n’) => (S (plus n’ m)) end. (* Type
tuples containing (S n) values in Z *) Fixpoint tuple_S (n:nat ): Type := match n with O => Z | S n’ => Z * (tuple_S n’) end. (* Concatenation
such tuples *) Fixpoint app (n m:nat ):( tuple_S n)->(( tuple_S m)->( tuple_S (S (plus n m)))) := match n with O => fun t1 t2 => (t1 , t2) | S n’ => fun t1 t2 => let (x,t1 ’) := t1 in (x, app n’ m t1 ’ t2) end. The Coq proof assistant for certifying compilers 11/24
Introduction to the CompCert Certified Compiler
e – March 2020
Inductive nat: Type := O | S(n:nat ). (* defines natural numbers *) Fixpoint plus (n m:nat ): nat := (* defines n+m recursively *) match n with O => m | (S n’) => (S (plus n’ m)) end. (* Type
tuples containing (S n) values in Z *) Fixpoint tuple_S (n:nat ): Type := match n with O => Z | S n’ => Z * (tuple_S n’) end. (* Concatenation
such tuples *) Fixpoint app (n m:nat ):( tuple_S n)->(( tuple_S m)->( tuple_S (S (plus n m)))) := match n with O => fun t1 t2 => (t1 , t2) | S n’ => fun t1 t2 => let (x,t1 ’) := t1 in (x, app n’ m t1 ’ t2) end.
The Coq proof assistant for certifying compilers 11/24
Introduction to the CompCert Certified Compiler
e – March 2020
forall (n m:nat), tuple_S n -> tuple_S m -> tuple_S(S (plus n m)) The Coq proof assistant for certifying compilers 12/24
Introduction to the CompCert Certified Compiler
e – March 2020
forall (n m:nat), tuple_S n -> tuple_S m -> tuple_S(S (plus n m))
The Coq proof assistant for certifying compilers 12/24
Introduction to the CompCert Certified Compiler
e – March 2020
forall (n m:nat), tuple_S n -> tuple_S m -> tuple_S(S (plus n m))
The Coq proof assistant for certifying compilers 12/24
Introduction to the CompCert Certified Compiler
e – March 2020
forall (n m:nat), tuple_S n -> tuple_S m -> tuple_S(S (plus n m))
The Coq proof assistant for certifying compilers 12/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 13/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 13/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 13/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 13/24
Introduction to the CompCert Certified Compiler
e – March 2020
Axiom excluded_middle : forall (A:Prop), A \/ (A -> False ). The Coq proof assistant for certifying compilers 13/24
Introduction to the CompCert Certified Compiler
e – March 2020
The Coq proof assistant for certifying compilers 14/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 15/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 16/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 16/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 16/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 16/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 17/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 17/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 17/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 18/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 19/24
Introduction to the CompCert Certified Compiler
e – March 2020
Using CompCert 19/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 20/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 21/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 21/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 21/24
Introduction to the CompCert Certified Compiler
e – March 2020
1| < |S1| ensures preservation of infinite silent loops.
Overview of CompCert Implementation 22/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 23/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 23/24
Introduction to the CompCert Certified Compiler
e – March 2020
Overview of CompCert Implementation 23/24
Introduction to the CompCert Certified Compiler
e – March 2020
CompCert C Clight C#minor Cminor CminorSel RTL LTL Linear Mach Asm side-effects apart from expressions type elimination loop simplification stack allocation
instruction selection CFG construction register allocation CFG optimizations linearization
branch tunneling layout of stackframes assembly code generation
Overview of CompCert Implementation 24/24
Introduction to the CompCert Certified Compiler
e – March 2020
CompCert C Clight C#minor Cminor CminorSel RTL LTL Linear Mach Asm side-effects apart from expressions type elimination loop simplification stack allocation
instruction selection CFG construction register allocation CFG optimizations linearization
branch tunneling layout of stackframes assembly code generation
Overview of CompCert Implementation 24/24