Small change in register allocation criteria

This commit is contained in:
ceriel 1992-09-01 11:13:42 +00:00
parent ee6d91a1d4
commit af5ad235c9
2 changed files with 7 additions and 6 deletions

View file

@ -241,15 +241,13 @@ STATIC bool useful_item(item)
item_p item;
{
/* 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
* in a register (as it need not be initialized).
* A local variable may always be put in a register.
* Other items must be used at least twice.
*/
int nruses = Lnrelems(item->it_usage);
assert (nruses > 0); /* otherwise it would not be an item! */
return nruses > 1 || (item->it_type == LOCALVAR &&
item->i_t.it_off < 0);
return nruses > 1 || item->it_type == LOCALVAR;
}

View file

@ -234,6 +234,9 @@ compute_profits(alloclist,time_opt)
}
t = cnt * time - dyn_inits(alloc->al_inits) * otime;
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) {
maxsc = sc;
alloc->al_regtype = rtyp;