From 9c12a8cb16a99face2e835adc95f8846d03cbd5c Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 10 Nov 2003 12:27:41 +0000 Subject: * ra-colorize.c (build_worklists): Don't special-case stack pseudos. (select_spill): Prefer to spill stack pseudos. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/new-regalloc-branch@73414 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.RA | 6 ++++++ gcc/ra-colorize.c | 52 ++++++++++------------------------------------------ 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/gcc/ChangeLog.RA b/gcc/ChangeLog.RA index ac2c78ae000..c55f9532f8e 100644 --- a/gcc/ChangeLog.RA +++ b/gcc/ChangeLog.RA @@ -1,3 +1,9 @@ +2003-11-10 Michael Matz + + * ra-colorize.c (build_worklists): Don't special-case stack + pseudos. + (select_spill): Prefer to spill stack pseudos. + 2003-11-10 Michael Matz * ra-rewrite.c (emit_loads): Do loads from rematerializable webs. diff --git a/gcc/ra-colorize.c b/gcc/ra-colorize.c index 5fe424c5758..80d402dc823 100644 --- a/gcc/ra-colorize.c +++ b/gcc/ra-colorize.c @@ -329,7 +329,7 @@ build_worklists (struct df *df ATTRIBUTE_UNUSED) { struct web *web = DLIST_WEB (d); d_next = d->next; - if (web->type == PRECOLORED || SPILL_SLOT_P (web->regno)) + if (web->type == PRECOLORED) continue; remove_list (d, &WEBS(INITIAL)); @@ -341,46 +341,6 @@ build_worklists (struct df *df ATTRIBUTE_UNUSED) put_web (web, SIMPLIFY); } - /* If we are not the first pass, put all stackwebs (which are still - backed by a new pseudo, but conceptually can stand for a stackslot, - i.e. it doesn't really matter if they get a color or not), on - the SELECT stack first, those with lowest cost first. This way - they will be colored last, so do not constrain the coloring of the - normal webs. But still those with the highest count are colored - before, i.e. get a color more probable. The use of stackregs is - a pure optimization, and all would work, if we used real stackslots - from the begin. */ - if (ra_pass > 1) - { - unsigned int i, num, max_num; - struct web **order2web; - max_num = num_webs - num_subwebs; - order2web = xmalloc (max_num * sizeof (order2web[0])); - for (i = 0, num = 0; i < max_num; i++) - if (SPILL_SLOT_P (id2web[i]->regno)) - order2web[num++] = id2web[i]; - if (num) - { - qsort (order2web, num, sizeof (order2web[0]), comp_webs_maxcost); - /*for (i = num - 1;; i--)*/ - for (i = 0; i < num; i++) - { - struct web *web = order2web[i]; - remove_list (web->dlink, &WEBS(INITIAL)); - put_web (web, SIMPLIFY); - /*put_web (web, SELECT); - for (wl = web->conflict_list; wl; wl = wl->next) - { - struct web *pweb = wl->t; - pweb->num_conflicts -= 1 + web->add_hardregs; - } - if (i == 0) - break;*/ - } - } - free (order2web); - } - /* And put all moves on the worklist for iterated coalescing. Note, that if iterated coalescing is off, then wl_moves doesn't contain any moves. */ @@ -999,7 +959,15 @@ select_spill (void) { struct web *w = DLIST_WEB (d); unsigned HOST_WIDE_INT cost = spill_heuristic (w); - if ((!w->spill_temp) && cost < best) + if (SPILL_SLOT_P (w->regno) + && (!bestd + || !SPILL_SLOT_P (DLIST_WEB (bestd)->regno) + || cost < best)) + { + best = cost; + bestd = d; + } + else if ((!w->spill_temp) && cost < best) { best = cost; bestd = d; -- cgit v1.2.3