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]

Remove redundant code in jump.c



Hi
Jump.c contains code that seems to do pretty much the same as the new stack
pointer optimizing pass.
The advantage is that it is able to combine up to 3 pushes, while current pass
does maximally one, the disadvantage is that it is messy and most probably dead
on all targets, so I am removing it.

Richard: Do you consider worthwhile adding support for multiple pushes?
We can also collect info about up to 3 pushes by the way and then convert
them to moves.
It can bring notable speedups in PPro, where push performance is problematical
IMO. Possibly new target macro can be introduced to alter the treshold
(2 for optimizing size on i386 I guess).

Fri Mar 17 15:02:13 MET 2000  Jan Hubicka  <jh@suse.cz>
	* jump.c (delete_noop_moves): Remove code attempting to
	combine stack adjustments.

============================================================
Index: egcs/gcc/jump.c
*** jump.c	2000/02/28 12:01:08	1.111
--- jump.c	2000/03/17 14:01:30
*************** delete_noop_moves (f)
*** 2304,2407 ****
  	{
  	  register rtx body = PATTERN (insn);
  
- /* Combine stack_adjusts with following push_insns.  */
- #ifdef PUSH_ROUNDING
- 	  if (GET_CODE (body) == SET
- 	      && SET_DEST (body) == stack_pointer_rtx
- 	      && GET_CODE (SET_SRC (body)) == PLUS
- 	      && XEXP (SET_SRC (body), 0) == stack_pointer_rtx
- 	      && GET_CODE (XEXP (SET_SRC (body), 1)) == CONST_INT
- 	      && INTVAL (XEXP (SET_SRC (body), 1)) > 0)
- 	    {
- 	      rtx p;
- 	      rtx stack_adjust_insn = insn;
- 	      int stack_adjust_amount = INTVAL (XEXP (SET_SRC (body), 1));
- 	      int total_pushed = 0;
- 	      int pushes = 0;
- 
- 	      /* Find all successive push insns.  */
- 	      p = insn;
- 	      /* Don't convert more than three pushes;
- 		 that starts adding too many displaced addresses
- 		 and the whole thing starts becoming a losing
- 		 proposition.  */
- 	      while (pushes < 3)
- 		{
- 		  rtx pbody, dest;
- 		  p = next_nonnote_insn (p);
- 		  if (p == 0 || GET_CODE (p) != INSN)
- 		    break;
- 		  pbody = PATTERN (p);
- 		  if (GET_CODE (pbody) != SET)
- 		    break;
- 		  dest = SET_DEST (pbody);
- 		  /* Allow a no-op move between the adjust and the push.  */
- 		  if (GET_CODE (dest) == REG
- 		      && GET_CODE (SET_SRC (pbody)) == REG
- 		      && REGNO (dest) == REGNO (SET_SRC (pbody)))
- 		    continue;
- 		  if (! (GET_CODE (dest) == MEM
- 			 && GET_CODE (XEXP (dest, 0)) == POST_INC
- 			 && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
- 		    break;
- 		  pushes++;
- 		  if (total_pushed + GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)))
- 		      > stack_adjust_amount)
- 		    break;
- 		  total_pushed += GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
- 		}
- 
- 	      /* Discard the amount pushed from the stack adjust;
- 		 maybe eliminate it entirely.  */
- 	      if (total_pushed >= stack_adjust_amount)
- 		{
- 		  delete_computation (stack_adjust_insn);
- 		  total_pushed = stack_adjust_amount;
- 		}
- 	      else
- 		XEXP (SET_SRC (PATTERN (stack_adjust_insn)), 1)
- 		  = GEN_INT (stack_adjust_amount - total_pushed);
- 
- 	      /* Change the appropriate push insns to ordinary stores.  */
- 	      p = insn;
- 	      while (total_pushed > 0)
- 		{
- 		  rtx pbody, dest;
- 		  p = next_nonnote_insn (p);
- 		  if (GET_CODE (p) != INSN)
- 		    break;
- 		  pbody = PATTERN (p);
- 		  if (GET_CODE (pbody) != SET)
- 		    break;
- 		  dest = SET_DEST (pbody);
- 		  /* Allow a no-op move between the adjust and the push.  */
- 		  if (GET_CODE (dest) == REG
- 		      && GET_CODE (SET_SRC (pbody)) == REG
- 		      && REGNO (dest) == REGNO (SET_SRC (pbody)))
- 		    continue;
- 		  if (! (GET_CODE (dest) == MEM
- 			 && GET_CODE (XEXP (dest, 0)) == POST_INC
- 			 && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
- 		    break;
- 		  total_pushed -= GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
- 		  /* If this push doesn't fully fit in the space
- 		     of the stack adjust that we deleted,
- 		     make another stack adjust here for what we
- 		     didn't use up.  There should be peepholes
- 		     to recognize the resulting sequence of insns.  */
- 		  if (total_pushed < 0)
- 		    {
- 		      emit_insn_before (gen_add2_insn (stack_pointer_rtx,
- 						       GEN_INT (- total_pushed)),
- 					p);
- 		      break;
- 		    }
- 		  XEXP (dest, 0)
- 		    = plus_constant (stack_pointer_rtx, total_pushed);
- 		}
- 	    }
- #endif
- 
  	  /* Detect and delete no-op move instructions
  	     resulting from not allocating a parameter in a register.  */
  
--- 2304,2309 ----

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