From 6ee3ecb0edc17d61a515054952827c495cc03979 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 2 Apr 2021 11:41:41 +0200 Subject: Simple backedge detection (modified code from get_loop_headers) --- common/DebugPrint.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'common') diff --git a/common/DebugPrint.ml b/common/DebugPrint.ml index 64efe727..931dfdf4 100644 --- a/common/DebugPrint.ml +++ b/common/DebugPrint.ml @@ -20,6 +20,20 @@ let print_ptree_bool oc pt = end else () +let print_ptree_opint oc pt = + if !debug_flag then + let elements = PTree.elements pt in + begin + Printf.fprintf oc "["; + List.iter (fun (n, op) -> + match op with + | None -> () + | Some p -> Printf.fprintf oc "%d -> %d, " (P.to_int n) (P.to_int p) + ) elements; + Printf.fprintf oc "]\n" + end + else () + let print_intlist oc l = let rec f oc = function | [] -> () -- cgit From a4720c58a97c08b1f8852376c39f15dd44cd0f34 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 2 Apr 2021 13:06:02 +0200 Subject: Getting all loop bodies --- common/DebugPrint.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'common') diff --git a/common/DebugPrint.ml b/common/DebugPrint.ml index 931dfdf4..f68432d9 100644 --- a/common/DebugPrint.ml +++ b/common/DebugPrint.ml @@ -44,6 +44,20 @@ let print_intlist oc l = end end +let print_ptree_oplist oc pt = + if !debug_flag then + let elements = PTree.elements pt in + begin + Printf.fprintf oc "["; + List.iter (fun (n, ol) -> + match ol with + | None -> () + | Some l -> Printf.fprintf oc "%d -> %a,\n" (P.to_int n) print_intlist l + ) elements; + Printf.fprintf oc "]\n" + end + else () + (* Adapted from backend/PrintRTL.ml: print_function *) let print_code code = let open PrintRTL in let open Printf in if (!debug_flag) then begin -- cgit