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]

Remove log links usage in sh_reorg


Hi,
this patch removes the use of log links in sh.c.  It has the fallback
sollution searching for the instruction by hand that seems to do the
work too.  It probably should be reorganized to use df.c as it also has
some code to get past labels so it really wants global info.

Honza

2004-01-24  Jan Hubicka  <jh@suse.cz>
	* sh.c (sh_reorg): Do not (ab)use log links.
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.250
diff -c -3 -p -r1.250 sh.c
*** config/sh/sh.c	23 Jan 2004 15:29:09 -0000	1.250
--- config/sh/sh.c	23 Jan 2004 23:00:13 -0000
*************** sh_reorg (void)
*** 3791,3797 ****
  
        for (insn = first; insn; insn = NEXT_INSN (insn))
  	{
! 	  rtx pattern, reg, link, set, scan, dies, label;
  	  int rescan = 0, foundinsn = 0;
  
  	  if (GET_CODE (insn) == CALL_INSN)
--- 3791,3797 ----
  
        for (insn = first; insn; insn = NEXT_INSN (insn))
  	{
! 	  rtx pattern, reg, link = NULL, set, scan, dies, label;
  	  int rescan = 0, foundinsn = 0;
  
  	  if (GET_CODE (insn) == CALL_INSN)
*************** sh_reorg (void)
*** 3819,3864 ****
  	  if (GET_CODE (reg) != REG)
  	    continue;
  
! 	  /* This is a function call via REG.  If the only uses of REG
! 	     between the time that it is set and the time that it dies
! 	     are in function calls, then we can associate all the
! 	     function calls with the setting of REG.  */
! 
! 	  for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
  	    {
! 	      if (REG_NOTE_KIND (link) != 0)
  		continue;
- 	      set = single_set (XEXP (link, 0));
- 	      if (set && rtx_equal_p (reg, SET_DEST (set)))
- 		{
- 		  link = XEXP (link, 0);
- 		  break;
- 		}
- 	    }
- 
- 	  if (! link)
- 	    {
- 	      /* ??? Sometimes global register allocation will have
-                  deleted the insn pointed to by LOG_LINKS.  Try
-                  scanning backward to find where the register is set.  */
- 	      for (scan = PREV_INSN (insn);
- 		   scan && GET_CODE (scan) != CODE_LABEL;
- 		   scan = PREV_INSN (scan))
- 		{
- 		  if (! INSN_P (scan))
- 		    continue;
  
! 		  if (! reg_mentioned_p (reg, scan))
! 		    continue;
  
! 		  if (noncall_uses_reg (reg, scan, &set))
! 		    break;
  
! 		  if (set)
! 		    {
! 		      link = scan;
! 		      break;
! 		    }
  		}
  	    }
  
--- 3819,3841 ----
  	  if (GET_CODE (reg) != REG)
  	    continue;
  
! 	  for (scan = PREV_INSN (insn);
! 	       scan && GET_CODE (scan) != CODE_LABEL;
! 	       scan = PREV_INSN (scan))
  	    {
! 	      if (! INSN_P (scan))
  		continue;
  
! 	      if (! reg_mentioned_p (reg, scan))
! 		continue;
  
! 	      if (noncall_uses_reg (reg, scan, &set))
! 		break;
  
! 	      if (set)
! 		{
! 		  link = scan;
! 		  break;
  		}
  	    }
  


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