Commit e06e2776 by Richard Sandiford Committed by Richard Sandiford

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
parent 280fcbfa
2007-08-08 Richard Sandiford <richard@codesourcery.com> 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. * config/mips/mips-protos.h (mips_symbol_context): New enumeration.
* config/mips/mips.c (mips_classify_symbol): Take a context argument. * config/mips/mips.c (mips_classify_symbol): Take a context argument.
(mips_symbolic_constant_p): Likewise. Update the call to (mips_symbolic_constant_p): Likewise. Update the call to
......
...@@ -55,6 +55,9 @@ enum mips_symbol_context { ...@@ -55,6 +55,9 @@ enum mips_symbol_context {
The symbol's value will be calculated using a MIPS16 PC-relative The symbol's value will be calculated using a MIPS16 PC-relative
calculation. calculation.
SYMBOL_FORCE_TO_MEM
The symbol's value must be forced to memory and loaded from there.
SYMBOL_GOT_PAGE_OFST SYMBOL_GOT_PAGE_OFST
The symbol's value will be calculated by loading an address The symbol's value will be calculated by loading an address
from the GOT and then applying a 16-bit offset. from the GOT and then applying a 16-bit offset.
...@@ -109,6 +112,7 @@ enum mips_symbol_type { ...@@ -109,6 +112,7 @@ enum mips_symbol_type {
SYMBOL_ABSOLUTE, SYMBOL_ABSOLUTE,
SYMBOL_GP_RELATIVE, SYMBOL_GP_RELATIVE,
SYMBOL_PC_RELATIVE, SYMBOL_PC_RELATIVE,
SYMBOL_FORCE_TO_MEM,
SYMBOL_GOT_PAGE_OFST, SYMBOL_GOT_PAGE_OFST,
SYMBOL_GOT_DISP, SYMBOL_GOT_DISP,
SYMBOL_GOTOFF_PAGE, SYMBOL_GOTOFF_PAGE,
......
...@@ -1438,7 +1438,7 @@ mips_symbol_binds_local_p (rtx x) ...@@ -1438,7 +1438,7 @@ mips_symbol_binds_local_p (rtx x)
LABEL_REF X in context CONTEXT. */ LABEL_REF X in context CONTEXT. */
static enum mips_symbol_type 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) if (TARGET_RTP_PIC)
return SYMBOL_GOT_DISP; return SYMBOL_GOT_DISP;
...@@ -1473,13 +1473,11 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED) ...@@ -1473,13 +1473,11 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
&& !SYMBOL_REF_WEAK (x)) && !SYMBOL_REF_WEAK (x))
return SYMBOL_GP_RELATIVE; 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: /* There are three cases to consider:
- o32 PIC (either with or without explicit relocs) - o32 PIC (either with or without explicit relocs)
...@@ -1505,6 +1503,8 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED) ...@@ -1505,6 +1503,8 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
return SYMBOL_GOT_PAGE_OFST; return SYMBOL_GOT_PAGE_OFST;
} }
if (TARGET_MIPS16 && context != SYMBOL_CONTEXT_CALL)
return SYMBOL_FORCE_TO_MEM;
return SYMBOL_ABSOLUTE; return SYMBOL_ABSOLUTE;
} }
...@@ -1560,6 +1560,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context, ...@@ -1560,6 +1560,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context,
switch (*symbol_type) switch (*symbol_type)
{ {
case SYMBOL_ABSOLUTE: case SYMBOL_ABSOLUTE:
case SYMBOL_FORCE_TO_MEM:
case SYMBOL_64_HIGH: case SYMBOL_64_HIGH:
case SYMBOL_64_MID: case SYMBOL_64_MID:
case SYMBOL_64_LOW: case SYMBOL_64_LOW:
...@@ -1682,8 +1683,6 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type, ...@@ -1682,8 +1683,6 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
switch (symbol_type) switch (symbol_type)
{ {
case SYMBOL_ABSOLUTE: case SYMBOL_ABSOLUTE:
return !TARGET_MIPS16;
case SYMBOL_GP_RELATIVE: case SYMBOL_GP_RELATIVE:
return true; return true;
...@@ -1694,8 +1693,10 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type, ...@@ -1694,8 +1693,10 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
case SYMBOL_GOT_PAGE_OFST: case SYMBOL_GOT_PAGE_OFST:
return true; return true;
case SYMBOL_FORCE_TO_MEM:
case SYMBOL_GOT_DISP: 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; return false;
case SYMBOL_GOTOFF_PAGE: case SYMBOL_GOTOFF_PAGE:
...@@ -1841,11 +1842,6 @@ mips_symbol_insns (enum mips_symbol_type type) ...@@ -1841,11 +1842,6 @@ mips_symbol_insns (enum mips_symbol_type type)
switch (type) switch (type)
{ {
case SYMBOL_ABSOLUTE: 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, /* When using 64-bit symbols, we need 5 preparatory instructions,
such as: such as:
...@@ -1868,6 +1864,10 @@ mips_symbol_insns (enum mips_symbol_type type) ...@@ -1868,6 +1864,10 @@ mips_symbol_insns (enum mips_symbol_type type)
extended instruction. */ extended instruction. */
return 2; 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_PAGE_OFST:
case SYMBOL_GOT_DISP: case SYMBOL_GOT_DISP:
/* Unless -funit-at-a-time is in effect, we can't be sure whether /* Unless -funit-at-a-time is in effect, we can't be sure whether
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment