From 7bcf7240186f670786c9daba0ffff768c180fd83 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 16 Jul 2021 21:52:22 +0200 Subject: make operations cse3 parametric --- backend/CSE3.v | 10 +++++++--- backend/CSE3proof.v | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'backend') diff --git a/backend/CSE3.v b/backend/CSE3.v index 21067720..54a8a3bc 100644 --- a/backend/CSE3.v +++ b/backend/CSE3.v @@ -24,7 +24,9 @@ Axiom preanalysis : typing_env -> RTL.function -> invariants * analysis_hints. Record cse3params : Type := mkcse3params { cse3_conditions : bool; - cse3_trivial_ops : bool; + cse3_operations : bool; + cse3_loads : bool; + cse3_trivial_ops: bool; }. Section PARAMS. @@ -89,7 +91,7 @@ Definition param_transf_instr (fmap : PMap.t RB.t) match instr with | Iop op args dst s => let args' := subst_args fmap pc args in - match (if (negb params.(cse3_trivial_ops)) && (is_trivial_op op) + match (if (negb params.(cse3_operations) || ((negb params.(cse3_trivial_ops)) && (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 @@ -144,6 +146,8 @@ End PARAMS. Definition cmdline_params (_ : unit) := {| cse3_conditions := Compopts.optim_CSE3_conditions tt; - cse3_trivial_ops := Compopts.optim_CSE3_trivial_ops tt |}. + cse3_operations := true; + cse3_loads := true; + cse3_trivial_ops:= Compopts.optim_CSE3_trivial_ops tt |}. Definition transf_program p := param_transf_program (cmdline_params tt) p. diff --git a/backend/CSE3proof.v b/backend/CSE3proof.v index 3568f770..a601d5d5 100644 --- a/backend/CSE3proof.v +++ b/backend/CSE3proof.v @@ -506,12 +506,12 @@ Proof. destruct (@PMap.get (option RELATION.t) pc) eqn:INV_PC. pose proof (rhs_find_sound (sp:=sp) (genv:=ge) (ctx:=(context_from_hints (snd (preanalysis tenv f)))) pc (SOp op) (subst_args (ctx:=(context_from_hints (snd (preanalysis tenv f)))) (fst (preanalysis tenv f)) pc args) t) as FIND_SOUND. - * destruct (if (negb (params.(cse3_trivial_ops))) && (is_trivial_op op) + * destruct (if (negb params.(cse3_operations) || (negb (params.(cse3_trivial_ops))) && (is_trivial_op op)) then None else rhs_find pc (SOp op) (subst_args (fst (preanalysis tenv f)) pc args) t) eqn:FIND. - ** destruct ((negb (params.(cse3_trivial_ops))) && (is_trivial_op op)). discriminate. + ** destruct (negb params.(cse3_operations) || ((negb (params.(cse3_trivial_ops))) && (is_trivial_op op))). discriminate. apply exec_Iop with (op := Omove) (args := r :: nil). TR_AT. subst instr'. @@ -985,7 +985,7 @@ Proof. unfold find_cond_in_fmap in FIND_COND. change (@PMap.get (option RELATION.t)) with (@Regmap.get RB.t) in FIND_COND. rewrite FIND_REL in FIND_COND. - destruct (cse3_conditions params). + destruct (params.(cse3_conditions)). 2: discriminate. destruct (is_condition_present pc rel cond args). { rewrite COND_PRESENT_TRUE in H0 by trivial. -- cgit