explow.c (plus_constant_wide, [...]): New case.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Tue, 3 Jul 2001 01:58:35 +0000 (01:58 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Tue, 3 Jul 2001 01:58:35 +0000 (21:58 -0400)
* 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.

From-SVN: r43720

14 files changed:
gcc/ChangeLog
gcc/alias.c
gcc/config/arm/arm.c
gcc/config/darwin.c
gcc/config/m68k/m68k.c
gcc/config/m88k/m88k.c
gcc/config/mips/mips.c
gcc/config/pa/pa.c
gcc/config/rs6000/rs6000.c
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.md
gcc/explow.c
gcc/recog.c
gcc/rtl.h

index 01d855a..6b30fd3 100644 (file)
@@ -1,3 +1,17 @@
+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.
+
 2001-07-03  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * doc/extend.texi, doc/gcc.texi, doc/invoke.texi, doc/md.texi,
index 79c0c33..8335425 100644 (file)
@@ -959,12 +959,10 @@ canon_rtx (x)
 
       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));
+           return plus_constant (x1, INTVAL (x0));
          else if (GET_CODE (x1) == CONST_INT)
-           return plus_constant_for_output (x0, INTVAL (x1));
+           return plus_constant (x0, INTVAL (x1));
          return gen_rtx_PLUS (GET_MODE (x), x0, x1);
        }
     }
@@ -2349,8 +2347,7 @@ init_alias_analysis ()
                      rtx op0 = XEXP (src, 0);
                      op0 = reg_known_value[REGNO (op0)];
                      reg_known_value[regno]
-                       = plus_constant_for_output (op0,
-                                                   INTVAL (XEXP (src, 1)));
+                       = plus_constant (op0, INTVAL (XEXP (src, 1)));
                      reg_known_equiv_p[regno] = 0;
                    }
                  else if (REG_N_SETS (regno) == 1
index 97ca596..5fe0418 100644 (file)
@@ -2234,7 +2234,7 @@ legitimize_pic_address (orig, mode, reg)
 
        win:
          if (GET_CODE (offset) == CONST_INT)
-           return plus_constant_for_output (base, INTVAL (offset));
+           return plus_constant (base, INTVAL (offset));
        }
 
       if (GET_MODE_SIZE (mode) > 4
index 3771579..816cd4b 100644 (file)
@@ -474,13 +474,9 @@ machopic_indirect_data_reference (orig, reg)
        return orig;
 
       if (MACHOPIC_PURE && GET_CODE (orig) == CONST_INT)
-        {
-         result = plus_constant_for_output (base, INTVAL (orig));
-        }
+       result = plus_constant (base, INTVAL (orig));
       else
-        {
-           result = gen_rtx (PLUS, Pmode, base, orig);
-        }
+       result = gen_rtx (PLUS, Pmode, base, orig);
 
       if (RTX_UNCHANGING_P (base) && RTX_UNCHANGING_P (orig))
        RTX_UNCHANGING_P (result) = 1;
@@ -835,13 +831,11 @@ machopic_legitimize_pic_address (orig, mode, reg)
                                              Pmode, (base == reg ? 0 : reg));
       if (GET_CODE (orig) == CONST_INT)
        {
-         pic_ref = plus_constant_for_output (base, INTVAL (orig));
+         pic_ref = plus_constant (base, INTVAL (orig));
          is_complex = 1;
        }
       else
-       {
-         pic_ref = gen_rtx (PLUS, Pmode, base, orig);
-       }
+       pic_ref = gen_rtx (PLUS, Pmode, base, orig);
 
       if (RTX_UNCHANGING_P (base) && RTX_UNCHANGING_P (orig))
        RTX_UNCHANGING_P (pic_ref) = 1;
index e377e77..d0c3da1 100644 (file)
@@ -1402,7 +1402,7 @@ legitimize_pic_address (orig, mode, reg)
       else abort ();
 
       if (GET_CODE (orig) == CONST_INT)
-       return plus_constant_for_output (base, INTVAL (orig));
+       return plus_constant (base, INTVAL (orig));
       pic_ref = gen_rtx_PLUS (Pmode, base, orig);
       /* Likewise, should we set special REG_NOTEs here?  */
     }
