score-protos.h (score_initialize_trampoline): Remove.

* config/score/score-protos.h (score_initialize_trampoline): Remove.
        * config/score/score.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
        (TARGET_TRAMPOLINE_INIT): New.
        (score_asm_trampoline_template): New.
        (score_trampoline_init): Rename from score_initialize_trampoline;
        make static; adjust for hook parameters.
        * config/score/score.h (TRAMPOLINE_TEMPLATE): Move code to
        score[37]_asm_trampoline_template.
        (INITIALIZE_TRAMPOLINE): Remove.
        * config/score/score3.c (score3_asm_trampoline_template): New.
        (score3_trampoline_init): Rename from score3_initialize_trampoline;
        adjust for target hook.
        * config/score/score7.c (score7_asm_trampoline_template): New.
        (score7_trampoline_init): Rename from score7_initialize_trampoline;
        adjust for target hook.
        * config/score/score3.h, config/score/score7.h: Update.

From-SVN: r152010
This commit is contained in:
Richard Henderson 2009-09-22 08:15:38 -07:00 committed by Richard Henderson
parent b81ecf6fd6
commit 2f5bb28c29
8 changed files with 108 additions and 67 deletions

View File

@ -227,6 +227,23 @@
(TRAMPOLINE_TEMPLATE): Remove.
(TRAMPOLINE_ALIGNMENT): New.
* config/score/score-protos.h (score_initialize_trampoline): Remove.
* config/score/score.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
(TARGET_TRAMPOLINE_INIT): New.
(score_asm_trampoline_template): New.
(score_trampoline_init): Rename from score_initialize_trampoline;
make static; adjust for hook parameters.
* config/score/score.h (TRAMPOLINE_TEMPLATE): Move code to
score[37]_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Remove.
* config/score/score3.c (score3_asm_trampoline_template): New.
(score3_trampoline_init): Rename from score3_initialize_trampoline;
adjust for target hook.
* config/score/score7.c (score7_asm_trampoline_template): New.
(score7_trampoline_init): Rename from score7_initialize_trampoline;
adjust for target hook.
* config/score/score3.h, config/score/score7.h: Update.
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes

View File

@ -50,7 +50,6 @@ extern int score_hard_regno_mode_ok (unsigned int, enum machine_mode);
extern int score_const_ok_for_letter_p (HOST_WIDE_INT value, char c);
extern int score_extra_constraint (rtx op, char c);
extern rtx score_return_addr (int count, rtx frame);
extern void score_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN);
extern int score_regno_mode_ok_for_base_p (int regno, int strict);
extern void score_function_arg_advance (CUMULATIVE_ARGS *cum,
enum machine_mode mode,

View File

@ -119,6 +119,11 @@
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE score_can_eliminate
#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
#define TARGET_ASM_TRAMPOLINE_TEMPLATE score_asm_trampoline_template
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT score_trampoline_init
struct extern_list *extern_head = 0;
/* default 0 = NO_REGS */
@ -519,14 +524,27 @@ score_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
gcc_unreachable ();
}
/* Implement INITIALIZE_TRAMPOLINE macro. */
void
score_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE. */
static void
score_asm_trampoline_template (FILE *f)
{
if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
return score7_initialize_trampoline (ADDR, FUNC, CHAIN);
return score7_asm_trampoline_template (f);
else if (TARGET_SCORE3)
return score3_initialize_trampoline (ADDR, FUNC, CHAIN);
return score3_asm_trampoline_template (f);
gcc_unreachable ();
}
/* Implement TARGET_TRAMPOLINE_INIT. */
static void
score_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{
/* ??? These two routines are identical. */
if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
return score7_trampoline_init (m_tramp, fndecl, chain_value);
else if (TARGET_SCORE3)
return score3_trampoline_init (m_tramp, fndecl, chain_value);
gcc_unreachable ();
}

View File

