aboutsummaryrefslogtreecommitdiffstats
path: root/scheduling/InstructionScheduler.ml
diff options
context:
space:
mode:
Diffstat (limited to 'scheduling/InstructionScheduler.ml')
-rw-r--r--scheduling/InstructionScheduler.ml21
1 files changed, 17 insertions, 4 deletions
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