2 * Primitive list scheduling.
4 * @author Sebastian Hack
7 #ifndef _FIRM_LIST_SCHED
8 #define _FIRM_LIST_SCHED
20 * A selector interface which is used by the list schedule framework.
21 * You can implement your own list scheduler by implementing these
24 typedef struct _list_sched_selector_t {
27 * Called before a graph is being scheduled.
29 * @param irg The graph.
30 * @return The environment pointer that is passed to all other
31 * functions in this struct.
33 void *(*init_graph)(const struct _arch_isa_t *isa, ir_graph *irg);
36 * Called before scheduling starts on a block.
37 * @param env The environment.
38 * @param block The block which is to be scheduled.
39 * @return A per-block pointer that is additionally passed to select.
41 void *(*init_block)(void *env, ir_node *block);
44 * The selection function.
45 * It picks one node out of the ready list to be scheduled next.
46 * The function does not have to delete the node from the ready set.
48 * @param env Some private information as returned by init_graph().
49 * @return block_env Some private information as returned by init_block().
50 * @param sched_head The schedule so far.
51 * @param curr_time The current time step which the picked node
52 * will be assigned to.
53 * @param ready_list A set containing all ready nodes. Pick one of these
55 * @return The chosen node.
57 ir_node *(*select)(void *env, void *block_env,
58 const struct list_head *sched_head,
59 int curr_time, pset *ready_set);
62 * Called after a block has been scheduled.
63 * @param env The environment.
64 * @param block_env The per block environment as returned by init_block().
65 * @param block The block that has been finished.
67 void (*finish_block)(void *env, void *block_env, ir_node *block);
70 * Called after a whole graph has been scheduled.
71 * @param env The environment.
72 * @param irg The graph.
74 void (*finish_graph)(void *env, ir_graph *irg);
75 } list_sched_selector_t;
79 * A trivial selector, that just selects the first ready node.
81 extern const list_sched_selector_t *trivial_selector;
84 * List schedule a graph.
85 * Each block in the graph gets a list head to its link field being the
86 * head of the schedule. You can walk this list using the functions in
88 * @param isa The isa which implements the scheduler.
89 * @param irg The graph to schedule.
91 void list_sched(const struct _arch_isa_t *isa, ir_graph *irg);