@ -673,54 +673,12 @@ typedef struct score_args
} \
} while (0)
#define TRAMPOLINE_TEMPLATE(STREAM) \
do { \
if (TARGET_SCORE7) \
{ \
fprintf (STREAM, "\t.set r1\n"); \
fprintf (STREAM, "\tmv r31, r3\n"); \
fprintf (STREAM, "\tbl nextinsn\n"); \
fprintf (STREAM, "nextinsn:\n"); \
fprintf (STREAM, "\tlw r1, [r3, 6*4-8]\n"); \
fprintf (STREAM, "\tlw r23, [r3, 6*4-4]\n"); \
fprintf (STREAM, "\tmv r3, r31\n"); \
fprintf (STREAM, "\tbr! r1\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\t.set nor1\n"); \
} \
else if (TARGET_SCORE3) \
{ \
fprintf (STREAM, "\t.set r1\n"); \
fprintf (STREAM, "\tmv! r31, r3\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\tbl nextinsn\n"); \
fprintf (STREAM, "nextinsn:\n"); \
fprintf (STREAM, "\tlw! r1, [r3, 6*4-8]\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\tlw r23, [r3, 6*4-4]\n"); \
fprintf (STREAM, "\tmv! r3, r31\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\tbr! r1\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\t.set nor1\n"); \
} \
} while (0)
/* Trampolines for Nested Functions. */
#define TRAMPOLINE_INSNS 6
/* A C expression for the size in bytes of the trampoline, as an integer. */
#define TRAMPOLINE_SIZE (24 + GET_MODE_SIZE (ptr_mode) * 2)
/* A C statement to initialize the variable parts of a trampoline.
ADDR is an RTX for the address of the trampoline; FNADDR is an
RTX for the address of the nested function; STATIC_CHAIN is an
RTX for the static chain value that should be passed to the
function when it is called. */
#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \
score_initialize_trampoline (ADDR, FUNC, CHAIN)
#define HAVE_PRE_INCREMENT 1
#define HAVE_PRE_DECREMENT 1
#define HAVE_POST_INCREMENT 1
@ -1067,7 +1025,7 @@ typedef struct score_args
for 32-bit targets. */
#define FUNCTION_MODE Pmode
struct extern_list GTY ((chain_next ("%h.next")))
struct GTY ((chain_next ("%h.next"))) extern_list
{
struct extern_list *next; /* next external */
const char *name; /* name of the external */

View File

@ -870,23 +870,48 @@ score3_function_value (tree valtype, tree func, enum machine_mode mode)
return gen_rtx_REG (mode, RT_REGNUM);
}
/* Implement INITIALIZE_TRAMPOLINE macro. */
/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE. */
void
score3_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
score3_asm_trampoline_template (FILE *f)
{
fprintf (f, "\t.set r1\n");
fprintf (f, "\tmv! r31, r3\n");
fprintf (f, "\tnop!\n");
fprintf (f, "\tbl nextinsn\n");
fprintf (f, "nextinsn:\n");
fprintf (f, "\tlw! r1, [r3, 6*4-8]\n");
fprintf (f, "\tnop!\n");
fprintf (f, "\tlw r23, [r3, 6*4-4]\n");
fprintf (f, "\tmv! r3, r31\n");
fprintf (f, "\tnop!\n");
fprintf (f, "\tbr! r1\n");
fprintf (f, "\tnop!\n");
fprintf (f, "\t.set nor1\n");
}
/* Implement TARGET_TRAMPOLINE_INIT. */
void
score3_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{
#define FFCACHE "_flush_cache"
#define CODE_SIZE (TRAMPOLINE_INSNS * UNITS_PER_WORD)
rtx pfunc, pchain;
rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
rtx addr = XEXP (m_tramp, 0);
rtx mem;
pfunc = plus_constant (ADDR, CODE_SIZE);
pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (SImode));
emit_block_move (m_tramp, assemble_trampoline_template (),
GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
mem = adjust_address (m_tramp, SImode, CODE_SIZE);
emit_move_insn (mem, fnaddr);
mem = adjust_address (m_tramp, SImode, CODE_SIZE + GET_MODE_SIZE (SImode));
emit_move_insn (mem, chain_value);
emit_move_insn (gen_rtx_MEM (SImode, pfunc), FUNC);
emit_move_insn (gen_rtx_MEM (SImode, pchain), CHAIN);
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
0, VOIDmode, 2,
ADDR, Pmode,
addr, Pmode,
GEN_INT (TRAMPOLINE_SIZE), SImode);
#undef FFCACHE
#undef CODE_SIZE

View File

@ -120,7 +120,8 @@ extern rtx score3_function_arg (const CUMULATIVE_ARGS *cum,
extern rtx score3_function_value (tree valtype,
tree func ATTRIBUTE_UNUSED,
enum machine_mode mode);
extern void score3_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN);
extern void score3_asm_trampoline_template (FILE *);
extern void score3_trampoline_init (rtx, tree, rtx);
extern int score3_regno_mode_ok_for_base_p (int regno, int strict);
extern bool score3_legitimate_address_p (enum machine_mode mode, rtx x,
bool strict);

View File

@ -861,23 +861,45 @@ score7_function_value (tree valtype, tree func, enum machine_mode mode)
return gen_rtx_REG (mode, RT_REGNUM);
}
/* Implement INITIALIZE_TRAMPOLINE macro. */
/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE. */
void
score7_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
score7_asm_trampoline_template (FILE *f)
{
fprintf (f, "\t.set r1\n");
fprintf (f, "\tmv r31, r3\n");
fprintf (f, "\tbl nextinsn\n");
fprintf (f, "nextinsn:\n");
fprintf (f, "\tlw r1, [r3, 6*4-8]\n");
fprintf (f, "\tlw r23, [r3, 6*4-4]\n");
fprintf (f, "\tmv r3, r31\n");
fprintf (f, "\tbr! r1\n");
fprintf (f, "\tnop!\n");
fprintf (f, "\t.set nor1\n");
}
/* Implement TARGET_TRAMPOLINE_INIT. */
void
score7_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{
#define FFCACHE "_flush_cache"
#define CODE_SIZE (TRAMPOLINE_INSNS * UNITS_PER_WORD)
rtx pfunc, pchain;
rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
rtx addr = XEXP (m_tramp, 0);
rtx mem;
pfunc = plus_constant (ADDR, CODE_SIZE);
pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (SImode));
emit_block_move (m_tramp, assemble_trampoline_template (),
GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
mem = adjust_address (m_tramp, SImode, CODE_SIZE);
emit_move_insn (mem, fnaddr);
mem = adjust_address (m_tramp, SImode, CODE_SIZE + GET_MODE_SIZE (SImode));
emit_move_insn (mem, chain_value);
emit_move_insn (gen_rtx_MEM (SImode, pfunc), FUNC);
emit_move_insn (gen_rtx_MEM (SImode, pchain), CHAIN);
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
0, VOIDmode, 2,
ADDR, Pmode,
addr, Pmode,
GEN_INT (TRAMPOLINE_SIZE), SImode);
#undef FFCACHE
#undef CODE_SIZE

View File

@ -120,7 +120,8 @@ extern rtx score7_function_arg (const CUMULATIVE_ARGS *cum,
extern rtx score7_function_value (tree valtype,
tree func ATTRIBUTE_UNUSED,
enum machine_mode mode);
extern void score7_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN);
extern void score7_asm_trampoline_template (FILE *);
extern void score7_trampoline_init (rtx, tree, rtx);
extern int score7_regno_mode_ok_for_base_p (int regno, int strict);
extern bool score7_legitimate_address_p (enum machine_mode mode, rtx x,
bool strict);