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]

MEM attribute changes, round 2


plus_constant_for_output differs only from plus_constant in that the
latter supports LO_SUM.  But there's no reason why plus_constant can't
also support LO_SUM.  So I added that and deleted plus_constant_for_output,
replacing it in all the callers with plus_constant.  That allows a few
more change_address calls to be converted to adjust_address.

Bootstrapped on alphaev56.

Mon Jul  2 21:52:19 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* explow.c (plus_constant_wide, case LO_SUM): New case.
	(plus_constant_for_output_wide): Delete.
	* rtl.h (plus_constant_for_output): Delete.
	* alias.c (canon_rtx, init_alias_analysis): Call plus_constant
	instead of plus_constant_for_output.
	* recog.c (offsettable_address_p, adj_offsettable_operand): Likewise.
	* config/darwin.c, config/arm/arm.c, config/m68k/m68k.c: Likewise.
	* config/m88k/m88k.c, config/mips/mips.c, config/pa/pa.c: Likewise.
	* config/rs6000/rs6000.c, config/sparc/sparc.c: Likewise.
	* config/sparc/sparc.md: Likewise.
	Convert some change_address calls to adjust_address.

*** alias.c	2001/06/04 13:21:38	1.123
--- alias.c	2001/07/03 01:30:17
*************** canon_rtx (x)
*** 960,969 ****
        if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1))
  	{
- 	  /* We can tolerate LO_SUMs being offset here; these
- 	     rtl are used for nothing other than comparisons.  */
  	  if (GET_CODE (x0) == CONST_INT)
! 	    return plus_constant_for_output (x1, INTVAL (x0));
  	  else if (GET_CODE (x1) == CONST_INT)
! 	    return plus_constant_for_output (x0, INTVAL (x1));
  	  return gen_rtx_PLUS (GET_MODE (x), x0, x1);
  	}
--- 960,967 ----
        if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1))
  	{
  	  if (GET_CODE (x0) == CONST_INT)
! 	    return plus_constant (x1, INTVAL (x0));
  	  else if (GET_CODE (x1) == CONST_INT)
! 	    return plus_constant (x0, INTVAL (x1));
  	  return gen_rtx_PLUS (GET_MODE (x), x0, x1);
  	}
*************** init_alias_analysis ()
*** 2350,2355 ****
  		      op0 = reg_known_value[REGNO (op0)];
  		      reg_known_value[regno]
! 			= plus_constant_for_output (op0,
! 						    INTVAL (XEXP (src, 1)));
  		      reg_known_equiv_p[regno] = 0;
  		    }
--- 2348,2352 ----
  		      op0 = reg_known_value[REGNO (op0)];
  		      reg_known_value[regno]
! 			= plus_constant (op0, INTVAL (XEXP (src, 1)));
  		      reg_known_equiv_p[regno] = 0;
  		    }
*** explow.c	2001/06/15 22:05:09	1.63
--- explow.c	2001/07/03 01:30:22
*************** plus_constant_wide (x, c)
*** 175,178 ****
--- 175,183 ----
  	}
        break;
+ 
+     case LO_SUM:
+       return gen_rtx_LO_SUM (mode, XEXP (x, 0),
+ 			     plus_constant (XEXP (x, 1), c));
+ 
        
      default:
*************** plus_constant_wide (x, c)
*** 189,211 ****
    else
      return x;
- }
- 
- /* This is the same as `plus_constant', except that it handles LO_SUM.
- 
-    This function should be used via the `plus_constant_for_output' macro.  */
- 
- rtx
- plus_constant_for_output_wide (x, c)
-      register rtx x;
-      register HOST_WIDE_INT c;
- {
-   register enum machine_mode mode = GET_MODE (x);
- 
-   if (GET_CODE (x) == LO_SUM)
-     return gen_rtx_LO_SUM (mode, XEXP (x, 0),
- 			   plus_constant_for_output (XEXP (x, 1), c));
- 
-   else
-     return plus_constant (x, c);
  }
  
