aboutsummaryrefslogtreecommitdiffstats
path: root/backend/LICMaux.ml
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-12-17 17:32:40 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-12-17 17:33:02 +0100
commit3ee2cd9ee1d4a7f0c3f55b881e79025a29f382e7 (patch)
tree9b61ac8c991d6c6a14f3cf7c06111827f8b8af45 /backend/LICMaux.ml
parent5cde069e26618913905f4a8b64701b93bece5038 (diff)
downloadcompcert-kvx-3ee2cd9ee1d4a7f0c3f55b881e79025a29f382e7.tar.gz
compcert-kvx-3ee2cd9ee1d4a7f0c3f55b881e79025a29f382e7.zip
Uniformizing a couple of debug print functions
Diffstat (limited to 'backend/LICMaux.ml')
-rw-r--r--backend/LICMaux.ml43
1 files changed, 1 insertions, 42 deletions
diff --git a/backend/LICMaux.ml b/backend/LICMaux.ml
index df98077b..1f6b8817 100644
--- a/backend/LICMaux.ml
+++ b/backend/LICMaux.ml
@@ -16,16 +16,11 @@ open Maps;;
open Kildall;;
open HashedSet;;
open Inject;;
+open DebugPrint;;
type reg = P.t;;
(** get_loop_headers moved from Duplicateaux.ml to LICMaux.ml to prevent cycle dependencies *)
-let debug_flag = ref false
-
-let debug fmt =
- if !debug_flag then (flush stderr; Printf.eprintf fmt)
- else Printf.ifprintf stderr fmt
-
type vstate = Unvisited | Processed | Visited
let get_some = function
@@ -39,42 +34,6 @@ let rtl_successors = function
| Icond (_,_,n1,n2,_) -> [n1; n2]
| Ijumptable (_,ln) -> ln
-let print_ptree_bool oc pt =
- if !debug_flag then
- let elements = PTree.elements pt in
- begin
- Printf.fprintf oc "[";
- List.iter (fun (n, b) ->
- if b then Printf.fprintf oc "%d, " (P.to_int n)
- ) elements;
- Printf.fprintf oc "]\n"
- end
- else ()
-
-let print_intlist oc l =
- let rec f oc = function
- | [] -> ()
- | n::ln -> (Printf.fprintf oc "%d %a" (P.to_int n) f ln)
- in begin
- if !debug_flag then begin
- Printf.fprintf oc "[%a]" f l
- end
- end
-
-(* Adapted from backend/PrintRTL.ml: print_function *)
-let print_code code = let open PrintRTL in let open Printf in
- if (!debug_flag) then begin
- fprintf stdout "{\n";
- let instrs =
- List.sort
- (fun (pc1, _) (pc2, _) -> compare pc2 pc1)
- (List.rev_map
- (fun (pc, i) -> (P.to_int pc, i))
- (PTree.elements code)) in
- List.iter (print_instruction stdout) instrs;
- fprintf stdout "}"
- end
-
(** Getting loop branches with a DFS visit :
* Each node is either Unvisited, Visited, or Processed
* pre-order: node becomes Processed