Commit a9098fd0 by Geoff Keating Committed by Geoffrey Keating

rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): All constants of size no larger than…

rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): All constants of size no larger than a pointer should go in the TOC.

* config/rs6000/rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): All
constants of size no larger than a pointer should go in the TOC.
Add 'MODE' parameter.
(LEGITIMIZE_RELOAD_ADDRESS): Add MODE parameter to
ASM_OUTPUT_SPECIAL_POOL_ENTRY_P.
(ASM_OUTPUT_SPECIAL_POOL_ENTRY): Likewise.
* config/rs6000/aix.h (SELECT_RTX_SECTION): Likewise.
* config/rs6000/netware.h (SELECT_RTX_SECTION): Likewise.
* config/rs6000/rs6000.c (constant_pool_expr_1): Likewise.
(rs6000_legitimize_address): Likewise.
(rs6000_emit_move): Likewise.
(rs6000_select_rtx_section): Likewise.
(output_toc): Deal properly with outputting small constants like
HImode, and SFmode in 32-bit mode, and DFmode in 64-bit mode.
* config/rs6000/sysv4.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Add
MODE parameter.  Put small constants in the TOC.

* config/rs6000/rs6000.c (easy_fp_constant_p): All constants are
easy in SImode.
(rs6000_emit_move): When reload calls us with an illegitimate
address, exit early.  Move the change_address calls to one place
at the end of the routine.  Merge the SImode and DImode expanders.
When called by reload to put an integer into a FP register, force
it to memory.

* config/rs6000/rs6000.c (struct toc_hash_struct): Add 'key_mode'
field.
(rs6000_hash_constant): Hash mode too.
(toc_hash_function): Allow for key_mode.
(toc_hash_eq): Structures are different if key_mode differs.
(output_toc): Add 'mode' parameter.  Save key_mode.
* config/rs6000/rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY):
Pass 'mode' parameter.
* config/rs6000/rs6000-protos.h (output_toc): Add 'mode' param.

