3 * @author Sebastian Hack
18 #include "besched_t.h"
19 #include "belistsched.h"
21 #include "bephicongr_t.h"
26 typedef struct _be_graph_info_t {
27 bitset_t *applied_phases;
30 static size_t be_info_offset = 0;
32 #define get_irg_be_info(irg) get_irg_data(irg, be_graph_info_t, be_info_offset)
34 static int phase_ids = 1;
35 static struct obstack obst;
37 int phase_register(phase_t *phase)
39 phase->id = phase_ids;
43 void phase_applied(const ir_graph *irg, const phase_t *phase)
45 be_graph_info_t *info = get_irg_be_info(irg);
47 if(!info->applied_phases)
48 info->applied_phases = bitset_obstack_alloc(&obst, N_PHASES);
50 bitset_set(info->applied_phases, phase->id);
53 int phase_depends_on(const ir_graph *irg, const phase_t *phase, int n, ...)
60 const be_graph_info_t *info = get_irg_be_info(irg);
61 const bitset_t *applied_phases = info->applied_phases;
65 for(i = 0; i < n; ++i) {
66 const phase_t *dep_phase = va_arg(args, const phase_t *);
68 if(!applied_phases || !bitset_is_set(applied_phases, dep_phase->id)) {
70 fprintf(stderr, "phase dependency unfulfilled: \"%s\" depends on \"%s\"\n",
71 phase->name, dep_phase->name);
77 assert(errors > 0 && "There were phase dependency errors");
86 be_info_offset = register_additional_graph_data(sizeof(be_graph_info_t));
92 be_phi_congr_class_init();
95 extern void be_ra_chordal(ir_graph *irg);
97 static void be_main_loop(void)
101 for(i = 0, n = get_irp_n_irgs(); i < n; ++i) {
102 ir_graph *irg = get_irp_irg(i);
105 list_sched(irg, trivial_selector, NULL);
109 dump_allocated_irg(irg);
112 be_ra_chordal_done(irg);
113 be_numbering_done(irg);
117 void be_main(int argc, const char *argv[])
120 /* next line only for statistics */
121 /* do_phi_statistics(); */