#include "irtools.h"
#include "irgwalk.h"
#include "benode.h"
+#include "bemodule.h"
#include "array_t.h"
// XXX there is no one time init for schedulers
}
-static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set,
- ir_nodeset_t *live_set)
+static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set)
{
instance_t* inst = (instance_t*)block_env;
ir_node* irn;
ir_node* last = NULL;
ir_nodeset_iterator_t iter;
- (void)live_set;
-
for (irn = inst->curr_list; irn != NULL; last = irn, irn = next) {
next = (ir_node*)get_irn_link(irn);
if (ir_nodeset_contains(ready_set, irn)) {
if (fc == NULL) {
irn_cost_pair* costs;
- int i;
ir_node* block = get_nodes_block(irn);
fc = OALLOCF(&inst->obst, flag_and_cost, costs, arity);
for (i = 0; i < arity; ++i) {
ir_node* pred = get_irn_n(irn, i);
- int cost;
if (is_Phi(irn) || get_irn_mode(pred) == mode_M || is_Block(pred)) {
cost = 0;
ir_node* real_pred;
cost = normal_tree_cost(pred, inst);
- if (be_is_Barrier(pred)) cost = 1; // XXX hack: the barrier causes all users to have a reguse of #regs
if (!arch_irn_is_ignore(pred)) {
real_pred = (is_Proj(pred) ? get_Proj_pred(pred) : pred);
pred_fc = get_irn_fc(real_pred);
}
-static void *normal_init_graph(const list_sched_selector_t *vtab,
- ir_graph *irg)
+static void *normal_init_graph(ir_graph *irg)
{
instance_t *inst = XMALLOC(instance_t);
ir_heights_t *heights;
- (void)vtab;
-
be_clear_links(irg);
obstack_init(&inst->obst);
xfree(inst);
}
-const list_sched_selector_t normal_selector = {
- normal_init_graph,
- normal_init_block,
- normal_select,
- NULL, /* node_ready */
- NULL, /* node_selected */
- NULL, /* exectime */
- NULL, /* latency */
- NULL, /* finish_block */
- normal_finish_graph
-};
+static void sched_normal(ir_graph *irg)
+{
+ static const list_sched_selector_t normal_selector = {
+ normal_init_graph,
+ normal_init_block,
+ normal_select,
+ NULL, /* node_ready */
+ NULL, /* node_selected */
+ NULL, /* finish_block */
+ normal_finish_graph
+ };
+ be_list_sched_graph(irg, &normal_selector);
+}
+
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched_normal)
+void be_init_sched_normal(void)
+{
+ be_register_scheduler("normal", sched_normal);
+}