aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolas.nardino <nicolas.nardino@ens-lyon.fr>2021-06-28 16:04:44 +0200
committernicolas.nardino <nicolas.nardino@ens-lyon.fr>2021-06-28 16:04:44 +0200
commitb96a48de58e1969535865b7b345514a24f7178a6 (patch)
treee2078ecc6b7f2c4937afe1061ecc8104dd15bcdf
parent9ac49c465f9c8969fba00e6242da0c188a6a3080 (diff)
downloadcompcert-kvx-b96a48de58e1969535865b7b345514a24f7178a6.tar.gz
compcert-kvx-b96a48de58e1969535865b7b345514a24f7178a6.zip
Change temporary solution (see prev commits), and add option for it
-rw-r--r--driver/Clflags.ml1
-rw-r--r--driver/Driver.ml2
-rw-r--r--scheduling/InstructionScheduler.ml21
3 files changed, 20 insertions, 4 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index c90fdb8c..d01b57f0 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -116,4 +116,5 @@ let option_profile_arcs = ref false
let option_fbranch_probabilities = ref true
let option_debug_compcert = ref 0
let option_regpres_threshold = ref 2
+let option_regpres_temp = ref false
let main_function_name = ref "main"
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 4f43d7c9..22c75f44 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -212,6 +212,7 @@ Processing options:
-fprepass= <optim> Perform postpass scheduling with the specified optimization [list]
(<optim>=list: list scheduling, <optim>=revlist: reverse list scheduling, <optim>=regpres: list scheduling aware of register pressure, <optim>=regpres_bis: variant of regpres, <optim>=zigzag: zigzag scheduling, <optim>=ilp: ILP, <optim>=greedy: just packing bundles)
-regpres-threshold n With `-fprepass= regpres`, set threshold value for number of free registers before trying to decrease register pressure
+ -fregpres-temp use the temporary solution (default no)
-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)
@@ -426,6 +427,7 @@ let cmdline_actions =
@ f_opt "redundancy" option_fredundancy
@ [ Exact "-mtune", String (fun s -> option_mtune := s) ]
@ f_opt "prepass" option_fprepass
+ @ f_opt "regpres-temp" option_regpres_temp
@ f_opt "postpass" option_fpostpass
@ [ Exact "-ftailduplicate", Integer (fun n -> option_ftailduplicate := n) ]
@ f_opt "predict" option_fpredict
diff --git a/scheduling/InstructionScheduler.ml b/scheduling/InstructionScheduler.ml
index e2413bc0..a881df68 100644
--- a/scheduling/InstructionScheduler.ml
+++ b/scheduling/InstructionScheduler.ml
@@ -486,7 +486,7 @@ let reg_pres_scheduler (problem : problem) : solution option =
(* ALL MENTIONS TO cnt ARE PLACEHOLDERS *)
let cnt = ref 0 in
-
+
let attempt_scheduling ready usages =
let result = ref (-1) in
try
@@ -500,7 +500,7 @@ let reg_pres_scheduler (problem : problem) : solution option =
* print_int (Hashtbl.length live_regs);
* print_newline ();
* flush stdout; *)
- if !cnt < 5 && avlregs <= regs_thresholds.(i)
+ if avlregs <= regs_thresholds.(i)
then (
let maybe = InstrSet.sched_CSR i ready usages in
(* print_string "maybe\n";
@@ -518,7 +518,19 @@ let reg_pres_scheduler (problem : problem) : solution option =
then
(vector_subtract usages.(maybe) current_resources;
result := maybe)
- else incr cnt);
+ else
+ if not !Clflags.option_regpres_temp
+ then
+ (InstrSet.iter (fun ins ->
+ if vector_less_equal usages.(ins) current_resources &&
+ List.fold_left (fold_delta i) 0 mentions.(maybe) >= 0
+ then result := ins
+ ) ready;
+ if !result <> -1 then
+ vector_subtract usages.(!result) current_resources)
+ else
+ (incr cnt)
+ );
raise Exit)) available_regs;
InstrSet.iter (fun i ->
if vector_less_equal usages.(i) current_resources
@@ -543,7 +555,8 @@ let reg_pres_scheduler (problem : problem) : solution option =
* print_int i;
* print_newline ();
* flush stdout; *)
- cnt := 0;
+ if !Clflags.option_regpres_temp then
+ cnt := 0;
List.iter (fun (r,b) ->
if b then
(match Hashtbl.find_opt counts r with