Section EXPAND_INSTR.
Variable fe: funenv.
Hypothesis FE: fenv_agree fe.
Variable rec: forall fe', (size_fenv fe' < size_fenv fe)%nat -> context -> function -> mon unit.
Hypothesis rec_unchanged:
forall fe' (L: (size_fenv fe' < size_fenv fe)%nat) ctx f s x s' i pc,
rec fe' L ctx f s = R x s' i ->
Ple ctx.(dpc) s.(st_nextnode) ->
Plt pc ctx.(dpc) ->
s'.(st_code)!pc = s.(st_code)!pc.
Remark set_instr_other:
forall pc instr s x s' i pc',
set_instr pc instr s = R x s' i ->
pc' <> pc ->
s'.(st_code)!pc' = s.(st_code)!pc'.
Remark set_instr_same:
forall pc instr s x s' i c,
set_instr pc instr s = R x s' i ->
c!(pc) = s'.(st_code)!pc ->
c!(pc) = Some instr.
Hypothesis rec_spec:
forall fe' (L: (size_fenv fe' < size_fenv fe)%nat) ctx f s x s' i c,
rec fe' L ctx f s = R x s' i ->
fenv_agree fe' ->
Ple (ctx.(dpc) + max_pc_function f) s.(st_nextnode) ->
ctx.(mreg) = max_reg_function f ->
Ple (Pos.add ctx.(dreg) ctx.(mreg)) s.(st_nextreg) ->
ctx.(mstk) >= 0 ->
ctx.(mstk) = Z.max (fn_stacksize f) 0 ->
(min_alignment (fn_stacksize f) | ctx.(dstk)) ->
ctx.(dstk) >= 0 ->
s'.(st_stksize) <= stacksize ->
(forall pc, Ple ctx.(dpc) pc -> Plt pc s'.(st_nextnode) -> c!pc = s'.(st_code)!pc) ->
tr_funbody ctx f c.
Remark min_alignment_pos:
forall sz, min_alignment sz > 0.
Ltac inv_incr :=
match goal with
| [ H: sincr _ _ |- _ ] => destruct H; inv_incr
| _ => idtac
end.
End EXPAND_INSTR.
End INLINING_BODY_SPEC.
End INLINING_SPEC.
(** ** Relational specification of the translation of a function *)
Inductive tr_function: program -> function -> function -> Prop :=
| tr_function_intro: forall p fenv f f' ctx,
fenv_compat p fenv ->
tr_funbody fenv f'.(fn_stacksize) ctx f f'.(fn_code) ->
ctx.(dstk) = 0 ->
ctx.(retinfo) = None ->
f'.(fn_sig) = f.(fn_sig) ->
f'.(fn_params) = sregs ctx f.(fn_params) ->
f'.(fn_entrypoint) = spc ctx f.(fn_entrypoint) ->
0 <= fn_stacksize f' < Ptrofs.max_unsigned ->
tr_function p f f'.

Lemma transf_function_spec:
forall cunit f f',
transf_function (funenv_program cunit) f = OK f' ->
tr_function cunit f f'.