2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Trivial node selector.
23 * @author Sebastian Hack
33 #include "irnodeset.h"
36 #include "belistsched.h"
41 * The trivial selector:
42 * Just assure that branches are executed last, otherwise select
43 * the first node ready.
45 static ir_node *trivial_select(void *block_env, ir_nodeset_t *ready_set,
46 ir_nodeset_t *live_set)
49 ir_nodeset_iterator_t iter;
53 /* assure that branches and constants are executed last */
54 foreach_ir_nodeset(ready_set, irn, iter) {
60 /* at last: schedule branches */
61 ir_nodeset_iterator_init(&iter, ready_set);
62 irn = ir_nodeset_iterator_next(&iter);
67 static void *trivial_init_graph(ir_graph *irg)
73 static void *trivial_init_block(void *graph_env, ir_node *block)
80 static void sched_trivial(ir_graph *irg)
82 static const list_sched_selector_t trivial_selector = {
86 NULL, /* node_ready */
87 NULL, /* node_selected */
88 NULL, /* finish_block */
89 NULL /* finish_graph */
91 be_list_sched_graph(irg, &trivial_selector);
94 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched_trivial);
95 void be_init_sched_trivial(void)
97 be_register_scheduler("trivial", sched_trivial);