aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-10-27 15:57:40 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-10-27 15:57:40 +0100
commit9bb6fd8219fcd4ef8da5d2b3a6d93f802fc777c3 (patch)
tree9a4cfa565cf3ca9abf32011400e3cb225e31787d /tools
parentdbb5f576ced7ec3acccc08edd4ca85bb316194a2 (diff)
downloadcompcert-kvx-9bb6fd8219fcd4ef8da5d2b3a6d93f802fc777c3.tar.gz
compcert-kvx-9bb6fd8219fcd4ef8da5d2b3a6d93f802fc777c3.zip
Splitting Duplicate in several passes
Diffstat (limited to 'tools')
-rw-r--r--tools/compiler_expand.ml91
1 files changed, 51 insertions, 40 deletions
diff --git a/tools/compiler_expand.ml b/tools/compiler_expand.ml
index e5cab30c..c714cdce 100644
--- a/tools/compiler_expand.ml
+++ b/tools/compiler_expand.ml
@@ -11,65 +11,76 @@ David Monniaux, CNRS, VERIMAG
type is_partial = TOTAL | PARTIAL;;
type print_result = Noprint | Print of string;;
type when_triggered = Always | Option of string;;
+type needs_require = Require | NoRequire;;
+(* FIXME - The gestion of NoRequire is a bit ugly right now. *)
let rtl_passes =
[|
-TOTAL, (Option "optim_tailcalls"), (Some "Tail calls"), "Tailcall";
-PARTIAL, Always, (Some "Inlining"), "Inlining";
-TOTAL, (Option "profile_arcs"), (Some "Profiling insertion"), "Profiling";
-TOTAL, (Option "branch_probabilities"), (Some "Profiling use"), "ProfilingExploit";
-TOTAL, (Option "optim_move_loop_invariants"), (Some "Inserting initial nop"), "FirstNop";
-TOTAL, Always, (Some "Renumbering"), "Renumber";
-PARTIAL, (Option "optim_CSE"), (Some "CSE"), "CSE";
-PARTIAL, Always, (Some "Duplicating blocks"), "Duplicate";
-TOTAL, Always, (Some "Renumbering pre constprop"), "Renumber";
-TOTAL, (Option "optim_constprop"), (Some "Constant propagation"), "Constprop";
-TOTAL, Always, (Some "Renumbering pre CSE"), "Renumber";
-TOTAL, (Option "optim_CSE2"), (Some "CSE2"), "CSE2";
-PARTIAL, (Option "optim_CSE3"), (Some "CSE3"), "CSE3";
-TOTAL, (Option "optim_CSE3"), (Some "Kill useless moves after CSE3"), "KillUselessMoves";
-TOTAL, (Option "optim_forward_moves"), (Some "Forwarding moves"), "ForwardMoves";
-PARTIAL, (Option "optim_redundancy"), (Some "Redundancy elimination"), "Deadcode";
-PARTIAL, (Option "optim_move_loop_invariants"), (Some "LICM"), "LICM";
-TOTAL, (Option "optim_move_loop_invariants"), (Some "Renumbering for LICM"), "Renumber";
-PARTIAL, (Option "optim_move_loop_invariants"), (Some "CSE3 for LICM"), "CSE3";
-PARTIAL, (Option "optim_move_loop_invariants"), (Some "Redundancy elimination for LICM"), "Deadcode";
-TOTAL, (Option "all_loads_nontrap"), None, "Allnontrap";
-PARTIAL, Always, (Some "Unused globals"), "Unusedglob"
+TOTAL, (Option "optim_tailcalls"), Require, (Some "Tail calls"), "Tailcall";
+PARTIAL, Always, Require, (Some "Inlining"), "Inlining";
+TOTAL, (Option "profile_arcs"), Require, (Some "Profiling insertion"), "Profiling";
+TOTAL, (Option "branch_probabilities"), Require, (Some "Profiling use"), "ProfilingExploit";
+TOTAL, (Option "optim_move_loop_invariants"), Require, (Some "Inserting initial nop"), "FirstNop";
+TOTAL, Always, Require, (Some "Renumbering"), "Renumber";
+PARTIAL, (Option "optim_CSE"), Require, (Some "CSE"), "CSE";
+PARTIAL, Always, NoRequire, (Some "Static Prediction + inverting conditions"), "Staticpredict";
+PARTIAL, Always, NoRequire, (Some "Unrolling one iteration out of innermost loops"), "Unrollsingle";
+TOTAL, Always, Require, (Some "Renumbering pre constprop"), "Renumber";
+PARTIAL, Always, NoRequire, (Some "Unrolling the body of innermost loops"), "Unrollbody";
+TOTAL, Always, NoRequire, (Some "Renumbering pre constprop"), "Renumber";
+PARTIAL, Always, NoRequire, (Some "Performing tail duplication"), "Tailduplicate";
+TOTAL, Always, NoRequire, (Some "Renumbering pre constprop"), "Renumber";
+TOTAL, (Option "optim_constprop"), Require, (Some "Constant propagation"), "Constprop";
+TOTAL, Always, NoRequire, (Some "Renumbering pre CSE"), "Renumber";
+TOTAL, (Option "optim_CSE2"), Require, (Some "CSE2"), "CSE2";
+PARTIAL, (Option "optim_CSE3"), Require, (Some "CSE3"), "CSE3";
+TOTAL, (Option "optim_CSE3"), Require, (Some "Kill useless moves after CSE3"), "KillUselessMoves";
+TOTAL, (Option "optim_forward_moves"), Require, (Some "Forwarding moves"), "ForwardMoves";
+PARTIAL, (Option "optim_redundancy"), Require, (Some "Redundancy elimination"), "Deadcode";
+PARTIAL, (Option "optim_move_loop_invariants"), Require, (Some "LICM"), "LICM";
+TOTAL, (Option "optim_move_loop_invariants"), NoRequire, (Some "Renumbering for LICM"), "Renumber";
+PARTIAL, (Option "optim_move_loop_invariants"), NoRequire, (Some "CSE3 for LICM"), "CSE3";
+PARTIAL, (Option "optim_move_loop_invariants"), NoRequire, (Some "Redundancy elimination for LICM"), "Deadcode";
+TOTAL, (Option "all_loads_nontrap"), Require, None, "Allnontrap";
+PARTIAL, Always, Require, (Some "Unused globals"), "Unusedglob"
|];;
let post_rtl_passes =
[|
- PARTIAL, Always, (Some "Register allocation"), "Allocation", (Print "LTL");
- TOTAL, Always, (Some "Branch tunneling"), "Tunneling", Noprint;
- PARTIAL, Always, (Some "CFG linearization"), "Linearize", Noprint;
- TOTAL, Always, (Some "Label cleanup"), "CleanupLabels", Noprint;
- PARTIAL, (Option "debug"), (Some "Debugging info for local variables"), "Debugvar", Noprint;
- PARTIAL, Always, (Some "Mach generation"), "Stacking", (Print "Mach")
+ PARTIAL, Always, Require, (Some "Register allocation"), "Allocation", (Print "LTL");
+ TOTAL, Always, Require, (Some "Branch tunneling"), "Tunneling", Noprint;
+ PARTIAL, Always, Require, (Some "CFG linearization"), "Linearize", Noprint;
+ TOTAL, Always, Require, (Some "Label cleanup"), "CleanupLabels", Noprint;
+ PARTIAL, (Option "debug"), Require, (Some "Debugging info for local variables"), "Debugvar", Noprint;
+ PARTIAL, Always, Require, (Some "Mach generation"), "Stacking", (Print "Mach")
|];;
let all_passes =
Array.concat
[Array.mapi
- (fun i (a,b,c,d) -> (a,b,c,d, Print (Printf.sprintf "RTL %d" (i+1))))
+ (fun i (a,b,r,c,d) -> (a,b,r,c,d, Print (Printf.sprintf "RTL %d" (i+1))))
rtl_passes;
post_rtl_passes];;
let totality = function TOTAL -> "total" | PARTIAL -> "partial";;
let print_rtl_require oc =
- Array.iter (fun (partial, trigger, time_label, pass_name, printing) ->
- Printf.fprintf oc "Require %s.\n" pass_name)
- all_passes;;
+ Array.iter (fun (partial, trigger, require, time_label, pass_name, printing) ->
+ match require with Require ->
+ Printf.fprintf oc "Require %s.\n" pass_name
+ | _ -> ()
+ ) all_passes;;
let print_rtl_require_proof oc =
- Array.iter (fun (partial, trigger, time_label, pass_name, printing) ->
- Printf.fprintf oc "Require %sproof.\n" pass_name)
- all_passes;;
+ Array.iter (fun (partial, trigger, require, time_label, pass_name, printing) ->
+ match require with Require ->
+ Printf.fprintf oc "Require %sproof.\n" pass_name
+ | _ -> ()
+ ) all_passes;;
let print_rtl_transf oc =
Array.iteri
- (fun i (partial, trigger, time_label, pass_name, printing) ->
+ (fun i (partial, trigger, require, time_label, pass_name, printing) ->
output_string oc (match partial with
| TOTAL -> " @@ "
| PARTIAL -> " @@@ ");
@@ -90,7 +101,7 @@ let print_rtl_transf oc =
) all_passes;;
let print_rtl_mkpass oc =
- Array.iter (fun (partial, trigger, time_label, pass_name, printing) ->
+ Array.iter (fun (partial, trigger, require, time_label, pass_name, printing) ->
output_string oc " ::: mkpass (";
(match trigger with
| Always -> ()
@@ -106,7 +117,7 @@ let print_if kind oc = function
let numbering_base = 7
let print_rtl_proof oc =
- Array.iteri (fun i (partial, trigger, time_label, pass_name, printing) ->
+ Array.iteri (fun i (partial, trigger, require, time_label, pass_name, printing) ->
let j = i+numbering_base in
match partial with
| TOTAL ->
@@ -118,7 +129,7 @@ let print_rtl_proof oc =
all_passes;;
let print_rtl_proof2 oc =
- Array.iteri (fun i (partial, trigger, time_label, pass_name, printing) ->
+ Array.iteri (fun i (partial, trigger, require, time_label, pass_name, printing) ->
let j = i+numbering_base in
Printf.fprintf oc " exists p%d; split. " j;
(match trigger with
@@ -131,7 +142,7 @@ let print_rtl_proof2 oc =
all_passes;;
let print_rtl_forward_simulations oc =
- Array.iter (fun (partial, trigger, time_label, pass_name) ->
+ Array.iter (fun (partial, trigger, require, time_label, pass_name) ->
output_string oc " eapply compose_forward_simulations.\n ";
(match trigger with
| Always -> ()