index 12313c9..86332bf 100644 (file)
@@ -368,7 +368,7 @@ legitimize_address (pic, orig, reg, scratch)
          if (GET_CODE (addr) == CONST_INT)
            {
              if (ADD_INT (addr))
-               return plus_constant_for_output (base, INTVAL (addr));
+               return plus_constant (base, INTVAL (addr));
              else if (! reload_in_progress && ! reload_completed)
                addr = force_reg (Pmode, addr);
              /* We can't create any new registers during reload, so use the
index dd735cc..08be812 100644 (file)
@@ -930,9 +930,8 @@ double_memory_operand (op, mode)
     return 1;
 
   return memory_address_p ((GET_MODE_CLASS (mode) == MODE_INT
-                           ? SImode
-                           : SFmode),
-                          plus_constant_for_output (addr, 4));
+                           ? SImode : SFmode),
+                          plus_constant (addr, 4));
 }
 
 /* Return nonzero if the code of this rtx pattern is EQ or NE.  */
index 9100a80..4d17d45 100644 (file)
@@ -758,7 +758,7 @@ legitimize_pic_address (orig, mode, reg)
       if (GET_CODE (orig) == CONST_INT)
        {
          if (INT_14_BITS (orig))
-           return plus_constant_for_output (base, INTVAL (orig));
+           return plus_constant (base, INTVAL (orig));
          orig = force_reg (Pmode, orig);
        }
       pic_ref = gen_rtx_PLUS (Pmode, base, orig);
index 912be34..b9f2348 100644 (file)
@@ -3992,11 +3992,11 @@ print_operand (file, x, code)
             we have already done it, we can just use an offset of word.  */
          if (GET_CODE (XEXP (x, 0)) == PRE_INC
              || GET_CODE (XEXP (x, 0)) == PRE_DEC)
-           output_address (plus_constant_for_output (XEXP (XEXP (x, 0), 0),
-                                                     UNITS_PER_WORD));
+           output_address (plus_constant (XEXP (XEXP (x, 0), 0),
+                                          UNITS_PER_WORD));
          else
-           output_address (plus_constant_for_output (XEXP (x, 0),
-                                                     UNITS_PER_WORD));
+           output_address (plus_constant (XEXP (x, 0), UNITS_PER_WORD));
+
          if (small_data_operand (x, GET_MODE (x)))
            fprintf (file, "@%s(%s)", SMALL_DATA_RELOC,
                     reg_names[SMALL_DATA_REG]);
@@ -8444,7 +8444,7 @@ rs6000_machopic_legitimize_pic_address (orig, mode, reg)
       if (GET_CODE (offset) == CONST_INT)
        {
          if (SMALL_INT (offset))
-           return plus_constant_for_output (base, INTVAL (offset));
+           return plus_constant (base, INTVAL (offset));
          else if (! reload_in_progress && ! reload_completed)
            offset = force_reg (Pmode, offset);
          else
index ab24f0d..05fff2b 100644 (file)
@@ -2813,7 +2813,7 @@ legitimize_pic_address (orig, mode, reg)
       if (GET_CODE (offset) == CONST_INT)
        {
          if (SMALL_INT (offset))
-           return plus_constant_for_output (base, INTVAL (offset));
+           return plus_constant (base, INTVAL (offset));
          else if (! reload_in_progress && ! reload_completed)
            offset = force_reg (Pmode, offset);
          else
index c688804..61c2b9b 100644 (file)
   "
 {
   rtx word0 = adjust_address (operands[1], SImode, 0);
-  rtx word1 = change_address (operands[1], SImode,
-                             plus_constant_for_output (XEXP (word0, 0), 4));
+  rtx word1 = adjust_address (operands[1], SImode, 4);
   rtx high_part = gen_highpart (SImode, operands[0]);
   rtx low_part = gen_lowpart (SImode, operands[0]);
 
   [(clobber (const_int 0))]
   "
 {
-  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));
+  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;
 }")
 
   "
 {
   rtx word0 = adjust_address (operands[1], SFmode, 0);
-  rtx word1 = change_address (operands[1], SFmode,
-                             plus_constant_for_output (XEXP (word0, 0), 4));
+  rtx word1 = adjust_address (operands[1], SFmode, 4);
 
   if (GET_CODE (operands[0]) == SUBREG)
     operands[0] = alter_subreg (operands[0]);
   "
 {
   rtx word0 = adjust_address (operands[0], SFmode, 0);
-  rtx word1 = change_address (operands[0], SFmode,
-                             plus_constant_for_output (XEXP (word0, 0), 4));
+  rtx word1 = adjust_address (operands[0], SFmode, 4);
 
   if (GET_CODE (operands[1]) == SUBREG)
     operands[1] = alter_subreg (operands[1]);
   rtx dest1, dest2;
 
   dest1 = adjust_address (operands[0], SFmode, 0);
-  dest2 = change_address (operands[0], SFmode,
-                         plus_constant_for_output (XEXP (dest1, 0), 4));
+  dest2 = adjust_address (operands[0], SFmode, 4);
+
   emit_insn (gen_movsf (dest1, CONST0_RTX (SFmode)));
   emit_insn (gen_movsf (dest2, CONST0_RTX (SFmode)));
   DONE;
       break;
     case MEM:
       dest1 = adjust_address (set_dest, DFmode, 0);
-      dest2 = change_address (set_dest, DFmode,
-                             plus_constant_for_output (XEXP (dest1, 0), 8));
+      dest2 = adjust_address (set_dest, DFmode, 8);
       break;
     default:
       abort ();      
   "
 {
   rtx word0 = adjust_address (operands[1], DFmode, 0);
-  rtx word1 = change_address (operands[1], DFmode,
-                             plus_constant_for_output (XEXP (word0, 0), 8));
+  rtx word1 = adjust_address (operands[1], DFmode, 8);
   rtx set_dest, dest1, dest2;
 
   set_dest = operands[0];
   [(clobber (const_int 0))]
   "
 {
-  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];
+  rtx 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)));
+  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;
 }")
 \f
index 0281826..a6a05f5 100644 (file)
@@ -174,6 +174,11 @@ plus_constant_wide (x, c)
          c = 0;
        }
       break;
