Instance Finite_mreg : Finite mreg := {
Finite_elements := all_mregs;
Finite_elements_spec := all_mregs_complete
}.
Definition mreg_type (r: mreg): typ :=
match r with
| R0  | R1  | R2  | R3   | R4  | R5  | R6  | R7
| R8  | R9  | R10 | R11  | R12 => Tany32
| F0  | F1  | F2  | F3   | F4 | F5   | F6  | F7
| F8  | F9  | F10  | F11 | F12  | F13  | F14  | F15 => Tany64
end.
Open Scope positive_scope.
Module IndexedMreg <: INDEXED_TYPE.
Definition t := mreg.
Definition eq := mreg_eq.
Definition index (r: mreg): positive :=
match r with
| R0 => 1  | R1 => 2  | R2 => 3  | R3 => 4
| R4 => 5  | R5 => 6  | R6 => 7  | R7 => 8
| R8 => 9  | R9 => 10 | R10 => 11 | R11 => 12
| R12 => 13
| F0 => 14 | F1 => 15 | F2 => 16  | F3 => 17
| F4 => 18 | F5 => 19 | F6 => 20  | F7 => 21
| F8 => 22 | F9 => 23 | F10 => 24 | F11 => 25
| F12 => 26 | F13 => 27 | F14 => 28 | F15 => 29
end.

Lemma index_inj:
forall r1 r2, index r1 = index r2 -> r1 = r2.