diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-20 12:07:40 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-20 12:07:40 +0100 |
commit | e265be77756b14b1d830a0d0faf1b105494bbb43 (patch) | |
tree | 1718f6cbed4670522763409e4abc7c4bbb3e4108 /kvx | |
parent | fc9d9ffcf9157d4e84473a209e360ddc2210f95d (diff) | |
parent | eb1121d703835e76babc15b057276d2852ade4ab (diff) | |
download | compcert-kvx-e265be77756b14b1d830a0d0faf1b105494bbb43.tar.gz compcert-kvx-e265be77756b14b1d830a0d0faf1b105494bbb43.zip |
Conditions now propagated by CSE3
Merge remote-tracking branch 'origin/kvx-better2-cse3' into kvx-work
Diffstat (limited to 'kvx')
-rw-r--r-- | kvx/Op.v | 49 |
1 files changed, 36 insertions, 13 deletions
@@ -1205,12 +1205,25 @@ Definition is_trivial_op (op: operation) : bool := (** Operations that depend on the memory state. *) +Definition cond_depends_on_memory (c: condition) : bool := + match c with + | Ccompu _ | Ccompuimm _ _ => negb Archi.ptr64 + | Ccomplu _ | Ccompluimm _ _ => Archi.ptr64 + | _ => false + end. + +Lemma cond_depends_on_memory_correct: + forall c args m1 m2, + cond_depends_on_memory c = false -> + eval_condition c args m1 = eval_condition c args m2. +Proof. + intros; destruct c; cbn; discriminate || reflexivity. +Qed. + Definition op_depends_on_memory (op: operation) : bool := match op with - | Ocmp (Ccompu _) => negb Archi.ptr64 - | Ocmp (Ccompuimm _ _) => negb Archi.ptr64 - | Ocmp (Ccomplu _) => Archi.ptr64 - | Ocmp (Ccompluimm _ _) => Archi.ptr64 + | Ocmp (Ccompu _ | Ccompuimm _ _) => negb Archi.ptr64 + | Ocmp (Ccomplu _ | Ccompluimm _ _) => Archi.ptr64 | Osel (Ccompu0 _) _ | Oselimm (Ccompu0 _) _ | Osellimm (Ccompu0 _) _ => negb Archi.ptr64 | Osel (Ccomplu0 _) _ | Oselimm (Ccomplu0 _) _ | Osellimm (Ccomplu0 _) _ => Archi.ptr64 @@ -1238,23 +1251,33 @@ Proof. unfold Val.cmpu_bool, Val.cmplu_bool; rewrite SF; reflexivity. Qed. +Lemma cond_valid_pointer_eq: + forall cond args m1 m2, + (forall b z, Mem.valid_pointer m1 b z = Mem.valid_pointer m2 b z) -> + eval_condition cond args m1 = eval_condition cond args m2. +Proof. + intros until m2. intro MEM. destruct cond eqn:COND; simpl; try congruence. + all: repeat (destruct args; simpl; try congruence); + erewrite cmpu_bool_valid_pointer_eq || erewrite cmplu_bool_valid_pointer_eq; eauto. +Qed. + Lemma op_valid_pointer_eq: forall (F V: Type) (ge: Genv.t F V) sp op args m1 m2, (forall b z, Mem.valid_pointer m1 b z = Mem.valid_pointer m2 b z) -> eval_operation ge sp op args m1 = eval_operation ge sp op args m2. Proof. - intros until m2. destruct op; simpl; try congruence. - - intros MEM; destruct cond; simpl; try congruence; - repeat (destruct args; simpl; try congruence); + intros until m2. destruct op; cbn; try congruence. + - intros MEM; destruct cond; cbn; try congruence; + repeat (destruct args; cbn; try congruence); erewrite cmpu_bool_valid_pointer_eq || erewrite cmplu_bool_valid_pointer_eq; eauto. - - intros MEM; destruct c0; simpl; try congruence; - repeat (destruct args; simpl; try congruence); + - intros MEM; destruct c0; cbn; try congruence; + repeat (destruct args; cbn; try congruence); erewrite cmpu_bool_valid_pointer_eq || erewrite cmplu_bool_valid_pointer_eq; eauto. - - intros MEM; destruct c0; simpl; try congruence; - repeat (destruct args; simpl; try congruence); + - intros MEM; destruct c0; cbn; try congruence; + repeat (destruct args; cbn; try congruence); erewrite cmpu_bool_valid_pointer_eq || erewrite cmplu_bool_valid_pointer_eq; eauto. - - intros MEM; destruct c0; simpl; try congruence; - repeat (destruct args; simpl; try congruence); + - intros MEM; destruct c0; cbn; try congruence; + repeat (destruct args; cbn; try congruence); erewrite cmpu_bool_valid_pointer_eq || erewrite cmplu_bool_valid_pointer_eq; eauto. Qed. |