* @file
* @brief Scheduling utilities for nodes in Blocks and Blocks.
* @author Sebastian Hack
- * @version $Id$
*/
#include "config.h"
#include "irgraph_t.h"
#include "iredges_t.h"
#include "ircons.h"
-#include "irextbb.h"
#include "irgmod.h"
#include "debug.h"
#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)
{
- ir_node *irn;
sched_info_t *inf;
sched_timestep_t step = SCHED_INITIAL_GRANULARITY;
info->prev = NULL;
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched);
+
+
+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, (void*)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);
}