]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.c (mips_constant_info): Add reloc field.
authorRichard Sandiford <rsandifo@redhat.com>
Sun, 28 Sep 2003 07:39:30 +0000 (07:39 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 28 Sep 2003 07:39:30 +0000 (07:39 +0000)
* config/mips/mips.c (mips_constant_info): Add reloc field.
(mips_classify_constant): Initialize it.  Always set SYMBOL to the
underlying symbol, not to an unspec.
(mips_delegitimize_address, print_operand): Clean up accordingly.

From-SVN: r71877

gcc/ChangeLog
gcc/config/mips/mips.c

index 85be8b51eb7b710aec72658292f57ea0cb962d2b..1965f1b518dc79ca8c5efc5e74e3259c43ef8e1d 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-28  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips.c (mips_constant_info): Add reloc field.
+       (mips_classify_constant): Initialize it.  Always set SYMBOL to the
+       underlying symbol, not to an unspec.
+       (mips_delegitimize_address, print_operand): Clean up accordingly.
+
 2003-09-28  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips-protos.h (mips16_gp_pseudo_reg): Remove.
index fe6510b087d872c587e61bc0b01a69e15f2e657f..7fcab39b367b2f7c63207c0b805e6b7a4cabf189 100644 (file)
@@ -351,14 +351,15 @@ struct mips_arg_info
    CONSTANT_GP
        No fields are valid.
 
-   CONSTANT_RELOC
-       SYMBOL is the relocation UNSPEC and OFFSET is the offset applied
-       to the symbol.
-
    CONSTANT_SYMBOLIC
-       SYMBOL is the referenced symbol and OFFSET is the constant offset.  */
+       SYMBOL is the referenced symbol and OFFSET is the constant offset.
+
+   CONSTANT_RELOC
+       SYMBOL and OFFSET are the same as for CONSTANT_SYMBOLIC.  RELOC is
+       the relocation number.  */
 struct mips_constant_info
 {
+  int reloc;
   rtx symbol;
   HOST_WIDE_INT offset;
 };
@@ -828,8 +829,11 @@ mips_reloc_offset_ok_p (int reloc, HOST_WIDE_INT offset)
 static enum mips_constant_type
 mips_classify_constant (struct mips_constant_info *info, rtx x)
 {
+  enum mips_constant_type type;
+
+  type = CONSTANT_SYMBOLIC;
   info->offset = 0;
-  info->symbol = x;
+
   if (GET_CODE (x) == CONST)
     {
       x = XEXP (x, 0);
@@ -842,14 +846,21 @@ mips_classify_constant (struct mips_constant_info *info, rtx x)
          info->offset += INTVAL (XEXP (x, 1));
          x = XEXP (x, 0);
        }
-      info->symbol = x;
 
       if (GET_CODE (x) == UNSPEC
          && mips_reloc_offset_ok_p (XINT (x, 1), info->offset))
-       return CONSTANT_RELOC;
+       {
+         info->reloc = XINT (x, 1);
+         x = XVECEXP (x, 0, 0);
+         type = CONSTANT_RELOC;
+       }
     }
+
   if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
-    return CONSTANT_SYMBOLIC;
+    {
+      info->symbol = x;
+      return type;
+    }
   return CONSTANT_NONE;
 }
 
@@ -1989,15 +2000,15 @@ mips_delegitimize_address (rtx x)
   if (GET_CODE (x) == MEM
       && GET_CODE (XEXP (x, 0)) == PLUS
       && mips_classify_constant (&c, XEXP (XEXP (x, 0), 1)) == CONSTANT_RELOC
-      && mips_classify_symbol (XVECEXP (c.symbol, 0, 0)) == SYMBOL_GOT_GLOBAL)
-    return XVECEXP (c.symbol, 0, 0);
+      && mips_classify_symbol (c.symbol) == SYMBOL_GOT_GLOBAL)
+    return c.symbol;
 
   if (GET_CODE (x) == PLUS
       && (XEXP (x, 0) == pic_offset_table_rtx
          || XEXP (x, 0) == cfun->machine->mips16_gp_pseudo_rtx)
       && mips_classify_constant (&c, XEXP (x, 1)) == CONSTANT_RELOC
-      && mips_classify_symbol (XVECEXP (c.symbol, 0, 0)) == SYMBOL_SMALL_DATA)
-    return plus_constant (XVECEXP (c.symbol, 0, 0), c.offset);
+      && mips_classify_symbol (c.symbol) == SYMBOL_SMALL_DATA)
+    return plus_constant (c.symbol, c.offset);
 
   return x;
 }
@@ -5434,10 +5445,9 @@ print_operand (FILE *file, rtx op, int letter)
        break;
 
       case CONSTANT_RELOC:
-       reloc = mips_reloc_string (XINT (c.symbol, 1));
+       reloc = mips_reloc_string (c.reloc);
        fputs (reloc, file);
-       output_addr_const (file, plus_constant (XVECEXP (c.symbol, 0, 0),
-                                               c.offset));
+       output_addr_const (file, plus_constant (c.symbol, c.offset));
        while (*reloc != 0)
          if (*reloc++ == '(')
            fputc (')', file);