(* *********************************************************************)
(*                                                                     *)
(*              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 instruction selection *)
Local Open Scope cminorsel_scope.
Local Open Scope error_monad_scope.
(** * Relational specification of instruction selection *)
Definition match_fundef (cunit: Cminor.program) (f: Cminor.fundef) (tf: CminorSel.fundef) : Prop :=
exists hf, helper_functions_declared cunit hf /\ sel_fundef (prog_defmap cunit) hf f = OK tf.
Definition match_prog (p: Cminor.program) (tp: CminorSel.program) :=
match_program match_fundef eq p tp.
(** Processing of helper functions *)

Lemma lookup_helper_correct_1:
forall globs name sg id,
lookup_helper globs name sg = OK id ->
globs!id = Some (Gfun (External (EF_runtime name sg))).