4 #include "firm_config.h"
9 typedef struct _ilp_sched_selector_t ilp_sched_selector_t;
12 * A selector interface which is used by the ILP schedule framework.
13 * These functions provide the ILP scheduler with necessary information
14 * from the backend or they pass back information to the backend about
15 * the state of scheduling.
17 struct _ilp_sched_selector_t {
20 * This function is called before the scheduling of the irg.
21 * @param self The this pointer.
22 * @param irg The irg being scheduled.
23 * @return An irg scheduling environment.
25 void *(*init_irg_ilp_schedule)(const void *self, ir_graph *irg);
28 * This functions is called after an irg has been scheduled.
29 * @param self The this pointer.
30 * @param irg The irg which has been scheduled.
31 * @param irg_env The irg scheduling environment.
33 void (*finish_irg_ilp_schedule)(const void *self, ir_graph *irg, void *irg_env);
36 * This function is called before the scheduling of a block starts.
37 * @param self The this pointer.
38 * @param block The block being scheduled.
39 * @return A block scheduling environment.
41 void *(*init_block_ilp_schedule)(const void *self, ir_node *block);
44 * This functions is called after a block has been scheduled.
45 * @param self The this pointer.
46 * @param block The block which has been scheduled.
47 * @param block_env The block scheduling environment.
49 void (*finish_block_ilp_schedule)(const void *self, ir_node *block, void *block_env);
52 * Calculates the latency of node @p irn.
53 * @param self The this pointer.
54 * @param irn The node.
55 * @param block_env The block scheduling environment.
56 * @return The latency in cycles of node @p irn.
58 unsigned (*latency)(const void *self, ir_node *irn, void *block_env);
61 * This function is called after a certain node has been scheduled.
62 * @param self The this pointer.
63 * @param irn The node which has been scheduled.
64 * @param cycle The cycle at which the node is scheduled.
65 * @param block_env The block scheduling environment.
67 void (*node_scheduled)(const void *self, ir_node *irn, unsigned cycle, void *block_env);
70 #define BE_ILP_SCHED_CALL(func, self, obj, env) \
72 if ((self) && (self)->func) \
73 (self)->func((self), (obj), (env)); \
76 #define BE_ILP_SCHED_CALL2(func, self, obj, obj2, env) \
78 if ((self) && (self)->func) \
79 (self)->func((self), (obj), (obj2), (env)); \
82 #define BE_ILP_SCHED_CALL_ENVRET(func, self, obj, defret) \
83 ((self) && (self)->func ? (self)->func((self), (obj)) : (defret))
85 #define BE_ILP_SCHED_CALL_RET(func, self, obj, env, defret) \
86 ((self) && (self)->func ? (self)->func((self), (obj), (env)) : (defret))
89 * Convenience macros for all functions.
92 #define be_ilp_sched_init_irg_ilp_schedule(self, irg) \
93 BE_ILP_SCHED_CALL_ENVRET(init_irg_ilp_schedule, self, irg, NULL)
95 #define be_ilp_sched_finish_irg_ilp_schedule(self, irg, irg_env) \
96 BE_ILP_SCHED_CALL(finish_irg_ilp_schedule, self, irg, irg_env)
98 #define be_ilp_sched_init_block_ilp_schedule(self, block) \
99 BE_ILP_SCHED_CALL_ENVRET(init_block_ilp_schedule, self, block, NULL)
101 #define be_ilp_sched_finish_block_ilp_schedule(self, block, block_env) \
102 BE_ILP_SCHED_CALL(finish_block_ilp_schedule, self, block, block_env)
104 #define be_ilp_sched_latency(self, irn, block_env) \
105 BE_ILP_SCHED_CALL_RET(latency, self, irn, block_env, 0)
107 #define be_ilp_sched_node_scheduled(self, irn, cycle, block_env) \
108 BE_ILP_SCHED_CALL2(node_scheduled, self, irn, cycle, block_env)
111 * Perform ILP scheduling on given birg.
113 void be_ilp_sched(const be_irg_t *birg);
117 #include <libcore/lc_opts.h>
118 #include <libcore/lc_opts_enum.h>
121 * Register ILP scheduler options.
123 void ilpsched_register_options(lc_opt_entry_t *grp);
125 #endif /* WITH_LIBCORE */
127 #endif /* _BEILPSCHED_H_ */