diff options
Diffstat (limited to 'scheduling/RTLpathLivegenaux.ml')
-rw-r--r-- | scheduling/RTLpathLivegenaux.ml | 58 |
1 files changed, 13 insertions, 45 deletions
diff --git a/scheduling/RTLpathLivegenaux.ml b/scheduling/RTLpathLivegenaux.ml index 765aa55f..ab921954 100644 --- a/scheduling/RTLpathLivegenaux.ml +++ b/scheduling/RTLpathLivegenaux.ml @@ -6,15 +6,7 @@ open Camlcoq open Datatypes open Kildall open Lattice - -let debug_flag = ref false - -let dprintf fmt = let open Printf in begin - flush stdout; - match !debug_flag with - | true -> printf fmt - | false -> ifprintf stdout fmt -end +open DebugPrint let get_some = function | None -> failwith "Got None instead of Some _" @@ -124,22 +116,6 @@ let get_path_map code entry join_points = !path_map end -let print_regset rs = begin - dprintf "["; - List.iter (fun n -> dprintf "%d " (P.to_int n)) (Regset.elements rs); - dprintf "]" -end - -let print_ptree_regset pt = begin - dprintf "["; - List.iter (fun (n, rs) -> - dprintf "\n\t"; - dprintf "%d: " (P.to_int n); - print_regset rs - ) (PTree.elements pt); - dprintf "]" -end - let transfer f pc after = let open Liveness in match PTree.get pc f.fn_code with | Some i -> @@ -259,7 +235,7 @@ let set_pathmap_liveness f pm = let new_pm = ref PTree.empty in let code = f.fn_code in begin - dprintf "Liveness: "; print_ptree_regset liveness; dprintf "\n"; + debug "Liveness: "; print_ptree_regset liveness; debug "\n"; List.iter (fun (n, pi) -> let inputs = get_some @@ PTree.get n liveness in let outputs = get_outputs liveness code n pi in @@ -269,31 +245,23 @@ let set_pathmap_liveness f pm = !new_pm end -let print_true_nodes booltree = begin - dprintf "["; - List.iter (fun (n,b) -> - if b then dprintf "%d " (P.to_int n) - ) (PTree.elements booltree); - dprintf "]"; -end - let print_path_info pi = begin - dprintf "(psize=%d; " (Camlcoq.Nat.to_int pi.psize); - dprintf "input_regs="; + debug "(psize=%d; " (Camlcoq.Nat.to_int pi.psize); + debug "input_regs="; print_regset pi.input_regs; - dprintf "; output_regs="; + debug "; output_regs="; print_regset pi.output_regs; - dprintf ")" + debug ")" end let print_path_map path_map = begin - dprintf "["; + debug "["; List.iter (fun (n,pi) -> - dprintf "\n\t"; - dprintf "%d: " (P.to_int n); + debug "\n\t"; + debug "%d: " (P.to_int n); print_path_info pi ) (PTree.elements path_map); - dprintf "]" + debug "]" end let build_path_map f = @@ -302,10 +270,10 @@ let build_path_map f = let join_points = get_join_points code entry in let path_map = set_pathmap_liveness f @@ get_path_map code entry join_points in begin - dprintf "Join points: "; + debug "Join points: "; print_true_nodes join_points; - dprintf "\nPath map: "; + debug "\nPath map: "; print_path_map path_map; - dprintf "\n"; + debug "\n"; path_map end |