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: PATCH RFA: PR gcc/1532: jump to following instruction


On Sun, Jan 25, 2004 at 09:39:45AM -0500, Ian Lance Taylor wrote:
> 	PR gcc/1532
> 	* reload1.c (reload): We can delete the CLOBBER of the return
> 	register if it is followed by an instruction which modifies the
> 	return register.

Hmm.  Certainly I believe this will produce correct code, and avoid
the problems caused by unconditionally removing the clobber.  However,
I'm thinking that it would be less hacky to have this done instead in
flow.c, where we have nice things like real data flow available.

I'm thinking that all that may need changing is the following.


r~



Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.578
diff -c -p -d -r1.578 flow.c
*** flow.c	6 Feb 2004 19:29:56 -0000	1.578
--- flow.c	9 Feb 2004 23:44:55 -0000
*************** insn_dead_p (struct propagate_block_info
*** 2267,2280 ****
      }
  
    /* A CLOBBER of a pseudo-register that is dead serves no purpose.  That
!      is not necessarily true for hard registers.  */
!   else if (code == CLOBBER && GET_CODE (XEXP (x, 0)) == REG
! 	   && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
! 	   && ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
!     return 1;
  
-   /* We do not check other CLOBBER or USE here.  An insn consisting of just
-      a CLOBBER or just a USE should not be deleted.  */
    return 0;
  }
  
--- 2267,2289 ----
      }
  
    /* A CLOBBER of a pseudo-register that is dead serves no purpose.  That
!      is not necessarily true for hard registers until after reload.  */
!   else if (code == CLOBBER)
!     {
!       if (reload_completed)
! 	return 1;
!       if (GET_CODE (XEXP (x, 0)) == REG
! 	  && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER
! 	  && ! REGNO_REG_SET_P (pbi->reg_live, REGNO (XEXP (x, 0))))
! 	return 1;
!     }
! 
!   /* ??? A base USE is a historical relic.  It ought not be needed anymore.
!      Instances where it is still used are either (1) temporary and the USE
!      escaped the pass, (2) cruft and the USE need not be emitted anymore,
!      or (3) hiding bugs elsewhere that are not properly representing data
!      flow.  */
  
    return 0;
  }
  


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