summaryrefslogtreecommitdiffhomepage
path: root/ir/be/besched.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2011-03-02 15:38:57 +0100
committerMatthias Braun <matze@braunis.de>2011-03-04 14:17:13 +0100
commita09efb2ccc91c6d720aa6aa8c5f7e3c562528b2a (patch)
treef1fd5098e7b6f1ff8f20903a68f6f77841f0cead /ir/be/besched.c
parent546bbbe4ac637fd7315b06f294432d0d09f6aecb (diff)
rework schedulers to register similar like regallocators/spillers
Diffstat (limited to 'ir/be/besched.c')
-rw-r--r--ir/be/besched.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ir/be/besched.c b/ir/be/besched.c
index 7a0c078..922dccb 100644
--- a/ir/be/besched.c
+++ b/ir/be/besched.c
@@ -44,6 +44,10 @@
#include "belistsched.h"
#include "belive.h"
+#include "lc_opts.h"
+#include "lc_opts_enum.h"
+#include "irtools.h"
+
#define SCHED_INITIAL_GRANULARITY (1 << 14)
static void sched_renumber(const ir_node *block)
@@ -145,7 +149,27 @@ void sched_remove(ir_node *irn)
info->prev = NULL;
}
+
+
+static be_module_list_entry_t *schedulers;
+static schedule_func scheduler;
+
+void be_register_scheduler(const char *name, schedule_func func)
+{
+ if (scheduler == NULL)
+ scheduler = func;
+ be_add_module_to_list(&schedulers, name, func);
+}
+
+void be_schedule_graph(ir_graph *irg)
+{
+ scheduler(irg);
+}
+
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched);
void be_init_sched(void)
{
+ lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
+ be_add_module_list_opt(be_grp, "scheduler", "scheduling algorithm",
+ &schedulers, (void**)&scheduler);
}