+
+    case LO_SUM:
+      return gen_rtx_LO_SUM (mode, XEXP (x, 0),
+                            plus_constant (XEXP (x, 1), c));
+
       
     default:
       break;
@@ -189,25 +194,6 @@ plus_constant_wide (x, c)
   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);
-}
 \f
 /* If X is a sum, return a new sum like X but lacking any constant terms.
    Add all the removed constant terms into *CONSTPTR.
index dd5318b..10230d5 100644 (file)
@@ -1968,7 +1968,7 @@ offsettable_address_p (strictp, mode, y)
      of the specified mode.  We assume that if Y and Y+c are
      valid addresses then so is Y+d for all 0<d<c.  */
 
-  z = plus_constant_for_output (y, mode_sz - 1);
+  z = plus_constant (y, mode_sz - 1);
 
   /* Use QImode because an odd displacement may be automatically invalid
      for any wider mode.  But it should be valid for a single byte.  */
@@ -2035,8 +2035,7 @@ adj_offsettable_operand (op, offset)
 
       if (CONSTANT_ADDRESS_P (y))
        {
-         new = gen_rtx_MEM (GET_MODE (op),
-                            plus_constant_for_output (y, offset));
+         new = gen_rtx_MEM (GET_MODE (op), plus_constant (y, offset));
          MEM_COPY_ATTRIBUTES (new, op);
          return new;
        }
@@ -2051,12 +2050,12 @@ adj_offsettable_operand (op, offset)
          const_loc = find_constant_term_loc (&z);
          if (const_loc)
            {
-             *const_loc = plus_constant_for_output (*const_loc, offset);
+             *const_loc = plus_constant (*const_loc, offset);
              return op;
            }
        }
 
-      new = gen_rtx_MEM (GET_MODE (op), plus_constant_for_output (y, offset));
+      new = gen_rtx_MEM (GET_MODE (op), plus_constant (y, offset));
       MEM_COPY_ATTRIBUTES (new, op);
       return new;
     }
index 84de8fe..efbaec2 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1144,9 +1144,6 @@ extern int ceil_log2                      PARAMS ((unsigned HOST_WIDE_INT));
 
 #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));