aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aarch64/PrepassSchedulingOracle.ml6
-rw-r--r--scheduling/RTLpathScheduleraux.ml24
2 files changed, 24 insertions, 6 deletions
diff --git a/aarch64/PrepassSchedulingOracle.ml b/aarch64/PrepassSchedulingOracle.ml
index 1fd12a6a..a743fb68 100644
--- a/aarch64/PrepassSchedulingOracle.ml
+++ b/aarch64/PrepassSchedulingOracle.ml
@@ -406,11 +406,11 @@ let get_alias_dependencies seqa =
!deps;;
*)
-let define_problem (opweights : opweights) seqa =
+let define_problem (opweights : opweights) (live_entry_regs : Regset.t) seqa =
let simple_deps = get_simple_dependencies opweights seqa in
{ max_latency = -1;
resource_bounds = opweights.pipelined_resource_bounds;
- live_regs_entry = Regset.empty; (* PLACEHOLDER *)
+ live_regs_entry = live_entry_regs;
instruction_usages = Array.map (resources_of_instruction opweights) (Array.map fst seqa);
latency_constraints =
(* if (use_alias_analysis ())
@@ -451,7 +451,7 @@ let schedule_sequence (seqa : (instruction*Regset.t) array)
let nr_instructions = Array.length seqa in
(if !Clflags.option_debug_compcert > 6
then Printf.printf "prepass scheduling length = %d\n" (Array.length seqa));
- let problem = define_problem opweights seqa in
+ let problem = define_problem opweights live_regs_entry seqa in
(if !Clflags.option_debug_compcert > 7
then (print_sequence stdout (Array.map fst seqa);
print_problem stdout problem));
diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml
index 55f1a078..30da5d5d 100644
--- a/scheduling/RTLpathScheduleraux.ml
+++ b/scheduling/RTLpathScheduleraux.ml
@@ -73,8 +73,26 @@ let get_superblocks code entry pm typing =
end
(* PLACEHOLDER *)
-let get_live_regs_entry (sb : superblock) =
- Registers.Regset.empty
+let get_live_regs_entry (sb : superblock) code =
+ let seqa = Array.map (fun i ->
+ (match PTree.get i code with
+ | Some ii -> ii
+ | None -> failwith "RTLpathScheduleraux.get_live_regs_entry"
+ ),
+ (match PTree.get i sb.liveins with
+ | Some s -> s
+ | None -> Regset.empty))
+ sb.instructions in
+ Array.fold_right (fun (ins, liveins) regset ->
+ match ins with
+ | Inop l -> regset
+ | Iop (op, args, dest, succ) ->
+ Registers.Regset.add dest
+ (List.fold_left (fun set reg ->
+ Registers.Regset.remove reg set)
+ regset args)
+ | _ -> regset (* PLACEHOLDER *)
+ ) seqa Registers.Regset.empty
(* TODO David *)
@@ -95,7 +113,7 @@ let schedule_superblock sb code =
match predicted_successor ii with
| Some _ -> 0
| None -> 1 in
- let live_regs_entry = get_live_regs_entry sb in
+ let live_regs_entry = get_live_regs_entry sb code in
match PrepassSchedulingOracle.schedule_sequence
(Array.map (fun i ->
(match PTree.get i code with