Small change in register allocation criteria
This commit is contained in:
parent
ee6d91a1d4
commit
af5ad235c9
|
@ -241,15 +241,13 @@ STATIC bool useful_item(item)
|
||||||
item_p item;
|
item_p item;
|
||||||
{
|
{
|
||||||
/* See if it may be useful to put the item in a register.
|
/* See if it may be useful to put the item in a register.
|
||||||
* A local variable that is not a parameter may always be put
|
* A local variable may always be put in a register.
|
||||||
* in a register (as it need not be initialized).
|
|
||||||
* Other items must be used at least twice.
|
* Other items must be used at least twice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int nruses = Lnrelems(item->it_usage);
|
int nruses = Lnrelems(item->it_usage);
|
||||||
assert (nruses > 0); /* otherwise it would not be an item! */
|
assert (nruses > 0); /* otherwise it would not be an item! */
|
||||||
return nruses > 1 || (item->it_type == LOCALVAR &&
|
return nruses > 1 || item->it_type == LOCALVAR;
|
||||||
item->i_t.it_off < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,9 @@ compute_profits(alloclist,time_opt)
|
||||||
}
|
}
|
||||||
t = cnt * time - dyn_inits(alloc->al_inits) * otime;
|
t = cnt * time - dyn_inits(alloc->al_inits) * otime;
|
||||||
sc = (time_opt ? t : s);
|
sc = (time_opt ? t : s);
|
||||||
|
/*
|
||||||
|
fprintf(stderr, "cnt: %d time: %d otime: %d t: %d s: %d score: %d\n", cnt, time, otime, t, s, sc);
|
||||||
|
*/
|
||||||
if (sc > maxsc) {
|
if (sc > maxsc) {
|
||||||
maxsc = sc;
|
maxsc = sc;
|
||||||
alloc->al_regtype = rtyp;
|
alloc->al_regtype = rtyp;
|
||||||
|
|
Loading…
Reference in a new issue