(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** * Correctness of the translation from Clight to C#minor. *)
(** * Relational specification of the transformation *)
Inductive match_fundef (p: Clight.program) : Clight.fundef -> Csharpminor.fundef -> Prop :=
| match_fundef_internal: forall f tf,
transl_function p.(prog_comp_env) f = OK tf ->
match_fundef p (Ctypes.Internal f) (AST.Internal tf)
| match_fundef_external: forall ef args res cc,
ef_sig ef = signature_of_type args res cc ->
match_fundef p (Ctypes.External ef args res cc) (AST.External ef).
Definition match_varinfo (v: type) (tv: unit) := True.
Definition match_prog (p: Clight.program) (tp: Csharpminor.program) : Prop :=
match_program_gen match_fundef match_varinfo p p tp.
(** * Properties of operations over types *)
Remark transl_params_types:
forall params,
map typ_of_type (map snd params) = typlist_of_typelist (type_of_params params).

Lemma field_offset_stable:
forall (cunit prog: Clight.program) id co f,
linkorder cunit prog ->
cunit.(prog_comp_env)!id = Some co ->
prog.(prog_comp_env)!id = Some co /\
field_offset prog.(prog_comp_env) f (co_members co) = field_offset cunit.(prog_comp_env) f (co_members co).