This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[new-ra] Don't special-case stack pseudos


Hi,

it's more clever and esthetically pleasing to handle stack pseudos as
easily spillable nodes, instead of removing them from the graph
alltogether as first step (on average this spills less webs).
Bootstrapped on x86+amd64 all langs (with MICHAEL).


Ciao,
Michael.
-- 
        * ra-colorize.c (build_worklists): Don't special-case stack
        pseudos.
        (select_spill): Prefer to spill stack pseudos.

Index: ra-colorize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-colorize.c,v
retrieving revision 1.1.2.18
diff -u -p -r1.1.2.18 ra-colorize.c
--- ra-colorize.c	13 Oct 2003 13:02:27 -0000	1.1.2.18
+++ ra-colorize.c	10 Nov 2003 12:19:41 -0000
@@ -329,7 +329,7 @@ build_worklists (struct df *df ATTRIBUTE
     {
       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
 	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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]