2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Trivial node selector.
9 * @author Sebastian Hack
18 #include "irnodeset.h"
21 #include "belistsched.h"
26 * The trivial selector:
27 * Just assure that branches are executed last, otherwise select
28 * the first node ready.
30 static ir_node *trivial_select(void *block_env, ir_nodeset_t *ready_set)
34 /* assure that branches and constants are executed last */
35 foreach_ir_nodeset(ready_set, irn, iter) {
41 /* at last: schedule branches */
42 return ir_nodeset_first(ready_set);
45 static void *trivial_init_graph(ir_graph *irg)
51 static void *trivial_init_block(void *graph_env, ir_node *block)
58 static void sched_trivial(ir_graph *irg)
60 static const list_sched_selector_t trivial_selector = {
64 NULL, /* node_ready */
65 NULL, /* node_selected */
66 NULL, /* finish_block */
67 NULL /* finish_graph */
69 be_list_sched_graph(irg, &trivial_selector);
72 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched_trivial)
73 void be_init_sched_trivial(void)
75 be_register_scheduler("trivial", sched_trivial);