--- 194,197 ----
*** recog.c	2001/06/12 17:54:39	1.109
--- recog.c	2001/07/03 01:30:33
*************** offsettable_address_p (strictp, mode, y)
*** 1969,1973 ****
       valid addresses then so is Y+d for all 0<d<c.  */
  
!   z = plus_constant_for_output (y, mode_sz - 1);
  
    /* Use QImode because an odd displacement may be automatically invalid
--- 1969,1973 ----
       valid addresses then so is Y+d for all 0<d<c.  */
  
!   z = plus_constant (y, mode_sz - 1);
  
    /* Use QImode because an odd displacement may be automatically invalid
*************** adj_offsettable_operand (op, offset)
*** 2036,2041 ****
        if (CONSTANT_ADDRESS_P (y))
  	{
! 	  new = gen_rtx_MEM (GET_MODE (op),
! 			     plus_constant_for_output (y, offset));
  	  MEM_COPY_ATTRIBUTES (new, op);
  	  return new;
--- 2036,2040 ----
        if (CONSTANT_ADDRESS_P (y))
  	{
! 	  new = gen_rtx_MEM (GET_MODE (op), plus_constant (y, offset));
  	  MEM_COPY_ATTRIBUTES (new, op);
  	  return new;
*************** adj_offsettable_operand (op, offset)
*** 2052,2061 ****
  	  if (const_loc)
  	    {
! 	      *const_loc = plus_constant_for_output (*const_loc, offset);
  	      return op;
  	    }
  	}
  
!       new = gen_rtx_MEM (GET_MODE (op), plus_constant_for_output (y, offset));
        MEM_COPY_ATTRIBUTES (new, op);
        return new;
--- 2051,2060 ----
  	  if (const_loc)
  	    {
! 	      *const_loc = plus_constant (*const_loc, offset);
  	      return op;
  	    }
  	}
  
!       new = gen_rtx_MEM (GET_MODE (op), plus_constant (y, offset));
        MEM_COPY_ATTRIBUTES (new, op);
        return new;
*** rtl.h	2001/06/30 17:23:53	1.266
--- rtl.h	2001/07/03 01:50:56
*************** extern int ceil_log2			PARAMS ((unsigned
*** 1145,1151 ****
  #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
  
- #define plus_constant_for_output(X,C)  \
-   plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
- 
  /* In builtins.c */
  extern rtx expand_builtin_expect_jump	PARAMS ((union tree_node *, rtx, rtx));
--- 1145,1148 ----
*** config/arm/arm.c	2001/06/29 17:21:13	1.150
--- config/arm/arm.c	2001/07/03 01:31:06
*************** legitimize_pic_address (orig, mode, reg)
*** 2235,2239 ****
  	win:
  	  if (GET_CODE (offset) == CONST_INT)
! 	    return plus_constant_for_output (base, INTVAL (offset));
  	}
  
--- 2235,2239 ----
  	win:
  	  if (GET_CODE (offset) == CONST_INT)
! 	    return plus_constant (base, INTVAL (offset));
  	}
  
*** config/m68k/m68k.c	2001/06/26 18:08:59	1.43
--- config/m68k/m68k.c	2001/07/03 01:31:41
*************** legitimize_pic_address (orig, mode, reg)
*** 1403,1407 ****
  
        if (GET_CODE (orig) == CONST_INT)
! 	return plus_constant_for_output (base, INTVAL (orig));
        pic_ref = gen_rtx_PLUS (Pmode, base, orig);
        /* Likewise, should we set special REG_NOTEs here?  */
--- 1403,1407 ----
  
        if (GET_CODE (orig) == CONST_INT)
! 	return plus_constant (base, INTVAL (orig));
        pic_ref = gen_rtx_PLUS (Pmode, base, orig);
        /* Likewise, should we set special REG_NOTEs here?  */
