(** * Useful properties of registers *)

(** [important_preg] extends [data_preg] by tracking the LR register as well.
    It is used to state that a code sequence modifies no data registers
    and does not modify LR either. *)

Definition important_preg (r: preg) : bool :=
  match r with
  | IR GPR0 => false
  | PC => false    | CTR => false
  | CR0_0 => false | CR0_1 => false | CR0_2 => false | CR0_3 => false
  | CARRY => false
  | _ => true
  end.

(* Specifications: *)
Lemma important_diff: forall r r', important_preg r = true -> important_preg r' = false -> r <> r'.
Lemma important_data_preg_1: forall r, data_preg r = true -> important_preg r = true.
Lemma important_data_preg_2: forall r, important_preg r = false -> data_preg r = false.
Lemma gpr_or_zero_zero: forall rs, gpr_or_zero rs GPR0 = Vzero.
Lemma gpr_or_zero_l_zero: forall rs, gpr_or_zero_l rs GPR0 = Vlong Int64.zero.
Lemma ireg_of_not_GPR0: forall m r, ireg_of m = OK r -> IR r <> IR GPR0.
Lemma ireg_of_not_GPR0': forall m r, ireg_of m = OK r -> r <> GPR0.
Lemma preg_of_not_LR: forall r, LR <> preg_of r.
Lemma preg_notin_LR: forall rl, preg_notin LR rl.