i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the GOTOFF operand.
authorJan Hubicka <jh@suse.cz>
Tue, 8 Apr 2003 09:14:06 +0000 (11:14 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 8 Apr 2003 09:14:06 +0000 (09:14 +0000)
* i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the
GOTOFF operand.
(legitimize_pic_address): Move plus outside the unspec.
* i386.c (legitimate_constant_p):  Check (CONST (PLUS (UNSPEC ...
for validity.

From-SVN: r65367

gcc/ChangeLog
gcc/config/i386/i386.c

index 3d2e834..63bac4b 100644 (file)
@@ -1,3 +1,11 @@
+Tue Apr  8 11:12:07 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       * i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the
+       GOTOFF operand.
+       (legitimize_pic_address): Move plus outside the unspec.
+       * i386.c (legitimate_constant_p):  Check (CONST (PLUS (UNSPEC ...
+       for validity.
+
 2003-04-08  Nathan Sidwell  <nathan@codesourcery.com>
 
        * gcov-io.h (gcov_save_position): Remove __inline__ from
index fab8d95..b4c8faf 100644 (file)
@@ -5674,6 +5674,13 @@ legitimate_constant_p (x)
          && tls_symbolic_operand (XEXP (inner, 0), Pmode))
        return false;
 
+      if (GET_CODE (inner) == PLUS)
+       {
+         if (GET_CODE (XEXP (inner, 1)) != CONST_INT)
+           return false;
+         inner = XEXP (inner, 0);
+       }
+
       /* Only some unspecs are valid as "constants".  */
       if (GET_CODE (inner) == UNSPEC)
        switch (XINT (inner, 1))
@@ -5833,7 +5840,10 @@ legitimate_pic_address_disp_p (disp)
        return false;
       return GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF;
     case UNSPEC_GOTOFF:
-      return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
+      if (GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF
+         || GET_CODE (XVECEXP (disp, 0, 0)) == LABEL_REF)
+        return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
+      return false;
     case UNSPEC_GOTTPOFF:
     case UNSPEC_GOTNTPOFF:
     case UNSPEC_INDNTPOFF:
@@ -6146,7 +6156,15 @@ legitimize_pic_address (orig, reg)
 
       if (reload_in_progress)
        regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
-      new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF);
+      if (GET_CODE (addr) == CONST)
+       addr = XEXP (addr, 0);
+      if (GET_CODE (addr) == PLUS)
+         {
+            new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, XEXP (addr, 0)), UNSPEC_GOTOFF);
+           new = gen_rtx_PLUS (Pmode, new, XEXP (addr, 1));
+         }
+       else
+          new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF);
       new = gen_rtx_CONST (Pmode, new);
       new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);