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]

Re: i386 addressing and subregs


> On Thu, Mar 14, 2002 at 10:13:42AM +0100, Jan Hubicka wrote:
> > What do we want to do?
> > 1) allow subregs in addresses
> 
> Probably this one.

OK,

Here is the patch I sent two years ago for it.  It still apply and bootstraps/regtests.
OK to install?

Honza

St Cervenec 19 23:55:23 CEST 2000  Jan Hubicka  <jh@suse.cz>

	* i386.c (aligned_operand): Be prepared for SUBREGed registers.
	(ix86_decompose_address): Use REG_P instead of GET_CODE (...) == REG.
	(ix86_address_cost): Be prepared for SUBREGed registers.
	(legitimate_address_p): Accept SUBREGed registers.

*************** aligned_operand (op, mode)
*** 1565,1570 ****
--- 1704,1714 ----
    if (! ix86_decompose_address (op, &parts))
      abort ();
  
+   if (parts.base && GET_CODE (parts.base) == SUBREG)
+     parts.base = SUBREG_REG (parts.base);
+   if (parts.index && GET_CODE (parts.index) == SUBREG)
+     parts.index = SUBREG_REG (parts.index);
+ 
    /* Look for some component that isn't known to be aligned.  */
    if (parts.index)
      {
*************** ix86_decompose_address (addr, out)
*** 2211,2217 ****
    HOST_WIDE_INT scale = 1;
    rtx scale_rtx = NULL_RTX;
  
!   if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG)
      base = addr;
    else if (GET_CODE (addr) == PLUS)
      {
--- 2374,2380 ----
    HOST_WIDE_INT scale = 1;
    rtx scale_rtx = NULL_RTX;
  
!   if (REG_P (addr) || GET_CODE (addr) == SUBREG)
      base = addr;
    else if (GET_CODE (addr) == PLUS)
      {
*************** ix86_address_cost (x)
*** 2337,2342 ****
--- 2500,2510 ----
    if (!ix86_decompose_address (x, &parts))
      abort ();
  
+   if (parts.base && GET_CODE (parts.base) == SUBREG)
+     parts.base = SUBREG_REG (parts.base);
+   if (parts.index && GET_CODE (parts.index) == SUBREG)
+     parts.index = SUBREG_REG (parts.index);
+ 
    /* More complex memory references are better.  */
    if (parts.disp && parts.disp != const0_rtx)
      cost--;
*************** legitimate_address_p (mode, addr, strict
*** 2461,2469 ****
  
    if (base)
      {
        reason_rtx = base;
  
!       if (GET_CODE (base) != REG)
  	{
  	  reason = "base is not a register";
  	  goto error;
--- 2629,2643 ----
  
    if (base)
      {
+       rtx reg;
        reason_rtx = base;
  
!       if (GET_CODE (base) == SUBREG)
! 	reg = SUBREG_REG (base);
!       else
! 	reg = base;
! 
!       if (GET_CODE (reg) != REG)
  	{
  	  reason = "base is not a register";
  	  goto error;
*************** legitimate_address_p (mode, addr, strict
*** 2475,2482 ****
  	  goto error;
  	}
  
!       if ((strict && ! REG_OK_FOR_BASE_STRICT_P (base))
! 	  || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (base)))
  	{
  	  reason = "base is not valid";
  	  goto error;
--- 2649,2656 ----
  	  goto error;
  	}
  
!       if ((strict && ! REG_OK_FOR_BASE_STRICT_P (reg))
! 	  || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (reg)))
  	{
  	  reason = "base is not valid";
  	  goto error;
*************** legitimate_address_p (mode, addr, strict
*** 2491,2499 ****
  
    if (index)
      {
        reason_rtx = index;
  
!       if (GET_CODE (index) != REG)
  	{
  	  reason = "index is not a register";
  	  goto error;
--- 2665,2679 ----
  
    if (index)
      {
+       rtx reg;
        reason_rtx = index;
  
!       if (GET_CODE (index) == SUBREG)
! 	reg = SUBREG_REG (index);
!       else
! 	reg = index;
! 
!       if (GET_CODE (reg) != REG)
  	{
  	  reason = "index is not a register";
  	  goto error;
*************** legitimate_address_p (mode, addr, strict
*** 2505,2512 ****
  	  goto error;
  	}
  
!       if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (index))
! 	  || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (index)))
  	{
  	  reason = "index is not valid";
  	  goto error;
--- 2685,2692 ----
  	  goto error;
  	}
  
!       if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (reg))
! 	  || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (reg)))
  	{
  	  reason = "index is not valid";
  	  goto error;


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