aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-02-27 05:45:13 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-02-27 05:45:13 +0100
commit222c9047d61961db9c6b19fed5ca49829223fd33 (patch)
tree70350802e58091cf90560060f1775148124bc0d0
parenta5e20ecb933a1dc12bae3e4eeb330e86f13832d8 (diff)
downloadcompcert-kvx-222c9047d61961db9c6b19fed5ca49829223fd33.tar.gz
compcert-kvx-222c9047d61961db9c6b19fed5ca49829223fd33.zip
CSE2 now uses is_trivial_op
-rw-r--r--backend/CSE2.v2
-rw-r--r--backend/CSE2proof.v23
2 files changed, 22 insertions, 3 deletions
diff --git a/backend/CSE2.v b/backend/CSE2.v
index 1e3bc3b7..19b633b0 100644
--- a/backend/CSE2.v
+++ b/backend/CSE2.v
@@ -525,7 +525,7 @@ Definition transf_instr (fmap : option (PMap.t RB.t))
match instr with
| Iop op args dst s =>
let args' := subst_args fmap pc args in
- match find_op_in_fmap fmap pc op args' with
+ match (if is_trivial_op op then None else find_op_in_fmap fmap pc op args') with
| None => Iop op args' dst s
| Some src => Iop Omove (src::nil) dst s
end
diff --git a/backend/CSE2proof.v b/backend/CSE2proof.v
index 0b92f5e5..eb4268f0 100644
--- a/backend/CSE2proof.v
+++ b/backend/CSE2proof.v
@@ -1401,6 +1401,24 @@ Proof.
Qed.
Hint Resolve wellformed_mem_mpc : wellformed.
+Lemma match_same_option :
+ forall { A B : Type},
+ forall x : option A,
+ forall y : B,
+ (match x with Some _ => y | None => y end) = y.
+Proof.
+ destruct x; trivial.
+Qed.
+
+Lemma match_same_bool :
+ forall { B : Type},
+ forall x : bool,
+ forall y : B,
+ (if x then y else y) = y.
+Proof.
+ destruct x; trivial.
+Qed.
+
Lemma step_simulation:
forall S1 t S2, RTL.step ge S1 t S2 ->
forall S1', match_states S1 S1' ->
@@ -1428,8 +1446,9 @@ Proof.
reflexivity.
- (* op *)
unfold transf_instr in *.
- destruct find_op_in_fmap eqn:FIND_OP.
+ destruct (if is_trivial_op op then None else find_op_in_fmap (forward_map f) pc op (subst_args (forward_map f) pc args)) eqn:FIND_OP.
{
+ destruct is_trivial_op. discriminate.
unfold find_op_in_fmap, fmap_sem', fmap_sem in *.
destruct (forward_map f) as [map |] eqn:MAP.
2: discriminate.
@@ -1846,4 +1865,4 @@ Proof.
exact step_simulation.
Qed.
-End PRESERVATION. \ No newline at end of file
+End PRESERVATION.