aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-11-26 16:24:01 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-11-26 16:24:01 +0100
commit3c670f954dc470333e94932279e02e6940ff9f15 (patch)
tree2cbe571ba6e62d3517551ff18d8fb0ce44591cfe /backend
parent01f0108df437df0792ac560f630e7969be76b60b (diff)
downloadcompcert-kvx-3c670f954dc470333e94932279e02e6940ff9f15.tar.gz
compcert-kvx-3c670f954dc470333e94932279e02e6940ff9f15.zip
is_condition_present_sound
Diffstat (limited to 'backend')
-rw-r--r--backend/CSE3analysis.v7
-rw-r--r--backend/CSE3analysisaux.ml5
-rw-r--r--backend/CSE3analysisproof.v16
3 files changed, 23 insertions, 5 deletions
diff --git a/backend/CSE3analysis.v b/backend/CSE3analysis.v
index 4b616568..390f6d26 100644
--- a/backend/CSE3analysis.v
+++ b/backend/CSE3analysis.v
@@ -290,6 +290,12 @@ Section OPERATIONS.
| None => None
end.
+ Definition is_condition_present
+ (rel : RELATION.t) (cond : condition) (args : list reg) :=
+ match eq_find (Cond cond args) with
+ | Some id => PSet.contains rel id
+ | None => false
+ end.
Definition rhs_find (sop : sym_op) (args : list reg) (rel : RELATION.t) : option reg :=
match pick_source (PSet.elements (PSet.inter (eq_rhs_oracle ctx no sop args) rel)) with
@@ -509,7 +515,6 @@ Definition internal_analysis
(f : RTL.function) : option invariants := DS.fixpoint
(RTL.fn_code f) RTL.successors_instr
(apply_instr' tenv (RTL.fn_code f)) (RTL.fn_entrypoint f) (Some RELATION.top).
-
End OPERATIONS.
Record analysis_hints :=
diff --git a/backend/CSE3analysisaux.ml b/backend/CSE3analysisaux.ml
index e8964090..1642a269 100644
--- a/backend/CSE3analysisaux.ml
+++ b/backend/CSE3analysisaux.ml
@@ -199,7 +199,6 @@ let preanalysis (tenv : typing_env) (f : RTL.coq_function) =
and cur_catalog = ref PTree.empty
and eq_table = Hashtbl.create 100
and rhs_table = Hashtbl.create 100
- and cond_table = Hashtbl.create 100
and cur_kill_reg = ref (PMap.init PSet.empty)
and cur_kill_mem = ref PSet.empty
and cur_kill_store = ref PSet.empty
@@ -239,9 +238,7 @@ let preanalysis (tenv : typing_env) (f : RTL.coq_function) =
| Flat_equ(flat_eq_lhs, flat_eq_op, flat_eq_args) ->
add_to_set_in_table rhs_table
(flat_eq_op, flat_eq_args) coq_id
- | Flat_cond(flat_eq_cond, flat_eq_args) ->
- add_to_set_in_table cond_table
- (flat_eq_cond, flat_eq_args) coq_id);
+ | Flat_cond(flat_eq_cond, flat_eq_args) -> ());
(match eq with
| Equ(lhs, sop, args) ->
List.iter
diff --git a/backend/CSE3analysisproof.v b/backend/CSE3analysisproof.v
index 228fec93..7e456748 100644
--- a/backend/CSE3analysisproof.v
+++ b/backend/CSE3analysisproof.v
@@ -831,6 +831,22 @@ Section SOUNDNESS.
Hint Resolve eq_find_sound : cse3.
+ Theorem is_condition_present_sound :
+ forall node rel cond args rs m
+ (REL : sem_rel rel rs m)
+ (COND : (is_condition_present (ctx := ctx) node rel cond args) = true),
+ (eval_condition cond (rs ## args) m) = Some true.
+ Proof.
+ unfold sem_rel, is_condition_present.
+ intros.
+ destruct eq_find as [i |] eqn:FIND.
+ 2: discriminate.
+ pose proof (eq_find_sound node (Cond cond args) i FIND) as CATALOG.
+ exact (REL i (Cond cond args) COND CATALOG).
+ Qed.
+
+ Hint Resolve is_condition_present_sound : cse3.
+
Theorem rhs_find_sound:
forall no sop args rel src rs m,
sem_rel rel rs m ->