From eda50ef26e8799eaa928edb01038775057874068 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Thu, 10 Sep 2020 16:18:19 +0200 Subject: use scheduler_by_name --- kvx/InstructionScheduler.ml | 7 +++++++ kvx/InstructionScheduler.mli | 3 +++ kvx/PostpassSchedulingOracle.ml | 10 +--------- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'kvx') diff --git a/kvx/InstructionScheduler.ml b/kvx/InstructionScheduler.ml index d72e38b7..eab0b21a 100644 --- a/kvx/InstructionScheduler.ml +++ b/kvx/InstructionScheduler.ml @@ -1254,3 +1254,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..85e2a5c6 100644 --- a/kvx/InstructionScheduler.mli +++ b/kvx/InstructionScheduler.mli @@ -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 2326f97e..2107ce22 100644 --- a/kvx/PostpassSchedulingOracle.ml +++ b/kvx/PostpassSchedulingOracle.ml @@ -921,15 +921,7 @@ let print_schedule sched = let do_schedule bb = let problem = build_problem bb in (if debug then 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 + let solution = scheduler_by_name (!Clflags.option_fpostpass_sched) problem in match solution with | None -> failwith "Could not find a valid schedule" | Some sol -> -- cgit