aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-07-08 09:31:10 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-07-08 09:31:10 +0200
commitd37a9db8edb9c38c79940d9a3d647430a4c4d3e5 (patch)
tree0e1a369573aa44529c0bdfa436103377b85a42ac
parent88c5e2a6a06e045e13f49c34183f0a59136775f9 (diff)
downloadcompcert-kvx-d37a9db8edb9c38c79940d9a3d647430a4c4d3e5.tar.gz
compcert-kvx-d37a9db8edb9c38c79940d9a3d647430a4c4d3e5.zip
use a command-line option
-rw-r--r--driver/Clflags.ml1
-rw-r--r--driver/Driver.ml4
-rw-r--r--kvx/lib/RTLpathScheduleraux.ml39
3 files changed, 25 insertions, 19 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index eb21b3f8..fc5d9e45 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -36,6 +36,7 @@ let option_fredundancy = ref true
let option_fduplicate = ref (-1)
let option_finvertcond = ref true
let option_ftracelinearize = ref false
+let option_fprepass = ref false
let option_fpostpass = ref true
let option_fpostpass_sched = ref "list"
let option_fifconversion = ref true
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 90afb812..6accc22b 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -204,7 +204,8 @@ Processing options:
-fcse3-glb Refine CSE3 information using greatest lower bounds [on]
-fmove-loop-invariants Perform loop-invariant code motion [off]
-fredundancy Perform redundancy elimination [on]
- -fpostpass Perform postpass scheduling (only for K1 architecture) [on]
+ -fprepass Perform prepass scheduling (only for K1 architecture) [off]
+ -fpostpass Perform postpass scheduling (only for K1 architecture) [on]
-fpostpass= <optim> Perform postpass scheduling with the specified optimization [list]
(<optim>=list: list scheduling, <optim>=ilp: ILP, <optim>=greedy: just packing bundles)
-fduplicate <nb_nodes> Perform tail duplication to form superblocks on predicted traces
@@ -419,6 +420,7 @@ let cmdline_actions =
@ f_opt "cse3-glb" option_fcse3_glb
@ f_opt "move-loop-invariants" option_fmove_loop_invariants
@ f_opt "redundancy" option_fredundancy
+ @ f_opt "prepass" option_fprepass
@ f_opt "postpass" option_fpostpass
@ [ Exact "-fduplicate", Integer (fun n -> option_fduplicate := n) ]
@ f_opt "invertcond" option_finvertcond
diff --git a/kvx/lib/RTLpathScheduleraux.ml b/kvx/lib/RTLpathScheduleraux.ml
index 3008543c..32fb2c2a 100644
--- a/kvx/lib/RTLpathScheduleraux.ml
+++ b/kvx/lib/RTLpathScheduleraux.ml
@@ -95,24 +95,27 @@ end
(* TODO David *)
let schedule_superblock sb code =
- let old_flag = !debug_flag in
- debug_flag := true;
- print_endline "ORIGINAL SUPERBLOCK";
- print_superblock sb code;
- debug_flag := old_flag;
- match PrepassSchedulingOracle.schedule_sequence
- (Array.map (fun i ->
- match PTree.get i code with Some ii -> ii | None -> failwith "RTLpathScheduleraux.schedule_superblock")
- sb.instructions) with
- | None -> sb.instructions
- | Some order ->
- let ins' = Array.map (fun i -> sb.instructions.(i)) order in
- Printf.printf "REORDERED SUPERBLOCK %d\n" (Array.length ins');
- debug_flag := true;
- print_instructions (Array.to_list ins') code;
- debug_flag := old_flag;
- (*sb.instructions; *)
- ins';;
+ if not !Clflags.option_fprepass
+ then sb.instructions
+ else
+ let old_flag = !debug_flag in
+ debug_flag := true;
+ print_endline "ORIGINAL SUPERBLOCK";
+ print_superblock sb code;
+ debug_flag := old_flag;
+ match PrepassSchedulingOracle.schedule_sequence
+ (Array.map (fun i ->
+ match PTree.get i code with Some ii -> ii | None -> failwith "RTLpathScheduleraux.schedule_superblock")
+ sb.instructions) with
+ | None -> sb.instructions
+ | Some order ->
+ let ins' = Array.map (fun i -> sb.instructions.(i)) order in
+ Printf.printf "REORDERED SUPERBLOCK %d\n" (Array.length ins');
+ debug_flag := true;
+ print_instructions (Array.to_list ins') code;
+ debug_flag := old_flag;
+ (*sb.instructions; *)
+ ins';;
(* stub2: reverse function *)
(*