aboutsummaryrefslogtreecommitdiffstats
path: root/scheduling/RTLpathScheduleraux.ml
diff options
context:
space:
mode:
Diffstat (limited to 'scheduling/RTLpathScheduleraux.ml')
-rw-r--r--scheduling/RTLpathScheduleraux.ml28
1 files changed, 22 insertions, 6 deletions
diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml
index f3f09954..9986f2e7 100644
--- a/scheduling/RTLpathScheduleraux.ml
+++ b/scheduling/RTLpathScheduleraux.ml
@@ -237,7 +237,7 @@ let get_live_regs_entry (sb : superblock) code =
(* TODO David *)
let schedule_superblock sb code =
if not !Clflags.option_fprepass
- then sb.instructions
+ then None
else
(* let old_flag = !debug_flag in
debug_flag := true;
@@ -268,8 +268,8 @@ let schedule_superblock sb code =
live_regs_entry
sb.typing
(reference_counting seqa sb.s_output_regs sb.typing) with
- | None -> sb.instructions
- | Some order ->
+ | None -> None
+ | Some (order, final_time) ->
let ins' =
Array.append
(Array.map (fun i -> sb.instructions.(i)) order)
@@ -281,7 +281,7 @@ let schedule_superblock sb code =
flush stdout; *)
assert ((Array.length sb.instructions) = (Array.length ins'));
(*sb.instructions; *)
- ins';;
+ Some (ins', final_time);;
(* stub2: reverse function *)
(*
@@ -430,7 +430,12 @@ let apply_schedule code sb new_order =
let pset = hashedset_map fmap @@ get_some @@ PTree.get n cbs_above in
let pset' = get_some @@ PTree.get n' cbs_above' in
if HashedSet.PSet.is_subset pset pset' then tc := PTree.set n' (Iload (AST.TRAP,a,b,c,d,s)) !tc
- else assert !config.has_non_trapping_loads
+ else
+ (* TODO jf: ignore identical loads
+ * Right now the downward scheduling might cause the duplication of loads
+ * which are then moved by apply_schedule "across Iconds" due to my abuse of
+ * apply_schedule when inserting code into a superblock. *)
+ (* assert !config.has_non_trapping_loads *) ()
| _ -> ()
) old_order;
!tc
@@ -461,7 +466,11 @@ let rec do_schedule code pm = function
* This is because the scheduler (rightfully) refuses to schedule ahead of a branch
* operations that might trap *)
let code' = turn_all_loads_nontrap sb code_exp in
- let schedule = schedule_superblock sb code' in
+ let schedule =
+ match schedule_superblock sb code' with
+ | None -> sb.instructions
+ | Some (schedule, _final_time) -> schedule
+ in
let new_code = apply_schedule code' sb schedule in
begin
(*debug_flag := true;*)
@@ -493,5 +502,12 @@ let scheduler f =
(*print_superblocks lsb code; debug "\n";*)
find_last_node_reg (PTree.elements code);
let (tc, pm) = do_schedule code pm lsb in
+ let debug_flag_old = !debug_flag in
+ debug_flag := false;
+ debug "Before scheduling, entrypoint: %d:\n" (Camlcoq.P.to_int entry); flush_all ();
+ print_code code; flush_all ();
+ debug "After scheduling:\n"; flush_all ();
+ print_code tc; flush_all ();
+ debug_flag := debug_flag_old;
(((tc, entry), pm), id_ptree)
end