summaryrefslogtreecommitdiff
path: root/gcc/config/score
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-22 15:15:38 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-22 15:15:38 +0000
commit9f48de62d1887f6ba44689b94a47ed41b17dcbf5 (patch)
treeeb90bdd16f974cd061072d89ecb75cf70fe7e26e /gcc/config/score
parent4d9467320f5f3808a6e9113c9e42d81143142e74 (diff)
downloadgcc-9f48de62d1887f6ba44689b94a47ed41b17dcbf5.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152010 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/score')
-rw-r--r--gcc/config/score/score-protos.h1
-rw-r--r--gcc/config/score/score.c28
-rw-r--r--gcc/config/score/score.h44
-rw-r--r--gcc/config/score/score3.c41
-rw-r--r--gcc/config/score/score3.h3
-rw-r--r--gcc/config/score/score7.c38
-rw-r--r--gcc/config/score/score7.h3
7 files changed, 91 insertions, 67 deletions
diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h
index 204dc1876a4..d42ec14eb69 100644
--- a/gcc/config/score/score-protos.h
+++ b/gcc/config/score/score-protos.h
@@ -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,
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index 12eb76b1a41..4324d653e1e 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -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_asm_trampoline_template (f);
+ else if (TARGET_SCORE3)
+ 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_initialize_trampoline (ADDR, FUNC, CHAIN);
+ return score7_trampoline_init (m_tramp, fndecl, chain_value);
else if (TARGET_SCORE3)
- return score3_initialize_trampoline (ADDR, FUNC, CHAIN);
+ return score3_trampoline_init (m_tramp, fndecl, chain_value);
gcc_unreachable ();
}
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index ea3e0168995..0b7af7b2739 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -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 */
diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c
index d27d1f9f764..a5c8e608d15 100644
--- a/gcc/config/score/score3.c
+++ b/gcc/config/score/score3.c
@@ -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_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_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
+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;
+
+ emit_block_move (m_tramp, assemble_trampoline_template (),
+ GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
- pfunc = plus_constant (ADDR, CODE_SIZE);
- pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (SImode));
+ 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
diff --git a/gcc/config/score/score3.h b/gcc/config/score/score3.h
index 001b2f0c2ee..4e545fc9570 100644
--- a/gcc/config/score/score3.h
+++ b/gcc/config/score/score3.h
@@ -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);
diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c
index 4ba3dce43a1..2307201f166 100644
--- a/gcc/config/score/score7.c
+++ b/gcc/config/score/score7.c
@@ -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_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_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
+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;
+
+ emit_block_move (m_tramp, assemble_trampoline_template (),
+ GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
- pfunc = plus_constant (ADDR, CODE_SIZE);
- pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (SImode));
+ 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
diff --git a/gcc/config/score/score7.h b/gcc/config/score/score7.h
index ae3f4e837cb..0931a2b97e5 100644
--- a/gcc/config/score/score7.h
+++ b/gcc/config/score/score7.h
@@ -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);