aboutsummaryrefslogtreecommitdiffstats
path: root/backend/CSE3analysis.v
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-12-09 11:34:35 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-12-09 11:34:35 +0100
commit79c039d7b33878d00f22ad8542dc30a78aa8b70a (patch)
tree21f23b7ba1dff669281f618fc9aaadd91654908c /backend/CSE3analysis.v
parenta0529ae7a4eb991c39f258a8dbc003dd83ad3d36 (diff)
downloadcompcert-kvx-79c039d7b33878d00f22ad8542dc30a78aa8b70a.tar.gz
compcert-kvx-79c039d7b33878d00f22ad8542dc30a78aa8b70a.zip
CSE3 + conditions proof
Diffstat (limited to 'backend/CSE3analysis.v')
-rw-r--r--backend/CSE3analysis.v25
1 files changed, 24 insertions, 1 deletions
diff --git a/backend/CSE3analysis.v b/backend/CSE3analysis.v
index 46ae4aea..383147bb 100644
--- a/backend/CSE3analysis.v
+++ b/backend/CSE3analysis.v
@@ -461,10 +461,33 @@ Section OPERATIONS.
| _ => rel
end.
+ Definition apply_cond1 cond args (rel : RELATION.t) : RB.t :=
+ match eq_find (Cond (negate_condition cond) args) with
+ | Some eq_id =>
+ if PSet.contains rel eq_id
+ then RB.bot
+ else Some rel
+ | None => Some rel
+ end.
+
+ Definition apply_cond0 cond args (rel : RELATION.t) : RELATION.t :=
+ match eq_find (Cond cond args) with
+ | Some eq_id => PSet.add eq_id rel
+ | None => rel
+ end.
+
+ Definition apply_cond cond args (rel : RELATION.t) : RB.t :=
+ match apply_cond1 cond args rel with
+ | Some rel => Some (apply_cond0 cond args rel)
+ | None => RB.bot
+ end.
+
Definition apply_instr (tenv : typing_env) (instr : RTL.instruction) (rel : RELATION.t) : list (node * RB.t) :=
match instr with
| Inop pc' => (pc', (Some rel))::nil
- | Icond _ _ ifso ifnot _ => (ifso, (Some rel))::(ifnot, (Some rel))::nil
+ | Icond cond args ifso ifnot _ =>
+ (ifso, (apply_cond cond args rel))::
+ (ifnot, (apply_cond (negate_condition cond) args rel))::nil
| Ijumptable _ targets => List.map (fun pc' => (pc', (Some rel))) targets
| Istore chunk addr args src pc' =>
(pc', (Some (store tenv chunk addr args src rel)))::nil