diff options
author | Justus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr> | 2021-07-29 13:19:06 +0200 |
---|---|---|
committer | Justus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr> | 2021-07-29 13:19:45 +0200 |
commit | f8f6a8d482b72f181792dd0194297a6c89670b0f (patch) | |
tree | e64bc97ab9ab9a2719a880ace261b0d991908167 | |
parent | f44edee4c040932044d5c5dd2c20727f9484bde7 (diff) | |
download | compcert-kvx-f8f6a8d482b72f181792dd0194297a6c89670b0f.tar.gz compcert-kvx-f8f6a8d482b72f181792dd0194297a6c89670b0f.zip |
Return estimated final_time from schedulers
-rw-r--r-- | scheduling/MyRTLpathScheduleraux.ml | 14 | ||||
-rw-r--r-- | scheduling/RTLpathScheduleraux.ml | 14 |
2 files changed, 19 insertions, 9 deletions
diff --git a/scheduling/MyRTLpathScheduleraux.ml b/scheduling/MyRTLpathScheduleraux.ml index e4567c1b..183bb840 100644 --- a/scheduling/MyRTLpathScheduleraux.ml +++ b/scheduling/MyRTLpathScheduleraux.ml @@ -679,24 +679,25 @@ let ideal_schedule' sb code ~next_free_reg = (* Printf.eprintf "Scheduling instruction sequence of length: %d\n" nr_instructions; flush_all (); Printf.eprintf "Result: %d\n" solution.(nr_instructions); flush_all (); *) let positions = Array.init nr_instr_seqa (fun i -> i) in + let final_time = solution.(nr_instr_seqa) in Array.sort (fun i j -> let si = solution.(i) and sj = solution.(j) in if si < sj then -1 else if si > sj then 1 else i - j) positions; - Some positions + Some (positions, final_time) in debug_flag := old_debug_flag; match scheduled_sequence with - | None -> sb.instructions - | Some order -> + | None -> None + | Some (order, final_time) -> let ins' = Array.append (Array.map (fun i -> sb.instructions.(i)) order) (Array.sub sb.instructions (nr_instr_sb - trailer_length) trailer_length) in - ins' + Some (ins', final_time) (* "ideal" *) let ideal_schedule sb code = @@ -748,6 +749,11 @@ let downschedule_compensation_code sb code pm live_renames ~next_free_pc ~next_f | "no_move_stores" -> ideal_schedule sb code | _ -> failwith "Unsupported option for scheduling code past side exits" in + let idealized_schedule = + match idealized_schedule_opt with + | None -> sb.instructions + | Some (schedule, _final_time) -> schedule + in let sb_length = Array.length sb.instructions in let pc_to_idx = diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml index 05e5811f..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 *) (* @@ -466,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;*) |