(** Global variables mentioned in an operation or addressing mode *)
Definition globals_addressing (addr: addressing) : list ident :=
match addr with
| Aglobal s n => s :: nil
| Abased s n => s :: nil
| Abasedscaled sc s n => s :: nil
| _ => nil
end.
Definition globals_operation (op: operation) : list ident :=
match op with
| Oindirectsymbol s => s :: nil
| Olea addr => globals_addressing addr
| Oleal addr => globals_addressing addr
| _ => nil
end.
(** * Invariance and compatibility properties. *)
(** [eval_operation] and [eval_addressing] depend on a global environment for resolving references to global symbols.  We show that they give the same results if a global environment is replaced by another that assigns the same addresses to the same symbols. *)
Section GENV_TRANSF.
Variable F1 F2 V1 V2: Type.
Variable ge1: Genv.t F1 V1.
Variable ge2: Genv.t F2 V2.
Hypothesis agree_on_symbols:
forall (s: ident), Genv.find_symbol ge2 s = Genv.find_symbol ge1 s.

Lemma eval_addressing_preserved:
forall sp addr vl,
eval_addressing ge2 sp addr vl = eval_addressing ge1 sp addr vl.