(** Accessing slots in the stack frame *)
Remark eval_addrmode_indexed:
forall (base: ireg) ofs (rs: regset),
match rs#base with Vptr _ _ => True | _ => False end ->
eval_addrmode ge (Addrmode (Some base) None (inl _ (Ptrofs.unsigned ofs))) rs = Val.offset_ptr rs#base ofs.
Ltac loadind_correct_solve :=
match goal with
| H: Error _ = OK _ |- _ => discriminate H
| H: OK _ = OK _ |- _ => inv H
| H: match ?x with _ => _ end = OK _ |- _ => destruct x eqn:?; loadind_correct_solve
| _ => idtac
end.

Lemma storeind_correct:
forall (base: ireg) ofs ty src k (rs: regset) c m m',
storeind src base ofs ty k = OK c ->
Mem.storev (chunk_of_type ty) m (Val.offset_ptr rs#base ofs) (rs#(preg_of src)) = Some m' ->
exists rs',
exec_straight ge fn c rs m k rs' m'
/\ forall r, data_preg r = true -> preg_notin r (destroyed_by_setstack ty) -> rs'#r = rs#r.