- localize_consts(irg);
- if (DUMP_LOCAL) {
- dump_consts_local(0);
- dump_ir_block_graph(irg, "-local");
- }
-
- be_numbering(irg);
- list_sched(irg, trivial_selector, NULL);
- be_liveness(irg);
- be_ra_chordal(irg);
- //be_phi_opt(irg);
- //be_phi_destruction(irg);
-
- be_ra_chordal_done(irg);
- be_numbering_done(irg);
+ const arch_code_generator_if_t *cg_if;
+
+ DBG((env.dbg, LEVEL_2, "====> IRG: %F\n", irg));
+ dump(DUMP_INITIAL, irg, "-begin", dump_ir_block_graph);
+
+ /* set the current graph (this is important for several firm functions) */
+ current_ir_graph = irg;
+
+ /* Get the code generator interface. */
+ cg_if = isa->impl->get_code_generator_if(isa);
+
+ /* get a code generator for this graph. */
+ env.cg = cg_if->init(file_handle, irg, env.arch_env);
+
+ /* create the code generator and generate code. */
+ prepare_graph(&env, irg);
+ arch_code_generator_prepare_graph(env.cg);
+
+ edges_deactivate(irg);
+ dead_node_elimination(irg);
+ edges_activate(irg);
+
+ dump(DUMP_PREPARED, irg, "-prepared", dump_ir_block_graph);
+
+ /* Schedule the graphs. */
+ arch_code_generator_before_sched(env.cg);
+ list_sched(isa, irg);
+
+ dump(DUMP_SCHED, irg, "-sched", dump_ir_block_graph_sched);
+
+ /* Verify the schedule */
+ sched_verify_irg(irg);
+
+ /* Do register allocation */
+ arch_code_generator_before_ra(env.cg);
+ ra->allocate(&env, irg);
+
+ dump(DUMP_RA, irg, "-ra", dump_ir_block_graph_sched);
+
+ arch_code_generator_done(env.cg);
+ dump(DUMP_FINAL, irg, "-end", dump_ir_block_graph_sched);