*** config/m88k/m88k.c	2001/07/02 19:47:43	1.32
--- config/m88k/m88k.c	2001/07/03 01:31:49
*************** legitimize_address (pic, orig, reg, scra
*** 369,373 ****
  	    {
  	      if (ADD_INT (addr))
! 		return plus_constant_for_output (base, INTVAL (addr));
  	      else if (! reload_in_progress && ! reload_completed)
  		addr = force_reg (Pmode, addr);
--- 369,373 ----
  	    {
  	      if (ADD_INT (addr))
! 		return plus_constant (base, INTVAL (addr));
  	      else if (! reload_in_progress && ! reload_completed)
  		addr = force_reg (Pmode, addr);
*** config/pa/pa.c	2001/06/26 18:09:09	1.113
--- config/pa/pa.c	2001/07/03 01:32:31
*************** legitimize_pic_address (orig, mode, reg)
*** 759,763 ****
  	{
  	  if (INT_14_BITS (orig))
! 	    return plus_constant_for_output (base, INTVAL (orig));
  	  orig = force_reg (Pmode, orig);
  	}
--- 759,763 ----
  	{
  	  if (INT_14_BITS (orig))
! 	    return plus_constant (base, INTVAL (orig));
  	  orig = force_reg (Pmode, orig);
  	}
*** config/sparc/sparc.c	2001/06/26 18:09:19	1.142
--- config/sparc/sparc.c	2001/07/03 01:33:17
*************** legitimize_pic_address (orig, mode, reg)
*** 2814,2818 ****
  	{
  	  if (SMALL_INT (offset))
! 	    return plus_constant_for_output (base, INTVAL (offset));
  	  else if (! reload_in_progress && ! reload_completed)
  	    offset = force_reg (Pmode, offset);
--- 2814,2818 ----
  	{
  	  if (SMALL_INT (offset))
! 	    return plus_constant (base, INTVAL (offset));
  	  else if (! reload_in_progress && ! reload_completed)
  	    offset = force_reg (Pmode, offset);
*** config/sparc/sparc.md	2001/07/02 19:47:44	1.125
--- config/sparc/sparc.md	2001/07/03 01:33:43
***************
*** 2959,2964 ****
  {
    rtx word0 = adjust_address (operands[1], SImode, 0);
!   rtx word1 = change_address (operands[1], SImode,
! 			      plus_constant_for_output (XEXP (word0, 0), 4));
    rtx high_part = gen_highpart (SImode, operands[0]);
    rtx low_part = gen_lowpart (SImode, operands[0]);
--- 2959,2963 ----
  {
    rtx word0 = adjust_address (operands[1], SImode, 0);
!   rtx word1 = adjust_address (operands[1], SImode, 4);
    rtx high_part = gen_highpart (SImode, operands[0]);
    rtx low_part = gen_lowpart (SImode, operands[0]);
***************
*** 2986,2997 ****
    "
  {
!   rtx word0 = adjust_address (operands[0], SImode, 0);
!   rtx word1 = change_address (operands[0], SImode,
! 			      plus_constant_for_output (XEXP (word0, 0), 4));
!   rtx high_part = gen_highpart (SImode, operands[1]);
!   rtx low_part = gen_lowpart (SImode, operands[1]);
! 
!   emit_insn (gen_movsi (word0, high_part));
!   emit_insn (gen_movsi (word1, low_part));
    DONE;
  }")
--- 2985,2992 ----
    "
  {
!   emit_insn (gen_movsi (adjust_address (operands[0], SImode, 0),
! 			gen_highpart (SImode, operands[1])));
!   emit_insn (gen_movsi (adjust_address (operands[0], SImode, 4),
! 			gen_lowpart (SImode, operands[1])));
    DONE;
  }")
***************
*** 3596,3601 ****
  {
    rtx word0 = adjust_address (operands[1], SFmode, 0);
!   rtx word1 = change_address (operands[1], SFmode,
! 			      plus_constant_for_output (XEXP (word0, 0), 4));
  
    if (GET_CODE (operands[0]) == SUBREG)
--- 3591,3595 ----
  {
    rtx word0 = adjust_address (operands[1], SFmode, 0);
!   rtx word1 = adjust_address (operands[1], SFmode, 4);
  
    if (GET_CODE (operands[0]) == SUBREG)
***************
*** 3631,3636 ****
  {
    rtx word0 = adjust_address (operands[0], SFmode, 0);
!   rtx word1 = change_address (operands[0], SFmode,
! 			      plus_constant_for_output (XEXP (word0, 0), 4));
  
    if (GET_CODE (operands[1]) == SUBREG)
--- 3625,3629 ----
  {
    rtx word0 = adjust_address (operands[0], SFmode, 0);
!   rtx word1 = adjust_address (operands[0], SFmode, 4);
  
    if (GET_CODE (operands[1]) == SUBREG)
***************
*** 3657,3662 ****
  
    dest1 = adjust_address (operands[0], SFmode, 0);
!   dest2 = change_address (operands[0], SFmode,
! 			  plus_constant_for_output (XEXP (dest1, 0), 4));
    emit_insn (gen_movsf (dest1, CONST0_RTX (SFmode)));
    emit_insn (gen_movsf (dest2, CONST0_RTX (SFmode)));
--- 3650,3655 ----
  
    dest1 = adjust_address (operands[0], SFmode, 0);
!   dest2 = adjust_address (operands[0], SFmode, 4);
! 
    emit_insn (gen_movsf (dest1, CONST0_RTX (SFmode)));
    emit_insn (gen_movsf (dest2, CONST0_RTX (SFmode)));
***************
*** 3931,3936 ****
      case MEM:
        dest1 = adjust_address (set_dest, DFmode, 0);
!       dest2 = change_address (set_dest, DFmode,
! 			      plus_constant_for_output (XEXP (dest1, 0), 8));
        break;
      default:
--- 3924,3928 ----
      case MEM:
        dest1 = adjust_address (set_dest, DFmode, 0);
!       dest2 = adjust_address (set_dest, DFmode, 8);
        break;
      default:
***************
*** 3952,3957 ****
  {
    rtx word0 = adjust_address (operands[1], DFmode, 0);
!   rtx word1 = change_address (operands[1], DFmode,
! 			      plus_constant_for_output (XEXP (word0, 0), 8));
    rtx set_dest, dest1, dest2;
  
--- 3944,3948 ----
  {
    rtx word0 = adjust_address (operands[1], DFmode, 0);
!   rtx word1 = adjust_address (operands[1], DFmode, 8);
    rtx set_dest, dest1, dest2;
  
***************
*** 3987,4001 ****
    "
  {
!   rtx word1 = adjust_address (operands[0], DFmode, 0);
!   rtx word2 = change_address (operands[0], DFmode,
! 			      plus_constant_for_output (XEXP (word1, 0), 8));
!   rtx set_src;
! 
!   set_src = operands[1];
    if (GET_CODE (set_src) == SUBREG)
      set_src = alter_subreg (set_src);
  
!   emit_insn (gen_movdf (word1, gen_df_reg (set_src, 0)));
!   emit_insn (gen_movdf (word2, gen_df_reg (set_src, 1)));
    DONE;
  }")
--- 3978,3989 ----
    "
  {
!   rtx set_src = operands[1];
    if (GET_CODE (set_src) == SUBREG)
      set_src = alter_subreg (set_src);
  
!   emit_insn (gen_movdf (adjust_address (operands[0], DFmode, 0),
! 			gen_df_reg (set_src, 0)));
!   emit_insn (gen_movdf (adjust_address (operands[0], DFmode, 8),
! 			gen_df_reg (set_src, 1)));
    DONE;
  }")


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