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]

Improved search for reload_address_base_reg_class


Hi,

  I would like to submit the enclosed patch to reload1.c for
consideration.  The patch actually contains one real 'fix', and a
couple of spelling corrections.  The patch fixes a problem with
reloads for the Thumb toolchain.

The 'fix' is to the code that locates a register class to use for
base address reloads for SMALL_REGISTER_CLASSES machines.  If a class
cannot be found after removing the argument registers from BASE_REG_CLASS,
then a second attempt is made, this time removing the fixed registers
as well.  Since fixed registers cannot be used a spill registers this
should be OK. 

Cheers
	Nick


Wed Jul 29 11:30:41 1998  Nick Clifton  <nickc@cygnus.com>

	* reload1.c (init_reload): On SMALL_REGISTER_CLASSES machines,
	when searching for a reload_address_base_reg_class, try avoiding
	fixed registers as well as argument registers.

Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.56
diff -p -w -r1.56 reload1.c
*** reload1.c	1998/07/13 11:04:45	1.56
--- reload1.c	1998/07/31 16:58:04
*************** init_reload ()
*** 493,498 ****
--- 493,511 ----
  	  reload_address_base_reg_class = *p;
  	  break;
  	}
+ 
+       /* If that failed, then try excluding fixed registers as well.  */
+       if (*p == LIM_REG_CLASSES)
+ 	{
+ 	  for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ 	    if (fixed_regs[regno])
+ 	      CLEAR_HARD_REG_BIT (base, regno);
+ 	  
+ 	  for (p = reg_class_subclasses[BASE_REG_CLASS];
+ 	       *p != LIM_REG_CLASSES;
+ 	       p++)
+ 	    GO_IF_HARD_REG_EQUAL (base, reg_class_contents[*p], usebase);
+ 	}
      baseok:;
  
        GO_IF_HARD_REG_EQUAL (index, reg_class_contents[INDEX_REG_CLASS],
*************** reload_as_needed (first, live_known)
*** 4119,4125 ****
  	      int class;
  
  	      /* If this block has not had spilling done for a
! 		 particular clas and we have any non-optionals that need a
  		 spill reg in that class, abort.  */
  
  	      for (class = 0; class < N_REG_CLASSES; class++)
--- 4132,4138 ----
  	      int class;
  
  	      /* If this block has not had spilling done for a
! 		 particular class and we have any non-optionals that need a
  		 spill reg in that class, abort.  */
  
  	      for (class = 0; class < N_REG_CLASSES; class++)
*************** choose_reload_regs (insn, avoid_return_r
*** 5560,5566 ****
  	      && ! reload_secondary_p[r])
  	    continue;
  
! 	  /* If find_reloads chose a to use reload_in or reload_out as a reload
  	     register, we don't need to chose one.  Otherwise, try even if it
  	     found one since we might save an insn if we find the value lying
  	     around.  */
--- 5573,5579 ----
  	      && ! reload_secondary_p[r])
  	    continue;
  
! 	  /* If find_reloads chose to use reload_in or reload_out as a reload
  	     register, we don't need to chose one.  Otherwise, try even if it
  	     found one since we might save an insn if we find the value lying
  	     around.  */


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