X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbecopyheur.c;h=58158c17a1099a7cb4a37c9f619b5200f20f74f0;hb=1eaf5821fab81ac32af068f5db303a8074764ffa;hp=fc26067bbba41966b3200e48d4a1b1b8efcb2112;hpb=bd4175dd9c290a499676ef53aa5c6c2106472c1d;p=libfirm diff --git a/ir/be/becopyheur.c b/ir/be/becopyheur.c index fc26067bb..58158c17a 100644 --- a/ir/be/becopyheur.c +++ b/ir/be/becopyheur.c @@ -390,11 +390,11 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou) { * safe: node has no interference, hence it is in every max stable set. * unsafe: node has an interference */ - safe = alloca((ou->node_count-1) * sizeof(*safe)); - safe_costs = 0; - safe_count = 0; - unsafe = alloca((ou->node_count-1) * sizeof(*unsafe)); - unsafe_costs = alloca((ou->node_count-1) * sizeof(*unsafe_costs)); + safe = ALLOCAN(ir_node*, ou->node_count - 1); + safe_costs = 0; + safe_count = 0; + unsafe = ALLOCAN(ir_node*, ou->node_count - 1); + unsafe_costs = ALLOCAN(int, ou->node_count - 1); unsafe_count = 0; for(i=1; inode_count; ++i) { int is_safe = 1; @@ -530,11 +530,13 @@ static inline void ou_insert_qnode(unit_t *ou, qnode_t *qn) { * nodes. (All other phi classes are reduced to this case.) */ static void ou_optimize(unit_t *ou) { - int i; - qnode_t *curr = NULL, *tmp; - const arch_register_class_t *cls = ou->co->cls; - bitset_pos_t idx; - bitset_t *pos_regs = bitset_alloca(cls->n_regs); + qnode_t *curr = NULL; + qnode_t *tmp; + const arch_register_req_t *req; + bitset_t const* ignore; + bitset_pos_t n_regs; + bitset_pos_t idx; + int i; DBG((dbg, LEVEL_1, "\tOptimizing unit:\n")); for (i=0; inode_count; ++i) @@ -543,16 +545,28 @@ static void ou_optimize(unit_t *ou) { /* init queue */ INIT_LIST_HEAD(&ou->queue); - arch_get_allocatable_regs(ou->nodes[0], -1, pos_regs); + req = arch_get_register_req_out(ou->nodes[0]); + ignore = ou->co->cenv->ignore_colors; + n_regs = req->cls->n_regs; + if (arch_register_req_is(req, limited)) { + rawbs_base_t const* limited = req->limited; - /* exclude ignore colors */ - bitset_andnot(pos_regs, ou->co->cenv->ignore_colors); + for (idx = 0; idx != n_regs; ++idx) { + if (bitset_is_set(ignore, idx)) + continue; + if (!rbitset_is_set(limited, idx)) + continue; - assert(bitset_popcnt(pos_regs) != 0 && "No register is allowed for this node !!?"); + ou_insert_qnode(ou, new_qnode(ou, idx)); + } + } else { + for (idx = 0; idx != n_regs; ++idx) { + if (bitset_is_set(ignore, idx)) + continue; - /* create new qnode */ - bitset_foreach(pos_regs, idx) - ou_insert_qnode(ou, new_qnode(ou, idx)); + ou_insert_qnode(ou, new_qnode(ou, idx)); + } + } /* search best */ for (;;) {