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]

new allocator: combine add_hardregs



Sun Mar 11 21:30:14 2001  Denis Chertykov  <denisc@overta.ru>

	* ra.c: include "tm_p.h"
	(hardreg2web): New array.
	(parts_to_webs): Initialize `hardreg2web'.
	(combine): Use `hardreg2web' for combining add_hardregs's.
	(colorize_one_web): Fix comment.


Index: ra.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/ra.c,v
retrieving revision 1.1.2.6
diff -c -3 -p -r1.1.2.6 ra.c
*** ra.c	2001/02/25 22:29:22	1.1.2.6
--- ra.c	2001/03/11 18:39:40
***************
*** 33,38 ****
--- 33,39 ----
  #include "expr.h"
  #include "output.h"
  #include "toplev.h"
+ #include "tm_p.h"
  
  /* The algorithm used is currently Iterated Register Coalescing by
     L.A.George, and Appel.
*************** static struct web_link **conflicts; /* X
*** 272,277 ****
--- 273,279 ----
  static struct move_list *wl_moves;
  static struct ref **all_defs_for_web;
  static struct ref **all_uses_for_web;
+ static struct web *hardreg2web[FIRST_PSEUDO_REGISTER];
  
  /* Used to detect spill instructions inserted by me.  */
  static int orig_max_uid;
*************** parts_to_webs (df, part2web)
*** 1120,1125 ****
--- 1122,1129 ----
  	  web->span_insns = wp->spanned_insns;
  	  part2web[i] = web;
  	  id2web[webnum] = web;
+ 	  if (regno < FIRST_PSEUDO_REGISTER)
+ 	    hardreg2web[regno] = web;
  	  webnum++;
  	}
        else
*************** combine (u, v)
*** 2060,2072 ****
    u->is_coalesced = 1;
    v->is_coalesced = 1;
    merge_moves (u, v);
!   /* XXX combine add_hardregs's of U and V.  */
!   for (wl = conflicts[v->id]; wl; wl = wl->next)
!     if (wl->web->type != SELECT && wl->web->type != COALESCED)
!       {
!         record_conflict (u, wl->web);
!         decrement_degree (wl->web, 1 + v->add_hardregs);
!       }
    if (u->num_conflicts >= NUM_REGS (u) && u->type == FREEZE)
      {
        remove_list (u->dlink, &freeze_wl);
--- 2064,2095 ----
    u->is_coalesced = 1;
    v->is_coalesced = 1;
    merge_moves (u, v);
!   /* Combine add_hardregs's of U and V.  */
!   if (u->type == PRECOLORED)
!     {
!       int i;
!       struct web *web;
! 
!       for (i = 0; i <= v->add_hardregs; ++i)
! 	{
! 	  web = hardreg2web[i + u->color];
! 	  for (wl = conflicts[web->id]; wl; wl = wl->next)
! 	    {
! 	      record_conflict (u, wl->web);
! 	      decrement_degree (wl->web, 1 + v->add_hardregs);
! 	    }
! 	}
!     }
!   else
!     {
!       for (wl = conflicts[v->id]; wl; wl = wl->next)
! 	if (wl->web->type != SELECT && wl->web->type != COALESCED)
! 	  {
! 	    record_conflict (u, wl->web);
! 	    decrement_degree (wl->web, 1 + v->add_hardregs);
! 	  }
!     }
!   
    if (u->num_conflicts >= NUM_REGS (u) && u->type == FREEZE)
      {
        remove_list (u->dlink, &freeze_wl);
*************** colorize_one_web (web)
*** 2323,2329 ****
  	 alternate class.  For spill tempraries we only search in
  	 usable_regs of this web (which is probably larger than that of
  	 the preferred or alternate class).  All searches first try to
! 	 find a non-call-clobbered hard-reg.  
           XXX this should be more finegraned... First look into preferred
           non-callclobbered hardregs, then _if_ the web crosses calls, in
           alternate non-cc hardregs, and only _then_ also in preferred cc
--- 2346,2352 ----
  	 alternate class.  For spill tempraries we only search in
  	 usable_regs of this web (which is probably larger than that of
  	 the preferred or alternate class).  All searches first try to
! 	 find a call-clobbered hard-reg.  
           XXX this should be more finegraned... First look into preferred
           non-callclobbered hardregs, then _if_ the web crosses calls, in
           alternate non-cc hardregs, and only _then_ also in preferred cc


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