aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-22 08:12:56 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-22 08:12:56 -0700
commit9f6ef043a88259c0973738e090e9c64fac961dcf (patch)
treeadc1533d600a58624cdb77c58683e09d4363d1f4
parente9d5fdb247ff82213dc32745d68c52314881057f (diff)
downloadgcc-9f6ef043a88259c0973738e090e9c64fac961dcf.zip
gcc-9f6ef043a88259c0973738e090e9c64fac961dcf.tar.gz
gcc-9f6ef043a88259c0973738e090e9c64fac961dcf.tar.bz2
h8300.c (h8300_trampoline_init): New.
* config/h8300/h8300.c (h8300_trampoline_init): New. (TARGET_TRAMPOLINE_INIT): New. * config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code to h8300_trampoline_init and adjust for hook parameters. From-SVN: r151993
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/h8300/h8300.c53
-rw-r--r--gcc/config/h8300/h8300.h49
3 files changed, 58 insertions, 49 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fa1edd7..543f881 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -103,6 +103,11 @@
* config/frv/frv.h (INITIALIZE_TRAMPOLINE): Remove.
* config/frv/frv-protos.h (frv_initialize_trampoline): Remove.
+ * config/h8300/h8300.c (h8300_trampoline_init): New.
+ (TARGET_TRAMPOLINE_INIT): New.
+ * config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code
+ to h8300_trampoline_init and adjust for 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/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 02b3ff6..4045954 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -5773,6 +5773,56 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|| GET_MODE_SIZE (TYPE_MODE (type)) > (TARGET_H8300 ? 4 : 8));
}
+/* We emit the entire trampoline here. Depending on the pointer size,
+ we use a different trampoline.
+
+ Pmode == HImode
+ vvvv context
+ 1 0000 7903xxxx mov.w #0x1234,r3
+ 2 0004 5A00xxxx jmp @0x1234
+ ^^^^ function
+
+ Pmode == SImode
+ vvvvvvvv context
+ 2 0000 7A03xxxxxxxx mov.l #0x12345678,er3
+ 3 0006 5Axxxxxx jmp @0x123456
+ ^^^^^^ function
+*/
+
+static void
+h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
+{
+ rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
+ rtx mem;
+
+ if (Pmode == HImode)
+ {
+ mem = adjust_address (m_tramp, HImode, 0);
+ emit_move_insn (mem, GEN_INT (0x7903));
+ mem = adjust_address (m_tramp, Pmode, 2);
+ emit_move_insn (mem, cxt);
+ mem = adjust_address (m_tramp, HImode, 4);
+ emit_move_insn (mem, GEN_INT (0x5a00));
+ mem = adjust_address (m_tramp, Pmode, 6);
+ emit_move_insn (mem, fnaddr);
+ }
+ else
+ {
+ rtx tem;
+
+ mem = adjust_address (m_tramp, HImode, 0);
+ emit_move_insn (mem, GEN_INT (0x7a03));
+ mem = adjust_address (m_tramp, Pmode, 2);
+ emit_move_insn (mem, cxt);
+
+ tem = copy_to_reg (fnaddr);
+ emit_insn (gen_andsi3 (tem, tem, GEN_INT (0x00ffffff)));
+ emit_insn (gen_iorsi3 (tem, tem, GEN_INT (0x5a000000)));
+ mem = adjust_address (m_tramp, SImode, 6);
+ emit_move_insn (mem, tem);
+ }
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE h8300_attribute_table
@@ -5818,4 +5868,7 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
#undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE h8300_can_eliminate
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT h8300_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 884e49a..e0f0ea6 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -672,58 +672,9 @@ struct cum_arg
#define EXIT_IGNORE_STACK 0
-/* We emit the entire trampoline with INITIALIZE_TRAMPOLINE.
- Depending on the pointer size, we use a different trampoline.
-
- Pmode == HImode
- vvvv context
- 1 0000 7903xxxx mov.w #0x1234,r3
- 2 0004 5A00xxxx jmp @0x1234
- ^^^^ function
-
- Pmode == SImode
- vvvvvvvv context
- 2 0000 7A03xxxxxxxx mov.l #0x12345678,er3
- 3 0006 5Axxxxxx jmp @0x123456
- ^^^^^^ function
-*/
-
/* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_SIZE ((Pmode == HImode) ? 8 : 12)
-
-/* Emit RTL insns to build a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
- do \
- { \
- if (Pmode == HImode) \
- { \
- emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7903)); \
- emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
- (CXT)); \
- emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 4)), \
- GEN_INT (0x5a00)); \
- emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
- (FNADDR)); \
- } \
- else \
- { \
- rtx tem = gen_reg_rtx (Pmode); \
- \
- emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7a03)); \
- emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
- (CXT)); \
- emit_move_insn (tem, (FNADDR)); \
- emit_insn (gen_andsi3 (tem, tem, GEN_INT (0x00ffffff))); \
- emit_insn (gen_iorsi3 (tem, tem, GEN_INT (0x5a000000))); \
- emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
- tem); \
- } \
- } \
- while (0)
/* Addressing modes, and classification of registers for them. */