From af5ad235c9f5d630b387209bd93a277579acd22d Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 1 Sep 1992 11:13:42 +0000 Subject: [PATCH] Small change in register allocation criteria --- util/ego/ra/ra.c | 10 ++++------ util/ego/ra/ra_profits.c | 3 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/util/ego/ra/ra.c b/util/ego/ra/ra.c index 0cbfac005..de78b26d3 100644 --- a/util/ego/ra/ra.c +++ b/util/ego/ra/ra.c @@ -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; } @@ -367,7 +365,7 @@ ra_optimize(p) instrmap = (line_p *) newmap(nrinstrs-1); /* map starts counting at 0 */ make_instrmap(p,instrmap); build_lifetimes(items); - /* print_items(items,p); */ + /* print_items(items,p); */ /* statistics(items); */ itemlist = cat_items(items); /* make one list */ alloclist = build_alloc_list(p,Lnrelems(p->p_loops), @@ -378,7 +376,7 @@ ra_optimize(p) pack(alloclist,time_opt,&packed,&unpacked,p); stat_regusage(packed); xform_proc(p,packed,nrinstrs,instrmap); - /* print_allocs(packed); */ + /* print_allocs(packed); */ p->p_localbytes = locls; /* don't really allocate dummy local variables! */ rem_locals(p,packed); diff --git a/util/ego/ra/ra_profits.c b/util/ego/ra/ra_profits.c index fd6e237b5..455f80c66 100644 --- a/util/ego/ra/ra_profits.c +++ b/util/ego/ra/ra_profits.c @@ -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; -- 2.34.1