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]

[addrmodes] Remove GO_IF_LEGITIMATE_ADDRESS from sh.c


Tangential to the purpose of the branch, but still one of the monstrosities to tame is how GO_IF_LEGITIMATE_ADDRESS affects the control flow; sh.c attemps to make it nicer by using do...break..while(0) but IMHO it fails... So let's use memory_address_p instead.

There is one remaining use which I'll address soon.

Paolo
2006-08-24  Paolo Bonzini  <bonzini@gnu.org>

	* config/sh/sh.c (sh_expand_prologue, sh_expand_epilogue):
	Use memory_address_p instead of GO_IF_LEGITIMATE_ADDRESS.

Index: config/sh/sh.c
===================================================================
*** config/sh/sh.c	(revision 116179)
--- config/sh/sh.c	(working copy)
***************
*** 6019,6050 ****
  						 stack_pointer_rtx,
  						 GEN_INT (offset)));
  
! 	  GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (mem_rtx, 0), try_pre_dec);
! 
! 	  gcc_assert (r0);
! 	  mem_rtx = NULL_RTX;
! 
! 	try_pre_dec:
! 	  do
! 	    if (HAVE_PRE_DECREMENT
! 		&& (offset_in_r0 - offset == GET_MODE_SIZE (mode)
! 		    || mem_rtx == NULL_RTX
! 		    || reg == PR_REG || SPECIAL_REGISTER_P (reg)))
! 	      {
! 		pre_dec = gen_frame_mem (mode, gen_rtx_PRE_DEC (Pmode, r0));
  
! 		GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (pre_dec, 0),
! 					  pre_dec_ok);
  
  		pre_dec = NULL_RTX;
! 
! 		break;
! 
! 	      pre_dec_ok:
! 		mem_rtx = NULL_RTX;
! 		offset += GET_MODE_SIZE (mode);
! 	      }
! 	  while (0);
  
  	  if (mem_rtx != NULL_RTX)
  	    goto addr_ok;
--- 6019,6045 ----
  						 stack_pointer_rtx,
  						 GEN_INT (offset)));
  
! 	  if (!memory_address_p (mode, XEXP (mem_rtx, 0)))
! 	    {
! 	      gcc_assert (r0);
! 	      mem_rtx = NULL_RTX;
! 	    }
  
! 	  if (HAVE_PRE_DECREMENT
! 	      && (offset_in_r0 - offset == GET_MODE_SIZE (mode)
! 		  || mem_rtx == NULL_RTX
! 		  || reg == PR_REG || SPECIAL_REGISTER_P (reg)))
! 	    {
! 	      pre_dec = gen_frame_mem (mode, gen_rtx_PRE_DEC (Pmode, r0));
  
+ 	      if (!memory_address_p (mode, XEXP (pre_dec, 0)))
  		pre_dec = NULL_RTX;
! 	      else
! 	        {
! 		  mem_rtx = NULL_RTX;
! 		  offset += GET_MODE_SIZE (mode);
! 	        }
! 	    }
  
  	  if (mem_rtx != NULL_RTX)
  	    goto addr_ok;
***************
*** 6336,6366 ****
  						 stack_pointer_rtx,
  						 GEN_INT (offset)));
  
! 	  GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (mem_rtx, 0), try_post_inc);
! 
! 	  mem_rtx = NULL_RTX;
! 
! 	try_post_inc:
! 	  do
! 	    if (HAVE_POST_INCREMENT
! 		&& (offset == offset_in_r0
! 		    || (offset + GET_MODE_SIZE (mode) != d + d_rounding
! 			&& mem_rtx == NULL_RTX)
! 		    || reg == PR_REG || SPECIAL_REGISTER_P (reg)))
! 	      {
! 		post_inc = gen_frame_mem (mode, gen_rtx_POST_INC (Pmode, r0));
! 
! 		GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (post_inc, 0),
! 					  post_inc_ok);
  
! 		post_inc = NULL_RTX;
! 
! 		break;
  
! 	      post_inc_ok:
  		mem_rtx = NULL_RTX;
! 	      }
! 	  while (0);
  
  	  if (mem_rtx != NULL_RTX)
  	    goto addr_ok;
--- 6331,6352 ----
  						 stack_pointer_rtx,
  						 GEN_INT (offset)));
  
! 	  if (!memory_address_p (mode, XEXP (mem_rtx, 0)))
! 	    mem_rtx = NULL_RTX;
  
! 	  if (HAVE_POST_INCREMENT
! 	      && (offset == offset_in_r0
! 		  || (offset + GET_MODE_SIZE (mode) != d + d_rounding
! 		      && mem_rtx == NULL_RTX)
! 		  || reg == PR_REG || SPECIAL_REGISTER_P (reg)))
! 	    {
! 	      post_inc = gen_frame_mem (mode, gen_rtx_POST_INC (Pmode, r0));
  
! 	      if (!memory_address_p (mode, XEXP (post_inc, 0)))
! 	        post_inc = NULL_RTX;
! 	      else
  		mem_rtx = NULL_RTX;
! 	    }
  
  	  if (mem_rtx != NULL_RTX)
  	    goto addr_ok;

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