From 93604827233bc337f4235b1feb2c48b4a917d386 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 1 Sep 2020 10:40:20 +0200 Subject: "nop" is not even printed out and thus uses no resources --- kvx/PostpassSchedulingOracle.ml | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'kvx/PostpassSchedulingOracle.ml') diff --git a/kvx/PostpassSchedulingOracle.ml b/kvx/PostpassSchedulingOracle.ml index 822c0dc0..484903c7 100644 --- a/kvx/PostpassSchedulingOracle.ml +++ b/kvx/PostpassSchedulingOracle.ml @@ -504,8 +504,7 @@ let alu_lite_y : int array = let resmap = fun r -> match r with | Rissue -> 3 | Rtiny -> 1 | Rlite -> 1 | _ -> 0 in Array.of_list (List.map resmap resource_names) -let alu_nop : int array = let resmap = fun r -> match r with - | Rissue -> 1 | Rnop -> 1 | _ -> 0 +let alu_nop : int array = let resmap = fun r -> 0 in Array.of_list (List.map resmap resource_names) let alu_tiny : int array = let resmap = fun r -> match r with @@ -914,19 +913,28 @@ let print_bb oc bb = let asm_instructions = Asm.unfold_bblock bb in List.iter (print_inst oc) asm_instructions +let print_schedule sched = + print_string "[ "; + Array.iter (fun x -> Printf.printf "%d; " x) sched; + print_endline "]";; + let do_schedule bb = - let problem = build_problem bb - in let solution = (if !Clflags.option_fpostpass_sched = "ilp" then - validated_scheduler cascaded_scheduler - else if !Clflags.option_fpostpass_sched = "list" then - validated_scheduler list_scheduler - else if !Clflags.option_fpostpass_sched = "revlist" then - validated_scheduler reverse_list_scheduler - else if !Clflags.option_fpostpass_sched = "greedy" then - greedy_scheduler else failwith ("Invalid scheduler:" ^ !Clflags.option_fpostpass_sched)) problem + let problem = build_problem bb in + print_problem stdout problem; + let solution = (match !Clflags.option_fpostpass_sched with + | "ilp" -> + validated_scheduler cascaded_scheduler + | "list" -> + validated_scheduler list_scheduler + | "revlist" -> + validated_scheduler reverse_list_scheduler + | "greedy" -> greedy_scheduler + | other -> failwith ("Invalid scheduler:" ^ other)) problem in match solution with | None -> failwith "Could not find a valid schedule" - | Some sol -> let bundles = bundlize_solution bb sol in + | Some sol -> + ((if debug then print_schedule sol); + let bundles = bundlize_solution bb sol in (if debug then begin Printf.eprintf "Scheduling the following group of instructions:\n"; @@ -935,7 +943,7 @@ let do_schedule bb = List.iter (print_bb stderr) bundles; Printf.eprintf "--------------------------------\n" end; - bundles) + bundles)) (** * Dumb schedule if the above doesn't work -- cgit