aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-10-27 21:00:31 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-10-27 21:00:31 +0100
commitcf6a15a79c9d46d7aba300b595c824216866e83d (patch)
treec57894c1b9a3c673107e3546d9513c2bf5ab7e0d /tools
parent21af08182a41cd6a2fe1d2da08bedb572ab88981 (diff)
parent1439f7c79cf3d825479dc0fb68d6694083775c34 (diff)
downloadcompcert-kvx-cf6a15a79c9d46d7aba300b595c824216866e83d.tar.gz
compcert-kvx-cf6a15a79c9d46d7aba300b595c824216866e83d.zip
Merge remote-tracking branch 'origin/kvx-work' into kvx-test-prepass
Diffstat (limited to 'tools')
-rw-r--r--tools/compiler_expand.ml97
1 files changed, 54 insertions, 43 deletions
diff --git a/tools/compiler_expand.ml b/tools/compiler_expand.ml
index 7e1e0181..35ddfe5e 100644
--- a/tools/compiler_expand.ml
+++ b/tools/compiler_expand.ml
@@ -11,68 +11,79 @@ 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 unrolling"), "Renumber";
+PARTIAL, Always, NoRequire, (Some "Unrolling the body of innermost loops"), "Unrollbody";
+TOTAL, Always, NoRequire, (Some "Renumbering pre tail duplication"), "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 "RTLpath generation"), "RTLpathLivegen", Noprint;
- PARTIAL, Always, (Some "Prepass scheduling"), "RTLpathScheduler", Noprint;
- TOTAL, Always, (Some "Projection to RTL"), "RTLpath", (Print (Printf.sprintf "RTL %d" ((Array.length rtl_passes) + 1)));
- 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 "RTLpath generation"), "RTLpathLivegen", Noprint;
+ PARTIAL, Always, Require, (Some "Prepass scheduling"), "RTLpathScheduler", Noprint;
+ TOTAL, Always, Require, (Some "Projection to RTL"), "RTLpath", (Print (Printf.sprintf "RTL %d" ((Array.length rtl_passes) + 1)));
+ 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 -> " @@@ ");
@@ -93,7 +104,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 -> ()
@@ -109,7 +120,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 ->
@@ -121,7 +132,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
@@ -134,7 +145,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 -> ()