From 362bdda28ca3c4dcc992575cbbe9400b64425990 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Nov 2020 12:35:07 +0100 Subject: Fixing issue with loops having branches leading to goto backedge --- backend/LICMaux.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'backend/LICMaux.ml') diff --git a/backend/LICMaux.ml b/backend/LICMaux.ml index bf6418e8..6283e129 100644 --- a/backend/LICMaux.ml +++ b/backend/LICMaux.ml @@ -61,6 +61,20 @@ let print_intlist oc 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 -- cgit