aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-07-16 21:37:49 +0200
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-07-16 21:37:49 +0200
commitbd561273f2ff471f2d42552e20035b5ae5281453 (patch)
tree93c740bea36f56df1bd8affeb5f595d6e926119b /backend
parent73741034932cebf4138d867678dca117fd1c8acd (diff)
downloadcompcert-kvx-bd561273f2ff471f2d42552e20035b5ae5281453.tar.gz
compcert-kvx-bd561273f2ff471f2d42552e20035b5ae5281453.zip
make trivial ops parametric
Diffstat (limited to 'backend')
-rw-r--r--backend/CSE3.v9
-rw-r--r--backend/CSE3proof.v4
2 files changed, 7 insertions, 6 deletions
diff --git a/backend/CSE3.v b/backend/CSE3.v
index 6cb43085..21067720 100644
--- a/backend/CSE3.v
+++ b/backend/CSE3.v
@@ -24,6 +24,7 @@ Axiom preanalysis : typing_env -> RTL.function -> invariants * analysis_hints.
Record cse3params : Type :=
mkcse3params
{ cse3_conditions : bool;
+ cse3_trivial_ops : bool;
}.
Section PARAMS.
@@ -63,7 +64,7 @@ Definition subst_args fmap pc xl :=
forward_move_l_b (PMap.get pc fmap) xl.
Definition find_cond_in_fmap fmap pc cond args :=
- if cse3_conditions params
+ if params.(cse3_conditions)
then
match PMap.get pc fmap with
| Some rel =>
@@ -88,7 +89,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 (Compopts.optim_CSE3_trivial_ops tt)) && (is_trivial_op op)
+ match (if (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
@@ -142,7 +143,7 @@ Definition param_transf_program (p: program) : res program :=
End PARAMS.
Definition cmdline_params (_ : unit) :=
- mkcse3params
- (Compopts.optim_CSE3_conditions tt).
+ {| cse3_conditions := Compopts.optim_CSE3_conditions tt;
+ 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 1168374a..3568f770 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 (Compopts.optim_CSE3_trivial_ops tt)) && (is_trivial_op op)
+ * destruct (if (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 (Compopts.optim_CSE3_trivial_ops tt)) && (is_trivial_op op)). discriminate.
+ ** destruct ((negb (params.(cse3_trivial_ops))) && (is_trivial_op op)). discriminate.
apply exec_Iop with (op := Omove) (args := r :: nil).
TR_AT.
subst instr'.