Skip to content

Commit 3ddba6b

Browse files
committed
Compiler: more debug in compile_decision_tree
1 parent f8eef41 commit 3ddba6b

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

compiler/lib/generate.ml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,12 +1781,22 @@ and colapse_frontier name st (new_frontier' : Addr.Set.t) interm =
17811781
, interm
17821782
, Some (a, branch) )
17831783

1784-
and compile_decision_tree st loop_stack backs frontier interm loc cx dtree =
1784+
and compile_decision_tree kind st loop_stack backs frontier interm loc cx dtree =
17851785
(* Some changes here may require corresponding changes
17861786
in function [DTree.fold_cont] above. *)
17871787
let rec loop cx : _ -> bool * _ = function
1788-
| DTree.Branch (_, cont) ->
1789-
if debug () then Format.eprintf "@[<hv 2>case {@;";
1788+
| DTree.Branch (l, cont) ->
1789+
if debug ()
1790+
then
1791+
Format.eprintf
1792+
"@[<hv 2>case %s(%a) {@;"
1793+
kind
1794+
Format.(
1795+
pp_print_list
1796+
~pp_sep:(fun fmt () -> Format.pp_print_string fmt ", ")
1797+
(fun fmt pc -> Format.fprintf fmt "%d" pc))
1798+
l;
1799+
17901800
let never, code = compile_branch st [] cont loop_stack backs frontier interm in
17911801
if debug () then Format.eprintf "}@]@;";
17921802
never, code
@@ -1905,6 +1915,7 @@ and compile_conditional st queue last loop_stack backs frontier interm =
19051915
let (_px, cx), queue = access_queue queue x in
19061916
let never, b =
19071917
compile_decision_tree
1918+
"Bool"
19081919
st
19091920
loop_stack
19101921
backs
@@ -1919,6 +1930,7 @@ and compile_conditional st queue last loop_stack backs frontier interm =
19191930
let (_px, cx), queue = access_queue queue x in
19201931
let never, code =
19211932
compile_decision_tree
1933+
"Tag"
19221934
st
19231935
loop_stack
19241936
backs
@@ -1933,6 +1945,7 @@ and compile_conditional st queue last loop_stack backs frontier interm =
19331945
let (_px, cx), queue = access_queue queue x in
19341946
let never, code =
19351947
compile_decision_tree
1948+
"Int"
19361949
st
19371950
loop_stack
19381951
backs
@@ -1948,6 +1961,7 @@ and compile_conditional st queue last loop_stack backs frontier interm =
19481961
refer to it *)
19491962
let never1, b1 =
19501963
compile_decision_tree
1964+
"Int"
19511965
st
19521966
loop_stack
19531967
backs
@@ -1959,6 +1973,7 @@ and compile_conditional st queue last loop_stack backs frontier interm =
19591973
in
19601974
let never2, b2 =
19611975
compile_decision_tree
1976+
"Tag"
19621977
st
19631978
loop_stack
19641979
backs

0 commit comments

Comments
 (0)