Instance Finite_mreg : Finite mreg := {
Finite_elements := all_mregs;
Finite_elements_spec := all_mregs_complete
}.
Definition mreg_type (r: mreg): typ :=
match r with
| AX | BX | CX | DX | SI | DI | BP => if Archi.ptr64 then Tany64 else Tany32
| R8 | R9 | R10 | R11 | R12 | R13 | R14 | R15 => Tany64
| X0 | X1 | X2 | X3 | X4 | X5 | X6 | X7 => Tany64
| X8 | X9 | X10 | X11 | X12 | X13 | X14 | X15 => Tany64
| FP0 => Tany64
end.
Local Open Scope positive_scope.
Module IndexedMreg <: INDEXED_TYPE.
Definition t := mreg.
Definition eq := mreg_eq.
Definition index (r: mreg): positive :=
match r with
| AX => 1 | BX => 2 | CX => 3 | DX => 4 | SI => 5 | DI => 6 | BP => 7
| R8 => 8 | R9 => 9 | R10 => 10 | R11 => 11 | R12 => 12 | R13 => 13 | R14 => 14 | R15 => 15
| X0 => 16 | X1 => 17 | X2 => 18 | X3 => 19 | X4 => 20 | X5 => 21 | X6 => 22 | X7 => 23
| X8 => 24 | X9 => 25 | X10 => 26 | X11 => 27 | X12 => 28 | X13 => 29 | X14 => 30 | X15 => 31
| FP0 => 32
end.

(* Specifications: *)
Lemma index_inj:
forall r1 r2, index r1 = index r2 -> r1 = r2.