diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-10 19:56:30 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-10 19:56:30 +0100 |
commit | 59413cb4018d09fb3b641a49ab062bc933d5274c (patch) | |
tree | 5599db40a806497089df856604d5917ea5549ea1 /backend/CSE3analysisaux.ml | |
parent | 76c887ad132aa7b0c7ac72dca5d56e4c2bf1747a (diff) | |
download | compcert-kvx-59413cb4018d09fb3b641a49ab062bc933d5274c.tar.gz compcert-kvx-59413cb4018d09fb3b641a49ab062bc933d5274c.zip |
starts compiling but still fake
Diffstat (limited to 'backend/CSE3analysisaux.ml')
-rw-r--r-- | backend/CSE3analysisaux.ml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/backend/CSE3analysisaux.ml b/backend/CSE3analysisaux.ml new file mode 100644 index 00000000..26f19fd6 --- /dev/null +++ b/backend/CSE3analysisaux.ml @@ -0,0 +1,36 @@ +open CSE3analysis +open Maps +open HashedSet +open Camlcoq + +let flatten_eq eq = + ((P.to_int eq.eq_lhs), eq.eq_op, List.map P.to_int eq.eq_args);; + +let preanalysis (f : RTL.coq_function) = + let cur_eq_id = ref 0 + and cur_catalog = ref PTree.empty + and eq_table = Hashtbl.create 100 + and rhs_table = Hashtbl.create 100 + and cur_kill_reg = ref (PMap.init PSet.empty) + and cur_kill_mem = ref PSet.empty + and cur_moves = ref (PMap.init PSet.empty) in + let eq_find_oracle node eq = + Hashtbl.find_opt eq_table (flatten_eq eq) + and rhs_find_oracle node sop args = + match Hashtbl.find_opt rhs_table (sop, List.map P.to_int args) with + | None -> PSet.empty + | Some s -> s in + let mutating_eq_find_oracle node eq = + incr cur_eq_id; None in (* FIXME *) + ignore + (internal_analysis + { eq_catalog = (fun eq_id -> PTree.get eq_id !cur_catalog); + eq_find_oracle = mutating_eq_find_oracle; + eq_rhs_oracle = rhs_find_oracle ; + eq_kill_reg = (fun reg -> PMap.get reg !cur_kill_reg); + eq_kill_mem = (fun () -> !cur_kill_mem); + eq_moves = (fun reg -> PMap.get reg !cur_moves) + } f); + { hint_eq_catalog = !cur_catalog; + hint_eq_find_oracle= eq_find_oracle; + hint_eq_rhs_oracle = rhs_find_oracle };; |