(** Builtin arguments and results *)

(* Specifications: *)
Lemma eagree_set_res:
forall e1 e2 v1 v2 res ne,
Val.lessdef v1 v2 ->
eagree e1 e2 (kill_builtin_res res ne) ->
eagree (regmap_setres res v1 e1) (regmap_setres res v2 e2) ne.
Lemma transfer_builtin_arg_sound:
forall bc e e' sp m m' a v,
eval_builtin_arg ge (fun r => e#r) (Vptr sp Ptrofs.zero) m a v ->
forall nv ne1 nm1 ne2 nm2,
transfer_builtin_arg nv (ne1, nm1) a = (ne2, nm2) ->
eagree e e' ne2 ->
magree m m' (nlive ge sp nm2) ->
genv_match bc ge ->
bc sp = BCstack ->
exists v',
eval_builtin_arg ge (fun r => e'#r) (Vptr sp Ptrofs.zero) m' a  v'
/\ vagree v v' nv
/\ eagree e e' ne1
/\ magree m m' (nlive ge sp nm1).
Lemma transfer_builtin_args_sound:
forall e sp m e' m' bc al vl,
eval_builtin_args ge (fun r => e#r) (Vptr sp Ptrofs.zero) m al vl ->
forall ne1 nm1 ne2 nm2,
transfer_builtin_args (ne1, nm1) al = (ne2, nm2) ->
eagree e e' ne2 ->
magree m m' (nlive ge sp nm2) ->
genv_match bc ge ->
bc sp = BCstack ->
exists vl',
eval_builtin_args ge (fun r => e'#r) (Vptr sp Ptrofs.zero) m' al vl'
/\ Val.lessdef_list vl vl'
/\ eagree e e' ne1
/\ magree m m' (nlive ge sp nm1).
Lemma can_eval_builtin_arg:
forall sp e m e' m' P,
magree m m' P ->
forall a v,
eval_builtin_arg ge (fun r => e#r) (Vptr sp Ptrofs.zero) m a v ->
exists v', eval_builtin_arg tge (fun r => e'#r) (Vptr sp Ptrofs.zero) m' a v'.
Lemma can_eval_builtin_args:
forall sp e m e' m' P,
magree m m' P ->
forall al vl,
eval_builtin_args ge (fun r => e#r) (Vptr sp Ptrofs.zero) m al vl ->
exists vl', eval_builtin_args tge (fun r => e'#r) (Vptr sp Ptrofs.zero) m' al vl'.