From-SVN: r35164
parent 89c01f0e
2000-07-20 Geoff Keating <geoffk@cygnus.com>
* config/rs6000/rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): All
constants of size no larger than a pointer should go in the TOC.
Add 'MODE' parameter.
(LEGITIMIZE_RELOAD_ADDRESS): Add MODE parameter to
ASM_OUTPUT_SPECIAL_POOL_ENTRY_P.
(ASM_OUTPUT_SPECIAL_POOL_ENTRY): Likewise.
* config/rs6000/aix.h (SELECT_RTX_SECTION): Likewise.
* config/rs6000/netware.h (SELECT_RTX_SECTION): Likewise.
* config/rs6000/rs6000.c (constant_pool_expr_1): Likewise.
(rs6000_legitimize_address): Likewise.
(rs6000_emit_move): Likewise.
(rs6000_select_rtx_section): Likewise.
(output_toc): Deal properly with outputting small constants like
HImode, and SFmode in 32-bit mode, and DFmode in 64-bit mode.
* config/rs6000/sysv4.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Add
MODE parameter. Put small constants in the TOC.
* config/rs6000/rs6000.c (easy_fp_constant_p): All constants are
easy in SImode.
(rs6000_emit_move): When reload calls us with an illegitimate
address, exit early. Move the change_address calls to one place
at the end of the routine. Merge the SImode and DImode expanders.
When called by reload to put an integer into a FP register, force
it to memory.
* config/rs6000/rs6000.c (struct toc_hash_struct): Add 'key_mode'
field.
(rs6000_hash_constant): Hash mode too.
(toc_hash_function): Allow for key_mode.
(toc_hash_eq): Structures are different if key_mode differs.
(output_toc): Add 'mode' parameter. Save key_mode.
* config/rs6000/rs6000.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY):
Pass 'mode' parameter.
* config/rs6000/rs6000-protos.h (output_toc): Add 'mode' param.
* config/rs6000/rs6000.c (output_toc): Use RS6000_OUTPUT_BASENAME
for vtable references.
......
......@@ -100,14 +100,14 @@ Boston, MA 02111-1307, USA. */
/* Define the options for the binder: Start text at 512, align all segments
to 512 bytes, and warn if there is text relocation.
The -bhalt:4 option supposedly changes the level at which ld will abort,
The -bhalt:4 option supposedly changes the level at which ld will abort,
but it also suppresses warnings about multiply defined symbols and is
used by the AIX cc command. So we use it here.
-bnodelcsect undoes a poor choice of default relating to multiply-defined
csects. See AIX documentation for more information about this.
-bM:SRE tells the linker that the output file is Shared REusable. Note
-bM:SRE tells the linker that the output file is Shared REusable. Note
that to actually build a shared library you will also need to specify an
export list with the -Wl,-bE option. */
......@@ -233,11 +233,11 @@ toc_section () \
However, if this is being placed in the TOC it must be output as a
toc entry. */
#define SELECT_RTX_SECTION(MODE, X) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
toc_section (); \
else \
read_only_private_data_section (); \
#define SELECT_RTX_SECTION(MODE, X) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE)) \
toc_section (); \
else \
read_only_private_data_section (); \
}
/* Indicate that jump tables go in the text section. */
......
......@@ -162,11 +162,11 @@ toc_section () \
/* Use the TOC section for TOC entries. */
#undef SELECT_RTX_SECTION
#define SELECT_RTX_SECTION(MODE, X) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
toc_section (); \
else \
const_section (); \
#define SELECT_RTX_SECTION(MODE, X) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE)) \
toc_section (); \
else \
const_section (); \
}
/* How to renumber registers for dbx and gdb. */
......
......@@ -86,7 +86,7 @@ extern int ccr_bit PARAMS ((rtx, int));
extern void print_operand PARAMS ((FILE *, rtx, int));
extern void print_operand_address PARAMS ((FILE *, rtx));
extern char * output_cbranch PARAMS ((rtx, const char *, int, rtx));
extern void output_toc PARAMS ((FILE *, rtx, int));
extern void output_toc PARAMS ((FILE *, rtx, int, enum machine_mode));
extern int rs6000_adjust_cost PARAMS ((rtx, rtx, rtx, int));
extern int rs6000_adjust_priority PARAMS ((rtx, int));
extern void rs6000_initialize_trampoline PARAMS ((rtx, rtx, rtx));
......
......@@ -1934,55 +1934,55 @@ typedef struct rs6000_args
register by splitting the addend across an addiu/addis and the mem insn.
This cuts number of extra insns needed from 3 to 1. */
#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
do { \
/* We must recognize output that we have already generated ourselves. */ \
if (GET_CODE (X) == PLUS \
&& GET_CODE (XEXP (X, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
&& GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
&& GET_CODE (XEXP (X, 1)) == CONST_INT) \
{ \
push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \
BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
OPNUM, TYPE); \
goto WIN; \
} \
if (GET_CODE (X) == PLUS \
&& GET_CODE (XEXP (X, 0)) == REG \
&& REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
&& REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
&& GET_CODE (XEXP (X, 1)) == CONST_INT) \
{ \
HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000; \
unsigned HOST_WIDE_INT high \
= (((val - low) & 0xffffffffu) ^ 0x80000000u) - 0x80000000u; \
\
/* Check for 32-bit overflow. */ \
if (high + low != val) \
break; \
\
/* Reload the high part into a base reg; leave the low part \
in the mem directly. */ \
\
X = gen_rtx_PLUS (GET_MODE (X), \
gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
GEN_INT (high)), \
GEN_INT (low)); \
\
push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \
BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
OPNUM, TYPE); \
goto WIN; \
} \
else if (TARGET_TOC \
&& CONSTANT_POOL_EXPR_P (X) \
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X))) \
{ \
(X) = create_TOC_reference (X); \
goto WIN; \
} \
#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
do { \
/* We must recognize output that we have already generated ourselves. */ \
if (GET_CODE (X) == PLUS \
&& GET_CODE (XEXP (X, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
&& GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
&& GET_CODE (XEXP (X, 1)) == CONST_INT) \
{ \
push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \
BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
OPNUM, TYPE); \
goto WIN; \
} \
if (GET_CODE (X) == PLUS \
&& GET_CODE (XEXP (X, 0)) == REG \
&& REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
&& REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
&& GET_CODE (XEXP (X, 1)) == CONST_INT) \
{ \
HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000; \
HOST_WIDE_INT high \
= (((val - low) & 0xffffffffu) ^ 0x80000000u) - 0x80000000u; \
\
/* Check for 32-bit overflow. */ \
if (high + low != val) \
break; \
\
/* Reload the high part into a base reg; leave the low part \
in the mem directly. */ \
\
X = gen_rtx_PLUS (GET_MODE (X), \
gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
GEN_INT (high)), \
GEN_INT (low)); \
\
push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \
BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
OPNUM, TYPE); \
goto WIN; \
} \
else if (TARGET_TOC \
&& CONSTANT_POOL_EXPR_P (X) \
&& ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X), MODE)) \
{ \
(X) = create_TOC_reference (X); \
goto WIN; \
} \
} while (0)
/* Go to LABEL if ADDR (a legitimate address expression)
......@@ -2359,39 +2359,41 @@ extern int rs6000_trunc_used;
/* Flag to say the TOC is initialized */
extern int toc_initialized;
/* Return non-zero if this entry is to be written into the constant pool
in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
containing one of them. If -mfp-in-toc (the default), we also do
this for floating-point constants. We actually can only do this
if the FP formats of the target and host machines are the same, but
we can't check that since not every file that uses
GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
/* Return non-zero if this entry is to be written into the constant
pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
or a CONST containing one of them. If -mfp-in-toc (the default),
we also do this for floating-point constants. We actually can only
do this if the FP formats of the target and host machines are the
same, but we can't check that since not every file that uses
GO_IF_LEGITIMATE_ADDRESS_P includes real.h. We also do this when
we can write the entry into the TOC and the entry is not larger
than a TOC entry. */
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
(TARGET_TOC \
&& (GET_CODE (X) == SYMBOL_REF \
|| (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
|| GET_CODE (X) == LABEL_REF \
|| (! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC) \
&& GET_CODE (X) == CONST_DOUBLE \
&& (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
|| TARGET_POWERPC64))))
#if 0
&& BITS_PER_WORD == HOST_BITS_PER_INT)))
#endif
|| (GET_CODE (X) == CONST_INT \
&& GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
|| (GET_CODE (X) == CONST_DOUBLE \
&& (TARGET_POWERPC64 \
|| TARGET_MINIMAL_TOC \
|| (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
&& ! TARGET_NO_FP_IN_TOC)))))
/* Macro to output a special constant pool entry. Go to WIN if we output
it. Otherwise, it is written the usual way.
On the RS/6000, toc entries are handled this way. */
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
{ \
output_toc (FILE, X, LABELNO); \
goto WIN; \
} \
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X, MODE)) \
{ \
output_toc (FILE, X, LABELNO, MODE); \
goto WIN; \
} \
}
/* This is how we tell the assembler that two symbols have the same value. */
......
......@@ -563,12 +563,14 @@ fini_section () \
allow floating point constants in the TOC if -mrelocatable. */
#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
(TARGET_TOC \
&& (GET_CODE (X) == SYMBOL_REF \
|| (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
|| GET_CODE (X) == LABEL_REF \
|| (GET_CODE (X) == CONST_INT \
&& GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
|| (!TARGET_NO_FP_IN_TOC \
&& !TARGET_RELOCATABLE \
&& GET_CODE (X) == CONST_DOUBLE \
......
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