3 * @author Sebastian Hack
21 #include "besched_t.h"
22 #include "belistsched.h"
25 #include "bephicongr_t.h"
26 #include "bechordal.h"
27 #include "bechordal.h"
34 typedef struct _be_graph_info_t {
35 bitset_t *applied_phases;
38 static size_t be_info_offset = 0;
40 #define get_irg_be_info(irg) get_irg_data(irg, be_graph_info_t, be_info_offset)
42 static int phase_ids = 1;
43 static struct obstack obst;
45 int phase_register(phase_t *phase)
47 phase->id = phase_ids;
51 void phase_applied(const ir_graph *irg, const phase_t *phase)
53 be_graph_info_t *info = get_irg_be_info(irg);
55 if(!info->applied_phases)
56 info->applied_phases = bitset_obstack_alloc(&obst, N_PHASES);
58 bitset_set(info->applied_phases, phase->id);
61 int phase_depends_on(const ir_graph *irg, const phase_t *phase, int n, ...)
68 const be_graph_info_t *info = get_irg_be_info(irg);
69 const bitset_t *applied_phases = info->applied_phases;
73 for(i = 0; i < n; ++i) {
74 const phase_t *dep_phase = va_arg(args, const phase_t *);
76 if(!applied_phases || !bitset_is_set(applied_phases, dep_phase->id)) {
78 fprintf(stderr, "phase dependency unfulfilled: \"%s\" depends on \"%s\"\n",
79 phase->name, dep_phase->name);
85 assert(errors > 0 && "There were phase dependency errors");
94 be_info_offset = register_additional_graph_data(sizeof(be_graph_info_t));
100 be_ra_chordal_init();
101 be_phi_congr_class_init();
104 extern void be_ra_chordal(ir_graph *irg);
106 static void be_main_loop(void)
110 for(i = 0, n = get_irp_n_irgs(); i < n; ++i) {
111 ir_graph *irg = get_irp_irg(i);
113 localize_consts(irg);
115 list_sched(irg, trivial_selector, NULL);
120 // dump_allocated_irg(irg);
122 #ifndef DO_STATISTICS
123 be_ra_chordal_done(irg);
124 be_numbering_done(irg);
129 void be_main(int argc, const char *argv[])