diff options
Diffstat (limited to 'scheduling/RTLpathScheduleraux.ml')
-rw-r--r-- | scheduling/RTLpathScheduleraux.ml | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml index a294d0b5..00ef31fb 100644 --- a/scheduling/RTLpathScheduleraux.ml +++ b/scheduling/RTLpathScheduleraux.ml @@ -1,28 +1,19 @@ +open DebugPrint +open Machine +open RTLpathLivegenaux open RTLpath +open RTLpathCommon open RTL open Maps -open RTLpathLivegenaux open Registers -open Camlcoq -open Machine -open DebugPrint +open ExpansionOracle let config = Machine.config -type superblock = { - instructions: P.t array; (* pointers to code instructions *) - (* each predicted Pcb has its attached liveins *) - (* This is indexed by the pc value *) - liveins: Regset.t PTree.t; - (* Union of the input_regs of the last successors *) - output_regs: Regset.t; - typing: RTLtyping.regenv -} - let print_superblock sb code = let insts = sb.instructions in let li = sb.liveins in - let outs = sb.output_regs in + let outs = sb.s_output_regs in begin debug "{ instructions = "; print_instructions (Array.to_list insts) code; debug "\n"; debug " liveins = "; print_ptree_regset li; debug "\n"; @@ -71,7 +62,7 @@ let get_superblocks code entry pm typing = let pi = get_some @@ PTree.get pc pm in let (insts, nexts) = follow pc (Camlcoq.Nat.to_int pi.psize) in let superblock = { instructions = Array.of_list insts; liveins = !liveins; - output_regs = pi.output_regs; typing = typing } in + s_output_regs = pi.output_regs; typing = typing } in superblock :: (List.concat @@ List.map get_superblocks_rec nexts) end in let lsb = get_superblocks_rec entry in begin @@ -292,19 +283,22 @@ let turn_all_loads_nontrap sb code = let rec do_schedule code = function | [] -> code | sb :: lsb -> + let code_exp = expanse sb code in (* Trick: instead of turning loads into non trap as needed.. * First, we turn them all into non-trap. * Then, we turn back those who didn't need to be turned, into TRAP again * 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 in + let code' = turn_all_loads_nontrap sb code_exp in let schedule = schedule_superblock sb code' in let new_code = apply_schedule code' sb schedule in begin - (* debug_flag := true; *) + (*debug_flag := true; *) debug "Old Code: "; print_code code; + debug "Exp Code: "; print_code code_exp; debug "\nSchedule to apply: "; print_arrayp schedule; debug "\nNew Code: "; print_code new_code; + (*debug_flag := false;*) debug "\n"; (* debug_flag := false; *) do_schedule new_code lsb @@ -325,7 +319,9 @@ let scheduler f = print_path_map pm; debug "Superblocks:\n"; print_superblocks lsb code; debug "\n"; - (* debug_flag := false; *) + (*debug_flag := true; *) + find_last_node_reg (PTree.elements code); + (*print_code code;*) let tc = do_schedule code lsb in (((tc, entry), pm), id_ptree) end |