summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beschedtrivial.c
diff options
context:
space:
mode:
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>2006-08-29 13:55:46 +0200
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>2006-08-29 13:55:46 +0200
commit08bb312485d8a28679504d97402b70fde8073a66 (patch)
tree27ac968339d2d735e4d70dcbd60471685fef49d3 /ir/be/beschedtrivial.c
parent6c89661f18047a222ab40af13a4cc97a69fe9b9c (diff)
added different scheduling node selector modules
Diffstat (limited to 'ir/be/beschedtrivial.c')
-rw-r--r--ir/be/beschedtrivial.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/ir/be/beschedtrivial.c b/ir/be/beschedtrivial.c
new file mode 100644
index 0000000..2a4f6ad
--- /dev/null
+++ b/ir/be/beschedtrivial.c
@@ -0,0 +1,61 @@
+/**
+ * Trivial node selector.
+ * @author Christian Wuerdig
+ * @date 29.08.2006
+ * @cvs-id $Id$
+ */
+
+#include <stdlib.h>
+
+#include "besched_t.h"
+#include "belistsched.h"
+
+/**
+ * The trivial selector:
+ * Just assure that branches are executed last, otherwise select
+ * the first node ready.
+ */
+static ir_node *trivial_select(void *block_env, nodeset *ready_set, nodeset *live_set)
+{
+ const arch_env_t *arch_env = block_env;
+ ir_node *irn = NULL;
+
+ /* assure that branches and constants are executed last */
+ for (irn = nodeset_first(ready_set); irn; irn = nodeset_next(ready_set)) {
+ if (! arch_irn_class_is(arch_env, irn, branch)) {
+ nodeset_break(ready_set);
+ return irn;
+ }
+ }
+
+ /* at last: schedule branches */
+ irn = nodeset_first(ready_set);
+ nodeset_break(ready_set);
+
+ return irn;
+}
+
+static void *trivial_init_graph(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg)
+{
+ return (void *)arch_env;
+}
+
+static void *trivial_init_block(void *graph_env, ir_node *bl)
+{
+ return graph_env;
+}
+
+static const list_sched_selector_t trivial_selector_struct = {
+ trivial_init_graph,
+ trivial_init_block,
+ trivial_select,
+ NULL, /* to_appear_in_schedule */
+ NULL, /* node_ready */
+ NULL, /* node_selected */
+ NULL, /* exectime */
+ NULL, /* latency */
+ NULL, /* finish_block */
+ NULL /* finish_graph */
+};
+
+const list_sched_selector_t *trivial_selector = &trivial_selector_struct;