aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-22 08:13:11 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-22 08:13:11 -0700
commitf4a33d37279965f2ac958547862e9c46841bf223 (patch)
tree9c154cfdf4312c9e311f8012260feced42d742c3 /gcc
parent2a1211e51ba34fb4549c9f718c025474f0ff5ed6 (diff)
downloadgcc-f4a33d37279965f2ac958547862e9c46841bf223.zip
gcc-f4a33d37279965f2ac958547862e9c46841bf223.tar.gz
gcc-f4a33d37279965f2ac958547862e9c46841bf223.tar.bz2
iq2000.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
* config/iq2000/iq2000.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New. (TARGET_TRAMPOLINE_INIT): New. (iq2000_asm_trampoline_template, iq2000_trampoline_init): New. * config/iq2000/iq2000.h (TRAMPOLINE_TEMPLATE): Move code to iq2000_asm_trampoline_template. (INITIALIZE_TRAMPOLINE): Move code to iq2000_trampoline_init. (TRAMPOLINE_CODE_SIZE): New. (TRAMPOLINE_SIZE): Use it. (TRAMPOLINE_ALIGNMENT): Follow Pmode. From-SVN: r151995
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/iq2000/iq2000.c50
-rw-r--r--gcc/config/iq2000/iq2000.h40
3 files changed, 63 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95bbe79..6add783 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -114,6 +114,16 @@
make static; adjust for hook parameters.
* config/ia64/ia64.h (INITIALIZE_TRAMPOLINE): Remove.
+ * config/iq2000/iq2000.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
+ (TARGET_TRAMPOLINE_INIT): New.
+ (iq2000_asm_trampoline_template, iq2000_trampoline_init): New.
+ * config/iq2000/iq2000.h (TRAMPOLINE_TEMPLATE): Move code to
+ iq2000_asm_trampoline_template.
+ (INITIALIZE_TRAMPOLINE): Move code to iq2000_trampoline_init.
+ (TRAMPOLINE_CODE_SIZE): New.
+ (TRAMPOLINE_SIZE): Use it.
+ (TRAMPOLINE_ALIGNMENT): Follow Pmode.
+
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/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 85a8e5a..2e2f29a 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -166,6 +166,8 @@ static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
static void iq2000_va_start (tree, rtx);
static bool iq2000_legitimate_address_p (enum machine_mode, rtx, bool);
static bool iq2000_can_eliminate (const int, const int);
+static void iq2000_asm_trampoline_template (FILE *);
+static void iq2000_trampoline_init (rtx, tree, rtx);
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS iq2000_init_builtins
@@ -218,6 +220,11 @@ static bool iq2000_can_eliminate (const int, const int);
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE iq2000_can_eliminate
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE iq2000_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT iq2000_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Return nonzero if we split the address into high and low parts. */
@@ -3410,4 +3417,47 @@ iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total,
return true;
}
+/* Worker for TARGET_ASM_TRAMPOLINE_TEMPLATE. */
+
+static void
+iq2000_asm_trampoline_template (FILE *f)
+{
+ fprintf (f, "\t.word\t0x03e00821\t\t# move $1,$31\n");
+ fprintf (f, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n");
+ fprintf (f, "\t.word\t0x00000000\t\t# nop\n");
+ if (Pmode == DImode)
+ {
+ fprintf (f, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n");
+ fprintf (f, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n");
+ }
+ else
+ {
+ fprintf (f, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n");
+ fprintf (f, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n");
+ }
+ fprintf (f, "\t.word\t0x0060c821\t\t# move $25,$3 (abicalls)\n");
+ fprintf (f, "\t.word\t0x00600008\t\t# jr $3\n");
+ fprintf (f, "\t.word\t0x0020f821\t\t# move $31,$1\n");
+ fprintf (f, "\t.word\t0x00000000\t\t# <function address>\n");
+ fprintf (f, "\t.word\t0x00000000\t\t# <static chain value>\n");
+}
+
+/* Worker for TARGET_TRAMPOLINE_INIT. */
+
+static void
+iq2000_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_CODE_SIZE), BLOCK_OP_NORMAL);
+
+ mem = adjust_address (m_tramp, Pmode, TRAMPOLINE_CODE_SIZE);
+ emit_move_insn (mem, fnaddr);
+ mem = adjust_address (m_tramp, Pmode,
+ TRAMPOLINE_CODE_SIZE + GET_MODE_SIZE (Pmode));
+ emit_move_insn (mem, chain_value);
+}
+
#include "gt-iq2000.h"
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index 43bacfd..4dadbdb 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -469,43 +469,9 @@ typedef struct iq2000_args
/* Trampolines for Nested Functions. */
-/* 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(STREAM) \
-{ \
- fprintf (STREAM, "\t.word\t0x03e00821\t\t# move $1,$31\n"); \
- fprintf (STREAM, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n"); \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n"); \
- if (Pmode == DImode) \
- { \
- fprintf (STREAM, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n"); \
- } \
- else \
- { \
- fprintf (STREAM, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n"); \
- } \
- fprintf (STREAM, "\t.word\t0x0060c821\t\t# move $25,$3 (abicalls)\n"); \
- fprintf (STREAM, "\t.word\t0x00600008\t\t# jr $3\n"); \
- fprintf (STREAM, "\t.word\t0x0020f821\t\t# move $31,$1\n"); \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# <function address>\n"); \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# <static chain value>\n"); \
-}
-
-#define TRAMPOLINE_SIZE (40)
-
-#define TRAMPOLINE_ALIGNMENT 32
-
-#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \
-{ \
- rtx addr = ADDR; \
- emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 32)), FUNC); \
- emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 36)), CHAIN);\
-}
+#define TRAMPOLINE_CODE_SIZE (8*4)
+#define TRAMPOLINE_SIZE (TRAMPOLINE_CODE_SIZE + 2*GET_MODE_SIZE (Pmode))
+#define TRAMPOLINE_ALIGNMENT GET_MODE_ALIGNMENT (Pmode)
/* Addressing Modes. */