aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-22 08:12:41 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-22 08:12:41 -0700
commit98689f5ecea084b5311ed2f57fb7955f5265cbf7 (patch)
tree01deae7580a91d247788e800a12ea21d86f15b03
parent956c97fc6916b5f20595175e8aac7d3e2121a87c (diff)
downloadgcc-98689f5ecea084b5311ed2f57fb7955f5265cbf7.zip
gcc-98689f5ecea084b5311ed2f57fb7955f5265cbf7.tar.gz
gcc-98689f5ecea084b5311ed2f57fb7955f5265cbf7.tar.bz2
fr30.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, [...]): New.
* config/fr30/fr30.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT, fr30_asm_trampoline_template, fr30_trampoline_init): New. * config/fr30/fr30.h (TRAMPOLINE_TEMPLATE): Move code to fr30_asm_trampoline_template. (INITIALIZE_TRAMPOLINE): Move code to fr30_trampoline_init; adjust for target hook parameters. From-SVN: r151991
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/fr30/fr30.c51
-rw-r--r--gcc/config/fr30/fr30.h36
3 files changed, 59 insertions, 36 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 02d30dd..2979fd7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -89,6 +89,14 @@
* config/crx/crx.h (INITIALIZE_TRAMPOLINE): Remove.
+ * config/fr30/fr30.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
+ TARGET_TRAMPOLINE_INIT, fr30_asm_trampoline_template,
+ fr30_trampoline_init): New.
+ * config/fr30/fr30.h (TRAMPOLINE_TEMPLATE): Move code to
+ fr30_asm_trampoline_template.
+ (INITIALIZE_TRAMPOLINE): Move code to fr30_trampoline_init;
+ adjust for target hook parameters.
+
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 431af8f..faa637c 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -121,6 +121,8 @@ static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static bool fr30_frame_pointer_required (void);
static bool fr30_can_eliminate (const int, const int);
+static void fr30_asm_trampoline_template (FILE *);
+static void fr30_trampoline_init (rtx, tree, rtx);
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM))
@@ -165,6 +167,11 @@ static bool fr30_can_eliminate (const int, const int);
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE fr30_can_eliminate
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE fr30_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT fr30_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -924,6 +931,50 @@ fr30_frame_pointer_required (void)
}
/*}}}*/
+/*{{{ Trampoline Output Routines */
+
+/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE.
+ On the FR30, the trampoline is:
+
+ nop
+ ldi:32 STATIC, r12
+ nop
+ ldi:32 FUNCTION, r0
+ jmp @r0
+
+ The no-ops are to guarantee that the static chain and final
+ target are 32 bit aligned within the trampoline. That allows us to
+ initialize those locations with simple SImode stores. The alternative
+ would be to use HImode stores. */
+
+static void
+fr30_asm_trampoline_template (FILE *f)
+{
+ fprintf (f, "\tnop\n");
+ fprintf (f, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]);
+ fprintf (f, "\tnop\n");
+ fprintf (f, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]);
+ fprintf (f, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]);
+}
+
+/* Implement TARGET_TRAMPOLINE_INIT. */
+
+static void
+fr30_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
+{
+ rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
+ rtx mem;
+
+ emit_block_move (m_tramp, assemble_trampoline_template (),
+ GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
+
+ mem = adjust_address (m_tramp, SImode, 4);
+ emit_move_insn (mem, chain_value);
+ mem = adjust_address (m_tramp, SImode, 12);
+ emit_move_insn (mem, fnaddr);
+}
+
+/*}}}*/
/* Local Variables: */
/* folded-file: t */
/* End: */
diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h
index f055a1a..20e1571 100644
--- a/gcc/config/fr30/fr30.h
+++ b/gcc/config/fr30/fr30.h
@@ -730,31 +730,6 @@ enum reg_class
/*}}}*/
/*{{{ Trampolines for Nested Functions. */
-/* On the FR30, the trampoline is:
-
- nop
- ldi:32 STATIC, r12
- nop
- ldi:32 FUNCTION, r0
- jmp @r0
-
- The no-ops are to guarantee that the static chain and final
- target are 32 bit aligned within the trampoline. That allows us to
- initialize those locations with simple SImode stores. The alternative
- would be to use HImode stores. */
-
-/* A C statement to output, on the stream FILE, assembler code for a block of
- data that contains the constant parts of a trampoline. This code should not
- include a label--the label is taken care of automatically. */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\tnop\n"); \
- fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]); \
- fprintf (FILE, "\tnop\n"); \
- fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \
- fprintf (FILE, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \
-}
-
/* A C expression for the size in bytes of the trampoline, as an integer. */
#define TRAMPOLINE_SIZE 18
@@ -763,17 +738,6 @@ enum reg_class
the trampoline is also aligned on a 32bit boundary. */
#define TRAMPOLINE_ALIGNMENT 32
-/* 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, FNADDR, STATIC_CHAIN) \
-do \
-{ \
- emit_move_insn (gen_rtx_MEM (SImode, plus_constant (ADDR, 4)), STATIC_CHAIN);\
- emit_move_insn (gen_rtx_MEM (SImode, plus_constant (ADDR, 12)), FNADDR); \
-} while (0);
-
/*}}}*/
/*{{{ Addressing Modes. */