*/
static void sr_reinsert(ilp_env_t *const ienv)
{
- ir_graph *irg = ienv->co->irg;
- be_ifg_t *ifg = ienv->co->cenv->ifg;
- unsigned n_regs = arch_register_class_n_regs(ienv->co->cls);
-
- unsigned *const allocatable_cols = rbitset_alloca(n_regs);
- be_set_allocatable_regs(irg, ienv->co->cls, allocatable_cols);
-
- unsigned *const possible_cols = rbitset_alloca(n_regs);
- neighbours_iter_t iter;
-
/* color the removed nodes in right order */
+ unsigned const n_regs = arch_register_class_n_regs(ienv->co->cls);
+ unsigned *const possible_cols = rbitset_alloca(n_regs);
+ unsigned const *const allocatable_cols = ienv->co->cenv->allocatable_regs->data;
+ be_ifg_t const *const ifg = ienv->co->cenv->ifg;
for (size_t i = ARR_LEN(ienv->col_suff); i-- != 0;) {
ir_node *const irn = ienv->col_suff[i];
rbitset_copy(possible_cols, allocatable_cols, n_regs);
/* get free color by inspecting all neighbors */
+ neighbours_iter_t iter;
be_ifg_foreach_neighbour(ifg, &iter, irn, other) {
const arch_register_req_t *cur_req;
unsigned cur_col;
*/
static int co_solve_ilp2(copy_opt_t *co)
{
- unsigned n_regs = arch_register_class_n_regs(co->cls);
- lpp_sol_state_t sol_state;
- ilp_env_t *ienv;
- local_env_t my;
-
ASSERT_OU_AVAIL(co); //See build_clique_st
ASSERT_GS_AVAIL(co);
- my.first_x_var = -1;
- my.last_x_var = -1;
FIRM_DBG_REGISTER(dbg, "firm.be.coilp2");
- unsigned *const allocatable_colors = rbitset_alloca(n_regs);
- be_set_allocatable_regs(co->irg, co->cls, allocatable_colors);
- my.allocatable_colors = allocatable_colors;
-
- ienv = new_ilp_env(co, ilp2_build, ilp2_apply, &my);
-
- sol_state = ilp_go(ienv);
+ local_env_t my;
+ my.first_x_var = -1;
+ my.last_x_var = -1;
+ my.allocatable_colors = co->cenv->allocatable_regs->data;
+ ilp_env_t *const ienv = new_ilp_env(co, ilp2_build, ilp2_apply, &my);
+ lpp_sol_state_t const sol_state = ilp_go(ienv);
free_ilp_env(ienv);
return sol_state == lpp_optimal;