diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-07-11 11:00:15 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-07-11 11:00:15 +0200 |
commit | eea5640e55890538fa43c3d5672853a0ae015b9c (patch) | |
tree | 0d98021282ad8d485b8538826133d7ab7e83f30b /kvx | |
parent | 291b7bd92b510f9dd2edabcae49d13f8c7466c25 (diff) | |
download | compcert-kvx-eea5640e55890538fa43c3d5672853a0ae015b9c.tar.gz compcert-kvx-eea5640e55890538fa43c3d5672853a0ae015b9c.zip |
command line selection of prepass scheduler
Diffstat (limited to 'kvx')
-rw-r--r-- | kvx/InstructionScheduler.ml | 7 | ||||
-rw-r--r-- | kvx/InstructionScheduler.mli | 7 | ||||
-rw-r--r-- | kvx/PostpassSchedulingOracle.ml | 9 | ||||
-rw-r--r-- | kvx/lib/PrepassSchedulingOracle.ml | 3 |
4 files changed, 14 insertions, 12 deletions
diff --git a/kvx/InstructionScheduler.ml b/kvx/InstructionScheduler.ml index e4dc3f97..32f394b1 100644 --- a/kvx/InstructionScheduler.ml +++ b/kvx/InstructionScheduler.ml @@ -1245,3 +1245,10 @@ let cascaded_scheduler (problem : problem) = end; Some solution;; +let scheduler_by_name name = + match name with + | "ilp" -> validated_scheduler cascaded_scheduler + | "list" -> validated_scheduler list_scheduler + | "revlist" -> validated_scheduler reverse_list_scheduler + | "greedy" -> greedy_scheduler + | s -> failwith ("unknown scheduler: " ^ s);; diff --git a/kvx/InstructionScheduler.mli b/kvx/InstructionScheduler.mli index f91c2d06..6d27b30c 100644 --- a/kvx/InstructionScheduler.mli +++ b/kvx/InstructionScheduler.mli @@ -65,10 +65,10 @@ val list_scheduler : problem -> solution option (** Schedule the problem using the order of instructions without any reordering *) val greedy_scheduler : problem -> solution option -(** Schedule a problem using a scheduler applied in the opposite direction, e.g. for list scheduling from the end instead of the start. BUGGY *) +(** Schedule a problem using a scheduler applied in the opposite direction, e.g. for list scheduling from the end instead of the start. *) val schedule_reversed : scheduler -> problem -> int array option -(** Schedule a problem from the end using a list scheduler. BUGGY *) +(** Schedule a problem from the end using a list scheduler. *) val reverse_list_scheduler : problem -> int array option (** Check that a problem is well-formed. @@ -108,3 +108,6 @@ val smt_print_problem : out_channel -> problem -> unit;; val ilp_print_problem : out_channel -> problem -> pseudo_boolean_problem_type -> pseudo_boolean_mapper;; val ilp_scheduler : pseudo_boolean_problem_type -> problem -> solution option;; + +(** Schedule a problem using a scheduler given by a string name *) +val scheduler_by_name : string -> problem -> int array option;; diff --git a/kvx/PostpassSchedulingOracle.ml b/kvx/PostpassSchedulingOracle.ml index 822c0dc0..67e3f80f 100644 --- a/kvx/PostpassSchedulingOracle.ml +++ b/kvx/PostpassSchedulingOracle.ml @@ -916,14 +916,7 @@ let print_bb oc bb = 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 + in let solution = scheduler_by_name (!Clflags.option_fpostpass_sched) problem in match solution with | None -> failwith "Could not find a valid schedule" | Some sol -> let bundles = bundlize_solution bb sol in diff --git a/kvx/lib/PrepassSchedulingOracle.ml b/kvx/lib/PrepassSchedulingOracle.ml index 9701f446..78961310 100644 --- a/kvx/lib/PrepassSchedulingOracle.ml +++ b/kvx/lib/PrepassSchedulingOracle.ml @@ -414,8 +414,7 @@ let schedule_sequence (seqa : (instruction*Regset.t) array) = let problem = define_problem seqa in print_sequence stdout (Array.map fst seqa); print_problem stdout problem; - match (*reverse_list_scheduler*) list_scheduler problem - (* scheduler_by_name !Clflags.option_fprepass_sched problem *) with + match scheduler_by_name (!Clflags.option_fprepass_sched) problem with | None -> Printf.printf "no solution in prepass scheduling\n"; None | Some solution -> |