diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2020-03-23 16:32:23 +0100 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2020-03-23 16:32:23 +0100 |
commit | 1033c2a0ffefc336c343888e1abda02d7a1db228 (patch) | |
tree | e33f940dc67995eb05b3d4b4a02e31921c1a5bd0 | |
parent | 87b17fa1912da24ba114a181d1fbd1779d33e835 (diff) | |
download | compcert-kvx-1033c2a0ffefc336c343888e1abda02d7a1db228.tar.gz compcert-kvx-1033c2a0ffefc336c343888e1abda02d7a1db228.zip |
Removing store heuristic and more fine tuning loop heuristic
-rw-r--r-- | backend/Duplicateaux.ml | 12 | ||||
-rw-r--r-- | backend/Linearizeaux.ml | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml index b9f5cdf2..9ee082ea 100644 --- a/backend/Duplicateaux.ml +++ b/backend/Duplicateaux.ml @@ -195,12 +195,16 @@ let do_store_heuristic code cond ifso ifnot is_loop_header = let do_loop_heuristic code cond ifso ifnot is_loop_header = begin Printf.printf "\tLoop heuristic..\n"; - let predicate n = get_some @@ PTree.get n is_loop_header - in if (look_ahead code ifso is_loop_header predicate) then Some true - else if (look_ahead code ifnot is_loop_header predicate) then Some false + let predicate n = get_some @@ PTree.get n is_loop_header in + let ifso_loop = look_ahead code ifso is_loop_header predicate in + let ifnot_loop = look_ahead code ifnot is_loop_header predicate in + if ifso_loop && ifnot_loop then None (* TODO - take the innermost loop ? *) + else if ifso_loop then Some true + else if ifnot_loop then Some false else None end + (* Remark - compared to the original paper, we don't use the store heuristic *) let get_directions code entrypoint = begin Printf.printf "get_directions\n"; flush stdout; let bfs_order = bfs code entrypoint @@ -214,7 +218,7 @@ let get_directions code entrypoint = begin | Icond (cond, lr, ifso, ifnot, _) -> (* Printf.printf "Analyzing %d.." (P.to_int n); *) let heuristics = [ do_call_heuristic; do_opcode_heuristic; - do_return_heuristic; do_store_heuristic; do_loop_heuristic ] in + do_return_heuristic; do_loop_heuristic; (* do_store_heuristic *) ] in let preferred = ref None in begin Printf.printf "Deciding condition for RTL node %d\n" (P.to_int n); diff --git a/backend/Linearizeaux.ml b/backend/Linearizeaux.ml index 23ced4c2..e68a9b9a 100644 --- a/backend/Linearizeaux.ml +++ b/backend/Linearizeaux.ml @@ -154,7 +154,7 @@ let forward_sequences code entry = let visited = ref (PTree.map (fun n i -> false) code) in (* returns the list of traversed nodes, and a list of nodes to start traversing next *) let rec traverse_fallthrough code node = - Printf.printf "Traversing %d..\n" (P.to_int node); + (* Printf.printf "Traversing %d..\n" (P.to_int node); *) if not (get_some @@ PTree.get node !visited) then begin visited := PTree.set node true !visited; match PTree.get node code with |