mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.

gcc/
	* config/mips/mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.
	* config/mips/mips.c (mips_classify_symbol): Skip TARGET_ABICALLS
	block for locally-binding symbols if TARGET_ABSOLUTE_ABICALLS.
	Return SYMBOL_FORCE_TO_MEM instead of SYMBOL_ABSOLUTE for
	non-call contexts if TARGET_MIPS16.
	(mips_symbolic_constant_p): Handle SYMBOL_FORCE_TO_MEM.
	(mips_symbolic_address_p): Likewise.  Remove special TARGET_MIPS16
	code for SYMBOL_ABSOLUTE.
	(mips_symbol_insns): Likewise.

From-SVN: r127296
This commit is contained in:
Richard Sandiford 2007-08-08 15:26:03 +00:00 committed by Richard Sandiford
parent 280fcbfab4
commit e06e277682
3 changed files with 31 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2007-08-08 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.
* config/mips/mips.c (mips_classify_symbol): Skip TARGET_ABICALLS
block for locally-binding symbols if TARGET_ABSOLUTE_ABICALLS.
Return SYMBOL_FORCE_TO_MEM instead of SYMBOL_ABSOLUTE for
non-call contexts if TARGET_MIPS16.
(mips_symbolic_constant_p): Handle SYMBOL_FORCE_TO_MEM.
(mips_symbolic_address_p): Likewise. Remove special TARGET_MIPS16
code for SYMBOL_ABSOLUTE.
(mips_symbol_insns): Likewise.
2007-08-08 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips-protos.h (mips_symbol_context): New enumeration.

View File

@ -55,6 +55,9 @@ enum mips_symbol_context {
The symbol's value will be calculated using a MIPS16 PC-relative
calculation.
SYMBOL_FORCE_TO_MEM
The symbol's value must be forced to memory and loaded from there.
SYMBOL_GOT_PAGE_OFST
The symbol's value will be calculated by loading an address
from the GOT and then applying a 16-bit offset.
@ -109,6 +112,7 @@ enum mips_symbol_type {
SYMBOL_ABSOLUTE,
SYMBOL_GP_RELATIVE,
SYMBOL_PC_RELATIVE,
SYMBOL_FORCE_TO_MEM,
SYMBOL_GOT_PAGE_OFST,
SYMBOL_GOT_DISP,
SYMBOL_GOTOFF_PAGE,

View File

@ -1438,7 +1438,7 @@ mips_symbol_binds_local_p (rtx x)
LABEL_REF X in context CONTEXT. */
static enum mips_symbol_type
mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
mips_classify_symbol (rtx x, enum mips_symbol_context context)
{
if (TARGET_RTP_PIC)
return SYMBOL_GOT_DISP;
@ -1473,13 +1473,11 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
&& !SYMBOL_REF_WEAK (x))
return SYMBOL_GP_RELATIVE;
if (TARGET_ABICALLS)
/* Don't use GOT accesses for locally-binding symbols when -mno-shared
is in effect. */
if (TARGET_ABICALLS
&& !(TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x)))
{
/* Don't use GOT accesses for locally-binding symbols; we can use
%hi and %lo instead. */
if (TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x))
return SYMBOL_ABSOLUTE;
/* There are three cases to consider:
- o32 PIC (either with or without explicit relocs)
@ -1505,6 +1503,8 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
return SYMBOL_GOT_PAGE_OFST;
}
if (TARGET_MIPS16 && context != SYMBOL_CONTEXT_CALL)
return SYMBOL_FORCE_TO_MEM;
return SYMBOL_ABSOLUTE;
}
@ -1560,6 +1560,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context,
switch (*symbol_type)
{
case SYMBOL_ABSOLUTE:
case SYMBOL_FORCE_TO_MEM:
case SYMBOL_64_HIGH:
case SYMBOL_64_MID:
case SYMBOL_64_LOW:
@ -1682,8 +1683,6 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
switch (symbol_type)
{
case SYMBOL_ABSOLUTE:
return !TARGET_MIPS16;
case SYMBOL_GP_RELATIVE:
return true;
@ -1694,8 +1693,10 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
case SYMBOL_GOT_PAGE_OFST:
return true;
case SYMBOL_FORCE_TO_MEM:
case SYMBOL_GOT_DISP:
/* The address will have to be loaded from the GOT first. */
/* The address will have to be loaded from the constant pool
or GOT before it is used in an address. */
return false;
case SYMBOL_GOTOFF_PAGE:
@ -1841,11 +1842,6 @@ mips_symbol_insns (enum mips_symbol_type type)
switch (type)
{
case SYMBOL_ABSOLUTE:
/* In mips16 code, general symbols must be fetched from the
constant pool. */
if (TARGET_MIPS16)
return 0;
/* When using 64-bit symbols, we need 5 preparatory instructions,
such as:
@ -1868,6 +1864,10 @@ mips_symbol_insns (enum mips_symbol_type type)
extended instruction. */
return 2;
case SYMBOL_FORCE_TO_MEM:
/* The constant must be loaded from the constant pool. */
return 0;
case SYMBOL_GOT_PAGE_OFST:
case SYMBOL_GOT_DISP:
/* Unless -funit-at-a-time is in effect, we can't be sure whether