From 58765e7aeba88d7770af0afded018447a6d135cc Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 19 Dec 2012 13:51:13 +0100 Subject: [PATCH] becopyilp: Use the set of admissible registers from bechordal. --- ir/be/becopyilp.c | 15 +++++---------- ir/be/becopyilp2.c | 20 ++++++-------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/ir/be/becopyilp.c b/ir/be/becopyilp.c index 020ef9371..35c02ca7e 100644 --- a/ir/be/becopyilp.c +++ b/ir/be/becopyilp.c @@ -139,23 +139,18 @@ static void sr_remove(ilp_env_t *const ienv) */ 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; diff --git a/ir/be/becopyilp2.c b/ir/be/becopyilp2.c index 455fa1ad4..bd286654f 100644 --- a/ir/be/becopyilp2.c +++ b/ir/be/becopyilp2.c @@ -598,26 +598,18 @@ static void ilp2_apply(ilp_env_t *ienv) */ 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; -- 2.20.1