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]

Patch to fix / improve single_set_2


This patch fixes single_set_2 so that it handles simple sets
and realizes that a SET_SRC which is a const call does not
have a side effect.  The patch passes make bootstrap and check
on i386-unknown-freebsd4.2.  It also passes make and check on
arm-elf and powerpc-eabisim.

ChangeLog:

Sun Apr  8 01:58:51 EDT 2001  John Wehle  (john@feith.com)

	* rtlanal.c (single_set_2): Handle a simple set.
	Constant calls have no side effects.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/rtlanal.c.ORIGINAL	Wed Apr  4 00:57:04 2001
--- gcc/rtlanal.c	Sat Apr  7 03:30:05 2001
*************** single_set_2 (insn, pat)
*** 928,934 ****
  	      if (!set_verified)
  		{
  		  if (find_reg_note (insn, REG_UNUSED, SET_DEST (set))
! 		      && !side_effects_p (set))
  		    set = NULL;
  		  else
  		    set_verified = 1;
--- 928,936 ----
  	      if (!set_verified)
  		{
  		  if (find_reg_note (insn, REG_UNUSED, SET_DEST (set))
! 		      && ((GET_CODE (insn) == CALL_INSN
! 			   && CONST_CALL_P (insn))
! 			  || ! side_effects_p (set)))
  		    set = NULL;
  		  else
  		    set_verified = 1;
*************** single_set_2 (insn, pat)
*** 936,942 ****
  	      if (!set)
  		set = sub, set_verified = 0;
  	      else if (!find_reg_note (insn, REG_UNUSED, SET_DEST (sub))
! 		       || side_effects_p (sub))
  		return NULL_RTX;
  	      break;
  
--- 938,946 ----
  	      if (!set)
  		set = sub, set_verified = 0;
  	      else if (!find_reg_note (insn, REG_UNUSED, SET_DEST (sub))
! 		       || (! (GET_CODE (insn) == CALL_INSN
! 			      && CONST_CALL_P (insn))
! 			   && side_effects_p (sub)))
  		return NULL_RTX;
  	      break;
  
*************** single_set_2 (insn, pat)
*** 945,950 ****
--- 949,957 ----
  	    }
  	}
      }
+   else if (GET_CODE (pat) == SET)
+     set = pat;
+ 
    return set;
  }
  
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------


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