aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Duplicateaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-10-02 17:53:54 +0200
committerCyril SIX <cyril.six@kalray.eu>2020-10-02 17:53:54 +0200
commit95f5523261c3cbc246be62c715d37cfac14beea7 (patch)
treebb8db6e514c330d89fa6c7f909efa707b0083a00 /backend/Duplicateaux.ml
parenta805c02949d16ae5794c2661f8a3157105a1982b (diff)
downloadcompcert-kvx-95f5523261c3cbc246be62c715d37cfac14beea7.tar.gz
compcert-kvx-95f5523261c3cbc246be62c715d37cfac14beea7.zip
Rewriting some print to use a oc argument
Diffstat (limited to 'backend/Duplicateaux.ml')
-rw-r--r--backend/Duplicateaux.ml27
1 files changed, 11 insertions, 16 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index 33b033c9..fc16d5ce 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -78,15 +78,13 @@ end
module PSet = Set.Make(PInt)
-let print_intlist l =
- let rec f = function
+let print_intlist oc l =
+ let rec f oc = function
| [] -> ()
- | n::ln -> (Printf.printf "%d " (P.to_int n); f ln)
+ | n::ln -> (Printf.fprintf oc "%d %a" (P.to_int n) f ln)
in begin
if !debug_flag then begin
- Printf.printf "[";
- f l;
- Printf.printf "]"
+ Printf.fprintf oc "[%a]" f l
end
end
@@ -387,18 +385,15 @@ let best_predecessor_of node predecessors code order is_visited =
) order)
with Not_found -> None
-let print_trace t = print_intlist t
+let print_trace = print_intlist
-let print_traces traces =
- let rec f = function
+let print_traces oc traces =
+ let rec f oc = function
| [] -> ()
- | t::lt -> Printf.printf "\n\t"; print_trace t; Printf.printf ",\n"; f lt
+ | t::lt -> Printf.fprintf oc "\n\t%a,\n%a" print_trace t f lt
in begin
- if !debug_flag then begin
- Printf.printf "Traces: {";
- f traces;
- Printf.printf "}\n";
- end
+ if !debug_flag then
+ Printf.fprintf oc "Traces: {%a}\n" f traces
end
(* Dumb (but linear) trace selection *)
@@ -473,7 +468,7 @@ let select_traces_chang code entrypoint = begin
end
done;
(* debug "DFS: \t"; print_intlist order; debug "\n"; *)
- debug "Traces: "; print_traces !traces;
+ debug "Traces: %a" print_traces !traces;
!traces
end
end