(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Correctness proof for PPC generation: auxiliary results. *)
Local Transparent Archi.ptr64.
(** * Properties of low half/high half decomposition *)
(** * 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.
Hint Resolve important_diff: asmgen.
Hint Resolve important_data_preg_1 important_data_preg_2: asmgen.
(** Useful properties of the GPR0 registers. *)
Hint Resolve gpr_or_zero_not_zero gpr_or_zero_zero: asmgen.
Hint Resolve gpr_or_zero_l_not_zero gpr_or_zero_l_zero: asmgen.
Hint Resolve ireg_of_not_GPR0: asmgen.
Hint Resolve ireg_of_not_GPR0': asmgen.
(** Useful properties of the LR register *)
Hint Resolve preg_of_not_LR preg_notin_LR: asmgen.
(** Useful simplification tactic *)
Ltac Simplif :=
((rewrite nextinstr_inv by eauto with asmgen)
|| (rewrite nextinstr_inv2 by eauto with asmgen)
|| (rewrite Pregmap.gss)
|| (rewrite nextinstr_pc)
|| (rewrite Pregmap.gso by eauto with asmgen)); auto with asmgen.
Ltac Simpl := repeat Simplif.
(** Useful properties of pointer addition *)

Lemma storev_offset_ptr:
forall chunk m a delta v m',
Mem.storev chunk m (Val.offset_ptr a delta) v = Some m' ->
Mem.storev chunk m (Val.add a (Vint (Ptrofs.to_int delta))) v = Some m'.