Module Loc.
Definition type (l: loc) : typ :=
match l with
| R r => mreg_type r
| S sl pos ty => ty
end.
Definition diff_dec (l1 l2: loc) : { Loc.diff l1 l2 } + { ~Loc.diff l1 l2 }.
(** [Loc.norepet ll] holds if the locations in list [ll] are pairwise different. *)
Inductive norepet : list loc -> Prop :=
| norepet_nil:
norepet nil
| norepet_cons:
forall hd tl, notin hd tl -> norepet tl -> norepet (hd :: tl).
Fixpoint undef (ll: list loc) (m: t) {struct ll} : t :=
match ll with
| nil => m
| l1 :: ll' => undef ll' (set l1 Vundef m)
end.
Definition getpair (p: rpair loc) (m: t) : val :=
match p with
| One l => m l
| Twolong l1 l2 => Val.longofwords (m l1) (m l2)
end.
Definition setpair (p: rpair mreg) (v: val) (m: t) : t :=
match p with
| One r => set (R r) v m
| Twolong hi lo => set (R lo) (Val.loword  v) (set (R hi) (Val.hiword v) m)
end.

Lemma getpair_exten:
forall p ls1 ls2,
(forall l, In l (regs_of_rpair p) -> ls2 l = ls1 l) ->
getpair p ls2 = getpair p ls1.