- const be_main_env_t *main_env = bi->main_env;
- const arch_isa_t *isa = arch_env_get_isa(main_env->arch_env);
- ir_graph *irg = bi->irg;
- be_options_t *main_opts = main_env->options;
- int splitted = 0;
-
- int j, m;
- be_chordal_env_t chordal_env;
-
- BE_TIMER_INIT(main_opts);
- BE_TIMER_PUSH(ra_timer.t_other);
- BE_TIMER_PUSH(ra_timer.t_prolog);
-
- compute_doms(irg);
-
- chordal_env.opts = &options;
- chordal_env.irg = irg;
- chordal_env.birg = bi;
- chordal_env.dom_front = be_compute_dominance_frontiers(irg);
- chordal_env.exec_freq = compute_execfreq(irg, be_loop_weight);
- chordal_env.lv = be_liveness(irg);
- FIRM_DBG_REGISTER(chordal_env.dbg, "firm.be.chordal");
-
- obstack_init(&chordal_env.obst);
-
- BE_TIMER_POP(ra_timer.t_prolog);
-
- /* Perform the following for each register class. */
- for (j = 0, m = arch_isa_get_n_reg_class(isa); j < m; ++j) {
- chordal_env.cls = arch_isa_get_reg_class(isa, j);
- chordal_env.border_heads = pmap_create();
- chordal_env.ignore_colors = bitset_malloc(chordal_env.cls->n_regs);
-
- /* put all ignore registers into the ignore register set. */
- put_ignore_colors(&chordal_env);
-
- BE_TIMER_PUSH(ra_timer.t_live);
- be_liveness_recompute(chordal_env.lv);
- BE_TIMER_POP(ra_timer.t_live);
- dump(BE_CH_DUMP_LIVE, irg, chordal_env.cls, "-live", dump_ir_block_graph_sched);
-
- be_pre_spill_prepare_constr(&chordal_env);
- dump(BE_CH_DUMP_CONSTR, irg, chordal_env.cls, "-constr-pre", dump_ir_block_graph_sched);
-
- BE_TIMER_PUSH(ra_timer.t_spill);
-
- /* spilling */
- switch(options.spill_method) {
- case BE_CH_SPILL_MORGAN:
- be_spill_morgan(&chordal_env);
- break;
- case BE_CH_SPILL_BELADY:
- be_spill_belady(&chordal_env);
- break;
-#ifdef WITH_ILP
- case BE_CH_SPILL_REMAT:
- be_spill_remat(&chordal_env);
- break;
-#endif /* WITH_ILP */
- default:
- fprintf(stderr, "no valid spiller selected. falling back to belady\n");
- be_spill_belady(&chordal_env);
- }