From 7b753172312c75de5bc5e4562b3847a7d33b2606 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Mon, 12 Dec 2011 12:29:43 +0100 Subject: [PATCH] Fix the way simplifiable node are colored when alignment is in the game --- ir/be/becopyilp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ir/be/becopyilp.c b/ir/be/becopyilp.c index 69684b433..3e3484845 100644 --- a/ir/be/becopyilp.c +++ b/ir/be/becopyilp.c @@ -187,14 +187,29 @@ void sr_reinsert(size_red_t *sr) /* get free color by inspecting all neighbors */ be_ifg_foreach_neighbour(ifg, &iter, irn, other) { + const arch_register_req_t *cur_req; + unsigned cur_col; + /* only inspect nodes which are in graph right now */ if (sr_is_removed(sr, other)) continue; - rbitset_clear(possible_cols, get_irn_col(other)); + + cur_req = arch_get_irn_register_req(other); + cur_col = get_irn_col(other); + + /* Invalidate all single size register when it is a large one */ + do { + rbitset_clear(possible_cols, cur_col); + ++cur_col; + } while ((cur_col % cur_req->width) != 0); } /* now all bits not set are possible colors */ - free_col = (unsigned)rbitset_next(possible_cols, 0, true); + /* take one that matches the alignment constraint */ + do { + free_col = (unsigned)rbitset_next(possible_cols, 0, true); + } while ((free_col % arch_get_irn_register_req(irn)->width) != 0 + && free_col != n_regs - 1); assert(!rbitset_is_empty(possible_cols, n_regs) && "No free color found. This can not be."); set_irn_col(sr->co->cls, irn, free_col); pset_remove_ptr(sr->all_removed, irn); /* irn is back in graph again */ -- 2.20.1