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]

Update for spill cost calculation


The following patch is an addition to John Wehle's change from Sep 5.  Now
that regs allocated by local-alloc can be reallocated if they are spilled,
the spill cost calculation no longer needs to take into account whether
the register was allocated by local-alloc or by global.

The patch is minimally tested (it compiles...), but I haven't verified its
effect on code quality.

Bernd

	* global.c (reg_allocno): Now static.
	* reload1.c (reg_allocno): Delete declaration.
	(order_regs_for_reload): Take no arguments.  Don't treat regs
	allocated by global differently than those allocated by local-alloc.

Index: global.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/global.c,v
retrieving revision 1.13
diff -u -p -r1.13 global.c
--- global.c	1998/09/08 00:29:34	1.13
+++ global.c	1998/09/10 13:57:04
@@ -78,7 +78,7 @@ static int max_allocno;
 /* Indexed by (pseudo) reg number, gives the allocno, or -1
    for pseudo registers which are not to be allocated.  */
 
-int *reg_allocno;
+static int *reg_allocno;
 
 /* Indexed by allocno, gives the reg number.  */
 
Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.61
diff -u -p -r1.61 reload1.c
--- reload1.c	1998/09/09 21:12:04	1.61
+++ reload1.c	1998/09/10 13:57:07
@@ -286,9 +286,6 @@ char *reload_firstobj;
 
 /* List of labels that must never be deleted.  */
 extern rtx forced_labels;
-
-/* Allocation number table from global register allocation.  */
-extern int *reg_allocno;
 
 /* This structure is used to record information about register eliminations.
    Each array entry describes one possible way of eliminating a register
@@ -374,7 +371,7 @@ static void mark_not_eliminable		PROTO((
 static int spill_hard_reg		PROTO((int, int, FILE *, int));
 static void scan_paradoxical_subregs	PROTO((rtx));
 static int hard_reg_use_compare		PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void order_regs_for_reload	PROTO((int));
+static void order_regs_for_reload	PROTO((void));
 static int compare_spill_regs		PROTO((const GENERIC_PTR, const GENERIC_PTR));
 static void reload_as_needed		PROTO((rtx, int));
 static void forget_old_reloads_1	PROTO((rtx, rtx));
@@ -853,7 +850,7 @@ reload (first, global, dumpfile)
   /* Compute the order of preference for hard registers to spill.
      Store them by decreasing preference in potential_reload_regs.  */
 
-  order_regs_for_reload (global);
+  order_regs_for_reload ();
 
   /* So far, no hard regs have been spilled.  */
   n_spills = 0;
@@ -3926,8 +3923,7 @@ hard_reg_use_compare (p1p, p2p)
    Store them in order of decreasing preference in potential_reload_regs.  */
 
 static void
-order_regs_for_reload (global)
-     int global;
+order_regs_for_reload ()
 {
   register int i;
   register int o = 0;
@@ -3956,15 +3952,7 @@ order_regs_for_reload (global)
 	{
 	  int lim = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (i));
 	  while (regno < lim)
-	    {
-	      /* If allocated by local-alloc, show more uses since
-		 we're not going to be able to reallocate it, but
-		 we might if allocated by global alloc.  */
-	      if (global && reg_allocno[i] < 0)
-		hard_reg_n_uses[regno].uses += (REG_N_REFS (i) + 1) / 2;
-
-	      hard_reg_n_uses[regno++].uses += REG_N_REFS (i);
-	    }
+	    hard_reg_n_uses[regno++].uses += REG_N_REFS (i);
 	}
       large += REG_N_REFS (i);
     }



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