aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Linearizeaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-03-10 15:41:05 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-03-10 15:41:05 +0100
commita7098538edfda9fdbd95bc7c6ba6e380811230fa (patch)
tree4fb0069cfebdec8a451825047574821cfd9e9695 /backend/Linearizeaux.ml
parent9a86085b2226905e8cf14b600f2069202c5d12bd (diff)
downloadcompcert-kvx-a7098538edfda9fdbd95bc7c6ba6e380811230fa.tar.gz
compcert-kvx-a7098538edfda9fdbd95bc7c6ba6e380811230fa.zip
Linearizeaux, forgot to visit the rest of the nodes in dfs_visit
Diffstat (limited to 'backend/Linearizeaux.ml')
-rw-r--r--backend/Linearizeaux.ml48
1 files changed, 26 insertions, 22 deletions
diff --git a/backend/Linearizeaux.ml b/backend/Linearizeaux.ml
index 3602cb91..5bdeeb8f 100644
--- a/backend/Linearizeaux.ml
+++ b/backend/Linearizeaux.ml
@@ -350,6 +350,7 @@ let construct_depmap code entry fs =
!index
end
in let check_and_update_depmap from target =
+ (* Printf.printf "From %d to %d\n" (P.to_int from) (P.to_int target); *)
if not (ppmap_is_true (from, target) is_loop_edge) then
let in_index_fs = find_index_of_node from in
let out_index_fs = find_index_of_node target in
@@ -360,28 +361,31 @@ let construct_depmap code entry fs =
in let rec dfs_visit code = function
| [] -> ()
| node :: ln ->
- match (get_some @@ PTree.get node !visited) with
- | true -> ()
- | false -> begin
- visited := PTree.set node true !visited;
- let bb = get_some @@ PTree.get node code in
- let next_visits =
- match (last_element bb) with
- | Ltailcall _ | Lreturn -> []
- | Lbranch n -> (check_and_update_depmap node n; [n])
- | Lcond (_, _, ifso, ifnot) -> begin
- check_and_update_depmap node ifso;
- check_and_update_depmap node ifnot;
- [ifso; ifnot]
- end
- | Ljumptable(_, ln) -> begin
- List.iter (fun n -> check_and_update_depmap node n) ln;
- ln
- end
- (* end of bblocks should not be another value than one of the above *)
- | _ -> failwith "last_element gave an invalid output"
- in dfs_visit code next_visits
- end
+ begin
+ match (get_some @@ PTree.get node !visited) with
+ | true -> ()
+ | false -> begin
+ visited := PTree.set node true !visited;
+ let bb = get_some @@ PTree.get node code in
+ let next_visits =
+ match (last_element bb) with
+ | Ltailcall _ | Lreturn -> []
+ | Lbranch n -> (check_and_update_depmap node n; [n])
+ | Lcond (_, _, ifso, ifnot) -> begin
+ check_and_update_depmap node ifso;
+ check_and_update_depmap node ifnot;
+ [ifso; ifnot]
+ end
+ | Ljumptable(_, ln) -> begin
+ List.iter (fun n -> check_and_update_depmap node n) ln;
+ ln
+ end
+ (* end of bblocks should not be another value than one of the above *)
+ | _ -> failwith "last_element gave an invalid output"
+ in dfs_visit code next_visits
+ end;
+ dfs_visit code ln
+ end
in begin
dfs_visit code [entry];
depmap