4 #include "firm_config.h"
8 typedef struct _ilp_sched_selector_t ilp_sched_selector_t;
11 * A selector interface which is used by the ILP schedule framework.
12 * These functions provide the ILP scheduler with necessary information
13 * from the backend or they pass back information to the backend about
14 * the state of scheduling.
16 struct _ilp_sched_selector_t {
19 * This function is called before the scheduling of the irg.
20 * @param self The this pointer.
21 * @param irg The irg being scheduled.
22 * @return An irg scheduling environment.
24 void *(*init_irg_ilp_schedule)(const void *self, ir_graph *irg);
27 * This functions is called after an irg has been scheduled.
28 * @param self The this pointer.
29 * @param irg The irg which has been scheduled.
30 * @param irg_env The irg scheduling environment.
32 void (*finish_irg_ilp_schedule)(const void *self, ir_graph *irg, void *irg_env);
35 * This function is called before the scheduling of a block starts.
36 * @param self The this pointer.
37 * @param block The block being scheduled.
38 * @return A block scheduling environment.
40 void *(*init_block_ilp_schedule)(const void *self, ir_node *block);
43 * This functions is called after a block has been scheduled.
44 * @param self The this pointer.
45 * @param block The block which has been scheduled.
46 * @param block_env The block scheduling environment.
48 void (*finish_block_ilp_schedule)(const void *self, ir_node *block, void *block_env);
51 * Calculates the latency of node @p irn.
52 * @param self The this pointer.
53 * @param irn The node.
54 * @param block_env The block scheduling environment.
55 * @return The latency in cycles of node @p irn.
57 unsigned (*latency)(const void *self, ir_node *irn, void *block_env);
60 * This function is called after a certain node has been scheduled.
61 * @param self The this pointer.
62 * @param irn The node which has been scheduled.
63 * @param cycle The cycle at which the node is scheduled.
64 * @param block_env The block scheduling environment.
66 void (*node_scheduled)(const void *self, ir_node *irn, unsigned cycle, void *block_env);
69 #define BE_ILP_SCHED_CALL(func, self, obj, env) \
72 (self)->func((self), (obj), (env)); \
75 #define BE_ILP_SCHED_CALL2(func, self, obj, obj2, env) \
78 (self)->func((self), (obj), (obj2), (env)); \
81 #define BE_ILP_SCHED_CALL_ENVRET(func, self, obj, defret) \
82 ((self)->func ? (self)->func((self), (obj)) : (defret))
84 #define BE_ILP_SCHED_CALL_RET(func, self, obj, env, defret) \
85 ((self)->func ? (self)->func((self), (obj), (env)) : (defret))
88 * Convenience macros for all functions.
91 #define be_ilp_sched_init_irg_ilp_schedule(self, irg) \
92 BE_ILP_SCHED_CALL_ENVRET(init_irg_ilp_schedule, self, irg, NULL)
94 #define be_ilp_sched_finish_irg_ilp_schedule(self, irg, irg_env) \
95 BE_ILP_SCHED_CALL(finish_irg_ilp_schedule, self, irg, irg_env)
97 #define be_ilp_sched_init_block_ilp_schedule(self, block) \
98 BE_ILP_SCHED_CALL_ENVRET(init_block_ilp_schedule, self, block, NULL)
100 #define be_ilp_sched_finish_block_ilp_schedule(self, block, block_env) \
101 BE_ILP_SCHED_CALL(finish_block_ilp_schedule, self, block, block_env)
103 #define be_ilp_sched_latency(self, irn, block_env) \
104 BE_ILP_SCHED_CALL_RET(latency, self, irn, block_env, 0)
106 #define be_ilp_sched_node_scheduled(self, irn, cycle, block_env) \
107 BE_ILP_SCHED_CALL2(node_scheduled, self, irn, cycle, block_env)
110 * Perform ILP scheduling on given birg.
112 void be_ilp_sched(const be_irg_t *birg);
116 #include <libcore/lc_opts.h>
117 #include <libcore/lc_opts_enum.h>
120 * Register ILP scheduler options.
122 void ilpsched_register_options(lc_opt_entry_t *grp);
124 #endif /* WITH_LIBCORE */
126 #endif /* _BEILPSCHED_H_ */