(** Offset an addressing mode [addr] by a quantity [delta], so that it designates the pointer [delta] bytes past the pointer designated by [addr].  May be undefined, in which case [None] is returned. *)
Definition offset_addressing (addr: addressing) (delta: Z) : option addressing :=
match addr with
| Aindexed n => Some(Aindexed (Int.add n (Int.repr delta)))
| Aindexed2 => None
| Aglobal s n => Some(Aglobal s (Ptrofs.add n (Ptrofs.repr delta)))
| Abased s n => Some(Abased s (Ptrofs.add n (Ptrofs.repr delta)))
| Ainstack n => Some(Ainstack (Ptrofs.add n (Ptrofs.repr delta)))
end.

(* Specifications: *)
Lemma eval_offset_addressing:
forall (F V: Type) (ge: Genv.t F V) sp addr args delta addr' v,
offset_addressing addr delta = Some addr' ->
eval_addressing ge sp addr args = Some v ->
eval_addressing ge sp addr' args = Some(Val.add v (Vint (Int.repr delta))).