summaryrefslogtreecommitdiffhomepage
path: root/ir/be/belistsched.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-10-02 14:09:50 +0200
committerMatthias Braun <matze@braunis.de>2014-10-02 20:08:02 +0200
commit342f0da205694858d2738df0a3d8d07529c9b187 (patch)
tree95530219c64d344c83b15b718cca9e605190b571 /ir/be/belistsched.c
parentfc89bc1fb4d3d6f31f51e2f8d5f31511d514f3bd (diff)
listsched: do not put cfops into readyset unless nothing else is left
This puts the special logic for cfops into the common code instead of repeating it in all schedulers.
Diffstat (limited to 'ir/be/belistsched.c')
-rw-r--r--ir/be/belistsched.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/ir/be/belistsched.c b/ir/be/belistsched.c
index 7006efb..e1ac26e 100644
--- a/ir/be/belistsched.c
+++ b/ir/be/belistsched.c
@@ -42,6 +42,9 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
static ir_node *current_block;
static unsigned *available;
+static ir_node *ready_cfop;
+/** Set of ready nodes (nodes where all dependencies are already fulfilled).
+ * Does not contain cfops. */
static ir_nodeset_t ready_set;
/**
@@ -73,7 +76,13 @@ static void node_ready(ir_node *node)
} else {
/* all other nodes go into the ready set */
DB((dbg, LEVEL_2, "\tmaking ready: %+F\n", node));
- ir_nodeset_insert(&ready_set, node);
+ if (is_cfop(node)) {
+ /* we must not have multiple cfops in a block */
+ assert(ready_cfop == NULL || ready_cfop == node);
+ ready_cfop = node;
+ } else {
+ ir_nodeset_insert(&ready_set, node);
+ }
}
}
@@ -122,6 +131,15 @@ static void make_available(ir_node *node)
}
}
+static void maybe_add_cfop(void)
+{
+ /* if we ran out of other nodes we can finally take the cfop */
+ if (ir_nodeset_size(&ready_set) == 0 && ready_cfop != NULL) {
+ ir_nodeset_insert(&ready_set, ready_cfop);
+ ready_cfop = NULL;
+ }
+}
+
/**
* Append an instruction to a schedule.
* @param env The block scheduling environment.
@@ -141,6 +159,7 @@ void be_list_sched_schedule(ir_node *node)
{
DB((dbg, LEVEL_1, "\tpicked %+F\n", node));
add_to_sched(node);
+ maybe_add_cfop();
}
ir_nodeset_t *be_list_sched_begin_block(ir_node *block)
@@ -150,6 +169,7 @@ ir_nodeset_t *be_list_sched_begin_block(ir_node *block)
sched_init_block(block);
ir_nodeset_init(&ready_set);
+ ready_cfop = NULL;
DB((dbg, LEVEL_1, "scheduling %+F\n", block));
/* fill ready set */
@@ -157,6 +177,7 @@ ir_nodeset_t *be_list_sched_begin_block(ir_node *block)
ir_node *node = get_edge_src_irn(edge);
try_make_ready(node);
}
+ maybe_add_cfop();
return &ready_set;
}