> These errors look remarkable the same, when I turn on OPT_SUB that is,
> when allocate_wanted_regs() is used. And this code did miss registers
> sets like 'K' (compound keys).
>
> Changing imcc/reg_alloc.c:890 to:
>
> if (r->color >= 0 || r->want_regno == -1 || strchr("ISPN", r->set
> == 0))
>
> did fix this flaw.
>
> leo
You're patch looks suspiciously like a typo. strchr("ISPN", r->set == 0))
will always returns true if r->set != 0. This means that the patch
effectively disables allocate_wanted_regs(), unless there are certain
cases where r->set==0, which I doubt.
Try sticking this toward the beginning of imc_reg_alloc(), but after
build_interference_graph, like imcc/reg_alloc.c:187 (or so)
#ifndef NDEBUG
{
int x,y;
for (x = 0; x < unit->n_symbols; x++) {
SymReg* r = unit->reglist[x];
for (y = 0; y < unit->n_symbols; y++) {
if (ig_test(x, y, unit->n_symbols, unit->interference_graph)) {
if(r->color!=-1 && r->color == unit->reglist[y]->color)
fprintf(stderr,"node %d = %s(%c) is colored %d and "
"neighbor %d = %s(%c) is colored %d\n",
x,r->name,r->set,r->color,
y,unit->reglist[y]->name,unit->reglist[y]->set,
unit->reglist[y]->color);
assert(r->color==-1 || r->color != unit->reglist[y]->color);
}
}
}
}
#endif
And before ...
while (todo) {