diff options
Diffstat (limited to 'kvx/lib/RTLpathScheduleraux.ml')
-rw-r--r-- | kvx/lib/RTLpathScheduleraux.ml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/kvx/lib/RTLpathScheduleraux.ml b/kvx/lib/RTLpathScheduleraux.ml index 32fb2c2a..97de1a12 100644 --- a/kvx/lib/RTLpathScheduleraux.ml +++ b/kvx/lib/RTLpathScheduleraux.ml @@ -103,13 +103,26 @@ let schedule_superblock sb code = print_endline "ORIGINAL SUPERBLOCK"; print_superblock sb code; debug_flag := old_flag; + let nr_instr = Array.length sb.instructions in + let trailer_length = + match PTree.get (sb.instructions.(nr_instr-1)) code with + | Some (Ireturn _ | Itailcall _ | Ijumptable _) -> 1 + | _ -> 0 in match PrepassSchedulingOracle.schedule_sequence (Array.map (fun i -> - match PTree.get i code with Some ii -> ii | None -> failwith "RTLpathScheduleraux.schedule_superblock") - sb.instructions) with + (match PTree.get i code with + | Some ii -> ii + | None -> failwith "RTLpathScheduleraux.schedule_superblock"), + (match PTree.get i sb.liveins with + | Some s -> s + | None -> Regset.empty)) + (Array.sub sb.instructions 0 (nr_instr-trailer_length))) with | None -> sb.instructions | Some order -> - let ins' = Array.map (fun i -> sb.instructions.(i)) order in + let ins' = + Array.append + (Array.map (fun i -> sb.instructions.(i)) order) + (Array.sub sb.instructions (nr_instr-trailer_length) trailer_length) in Printf.printf "REORDERED SUPERBLOCK %d\n" (Array.length ins'); debug_flag := true; print_instructions (Array.to_list ins') code; |