2 * Primitive list scheduling.
4 * @author Sebastian Hack
7 #ifndef _FIRM_LIST_SCHED
8 #define _FIRM_LIST_SCHED
19 typedef struct _list_sched_selector_t list_sched_selector_t;
22 * A selector interface which is used by the list schedule framework.
23 * You can implement your own list scheduler by implementing these
26 struct _list_sched_selector_t {
29 * Called before a graph is being scheduled.
30 * @param arch_env The architecture environment.
31 * @param irg The graph.
32 * @return The environment pointer that is passed to all other functions in this struct.
34 void *(*init_graph)(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg);
37 * Called before scheduling starts on a block.
38 * @param graph_env The environment.
39 * @param block The block which is to be scheduled.
40 * @return A per-block pointer that is additionally passed to select.
42 void *(*init_block)(void *graph_env, ir_node *block);
45 * The selection function.
46 * It picks one node out of the ready list to be scheduled next.
47 * The function does not have to delete the node from the ready set.
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 *block_env, pset *ready_set);
60 * This function decides, if a node should appear in a schedule.
61 * @param block_env The block environment.
62 * @param irn The node.
63 * @return 1, if the node should be scheduled, 0 if not.
65 int (*to_appear_in_schedule)(void *block_env, const ir_node *irn);
68 * Called after a block has been scheduled.
69 * @param env The environment.
70 * @param block_env The per block environment as returned by init_block().
72 void (*finish_block)(void *block_env);
75 * Called after a whole graph has been scheduled.
76 * @param env The environment.
78 void (*finish_graph)(void *env);
84 * A trivial selector, that just selects the first ready node.
86 extern const list_sched_selector_t *trivial_selector;
89 * A selector that tries to minimize the register pressure.
90 * @note Not really operational yet.
92 extern const list_sched_selector_t *reg_pressure_selector;
95 * List schedule a graph.
96 * Each block in the graph gets a list head to its link field being the
97 * head of the schedule. You can walk this list using the functions in
99 * @param arch_env The architecture environment.
100 * @param irg The graph to schedule.
102 void list_sched(const arch_env_t *arch_env, ir_graph *irg);
104 #endif /* _FIRM_LIST_SCHED */