]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/7784 ([Sparc] ICE in extract_insn, at recog.c:2148)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Wed, 26 Mar 2003 07:58:49 +0000 (08:58 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 26 Mar 2003 07:58:49 +0000 (07:58 +0000)
PR target/7784
* reload.c (find_reloads_address): Handle
(PLUS (PLUS (REG) (REG)) (CONST_INT)) form for
all base registers.

From-SVN: r64891

gcc/ChangeLog
gcc/reload.c
gcc/testsuite/ChangeLog

index ebdd20c98d540a4e00dedafd6ee6c0b825720a2b..8532a73e15fd1249dcbc22ac6ebe6f566e26fb97 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-26  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR target/7784
+       * reload.c (find_reloads_address): Handle
+       (PLUS (PLUS (REG) (REG)) (CONST_INT)) form for
+       all base registers.
+
 2003-03-25  Jason Merrill  <jason@redhat.com>
 
        PR optimization/10171
index 71ed1d6771c35a1ab7280d383c16bb948d3bc664..a27da24982752dc0b6473ce680467827c4c43f4f 100644 (file)
@@ -4825,25 +4825,23 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
      that the index needs a reload and find_reloads_address_1 will take care
      of it.
 
-     If we decide to do something here, it must be that
-     `double_reg_address_ok' is true and that this address rtl was made by
-     eliminate_regs.  We generate a reload of the fp/sp/ap + constant and
+     Handle all base registers here, not just fp/ap/sp, because on some
+     targets (namely Sparc) we can also get invalid addresses from preventive
+     subreg big-endian corrections made by find_reloads_toplev.
+
+     If we decide to do something, it must be that `double_reg_address_ok'
+     is true.  We generate a reload of the base register + constant and
      rework the sum so that the reload register will be added to the index.
      This is safe because we know the address isn't shared.
 
-     We check for fp/ap/sp as both the first and second operand of the
-     innermost PLUS.  */
+     We check for the base register as both the first and second operand of
+     the innermost PLUS.  */
 
   else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
           && GET_CODE (XEXP (ad, 0)) == PLUS
-          && (XEXP (XEXP (ad, 0), 0) == frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
-              || XEXP (XEXP (ad, 0), 0) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
-              || XEXP (XEXP (ad, 0), 0) == arg_pointer_rtx
-#endif
-              || XEXP (XEXP (ad, 0), 0) == stack_pointer_rtx)
+          && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
+          && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
+          && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
           && ! memory_address_p (mode, ad))
     {
       *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
@@ -4861,14 +4859,9 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
 
   else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
           && GET_CODE (XEXP (ad, 0)) == PLUS
-          && (XEXP (XEXP (ad, 0), 1) == frame_pointer_rtx
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
-              || XEXP (XEXP (ad, 0), 1) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
-              || XEXP (XEXP (ad, 0), 1) == arg_pointer_rtx
-#endif
-              || XEXP (XEXP (ad, 0), 1) == stack_pointer_rtx)
+          && GET_CODE (XEXP (XEXP (ad, 0), 1)) == REG
+          && REGNO (XEXP (XEXP (ad, 0), 1)) < FIRST_PSEUDO_REGISTER
+          && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode)
           && ! memory_address_p (mode, ad))
     {
       *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
index 98cb57bd00e2169271a045e62ed89ddcb8319633..b014b09420bdf12115e992d651f46310c6281d1b 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-26  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/ultrasp6.c: New test.
+
 2003-03-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.dg/i386-signbit-1.c: Tweak options.