diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2020-11-05 12:35:07 +0100 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2020-11-05 12:35:07 +0100 |
commit | 362bdda28ca3c4dcc992575cbbe9400b64425990 (patch) | |
tree | af518c157166bc2f802c0b60e158f36b48a17a13 /backend/LICMaux.ml | |
parent | 160c4ae21cdc86e26850ed0bdec8d95ca23c57db (diff) | |
download | compcert-kvx-362bdda28ca3c4dcc992575cbbe9400b64425990.tar.gz compcert-kvx-362bdda28ca3c4dcc992575cbbe9400b64425990.zip |
Fixing issue with loops having branches leading to goto backedge
Diffstat (limited to 'backend/LICMaux.ml')
-rw-r--r-- | backend/LICMaux.ml | 14 |
1 files changed, 14 insertions, 0 deletions
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 |