Continuing improvement in depressed stack pointer code

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Thu Feb 12 21:27:00 GMT 2004


This feature is used only for Ada when the "DSP" option is enabled.
On MIPS, the epilogue code was complex enough that we couldn't handle it
and would ICE compiling the Ada library.  This fixes another one of those
ICE's, though there are still some left.

Fixing those is harder, but I figured I might as well get this one out
of my tree in the meantime.

Tested on x86-64.

2004-02-12  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* function.c (update_epilogue_consts): Teach about binary operations.

*** function.c	12 Feb 2004 18:25:09 -0000	1.493
--- function.c	12 Feb 2004 20:45:18 -0000
*************** update_epilogue_consts (rtx dest, rtx x,
*** 7655,7666 ****
  {
    struct epi_info *p = (struct epi_info *) data;
  
    if (GET_CODE (dest) != REG || REGNO (dest) >= FIRST_PSEUDO_REGISTER)
      return;
!   else if (GET_CODE (x) == CLOBBER || ! rtx_equal_p (dest, SET_DEST (x))
! 	   || GET_CODE (SET_SRC (x)) != CONST_INT)
      p->const_equiv[REGNO (dest)] = 0;
!   else
      p->const_equiv[REGNO (dest)] = SET_SRC (x);
  }
  
--- 7655,7690 ----
  {
    struct epi_info *p = (struct epi_info *) data;
+   rtx new;
  
    if (GET_CODE (dest) != REG || REGNO (dest) >= FIRST_PSEUDO_REGISTER)
      return;
! 
!   /* If we are either clobbering a register or doing a partial set,
!      show we don't know the value.  */
!   else if (GET_CODE (x) == CLOBBER || ! rtx_equal_p (dest, SET_DEST (x)))
      p->const_equiv[REGNO (dest)] = 0;
! 
!   /* If we are setting it to a constant, record that constant.  */
!   else if (GET_CODE (SET_SRC (x)) == CONST_INT)
      p->const_equiv[REGNO (dest)] = SET_SRC (x);
+ 
+   /* If this is a binary operation between a register we have been tracking
+      and a constant, see if we can compute a new constant value.  */
+   else if ((GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == 'c'
+ 	    || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '2')
+ 	   && GET_CODE (XEXP (SET_SRC (x), 0)) == REG
+ 	   && REGNO (XEXP (SET_SRC (x), 0)) < FIRST_PSEUDO_REGISTER
+ 	   && p->const_equiv[REGNO (XEXP (SET_SRC (x), 0))] != 0
+ 	   && GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
+ 	   && 0 != (new = simplify_binary_operation
+ 		    (GET_CODE (SET_SRC (x)), GET_MODE (dest),
+ 		     p->const_equiv[REGNO (XEXP (SET_SRC (x), 0))],
+ 		     XEXP (SET_SRC (x), 1)))
+ 	   && GET_CODE (new) == CONST_INT)
+     p->const_equiv[REGNO (dest)] = new;
+ 
+   /* Otherwise, we can't do anything with this value.  */
+   else
+     p->const_equiv[REGNO (dest)] = 0;
  }
  



More information about the Gcc-patches mailing list