mips.c (mips_constant_info): Add reloc field.

* 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
This commit is contained in:
Richard Sandiford 2003-09-28 07:39:30 +00:00 committed by Richard Sandiford
parent d34053edb7
commit c54859d3c9
2 changed files with 33 additions and 16 deletions

View 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.

View 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);