]> gcc.gnu.org Git - gcc.git/commitdiff
h8300.c (h8300_trampoline_init): New.
authorRichard Henderson <rth@redhat.com>
Tue, 22 Sep 2009 15:12:56 +0000 (08:12 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 22 Sep 2009 15:12:56 +0000 (08:12 -0700)
* 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

gcc/ChangeLog
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h

index fa1edd73f37b9058276cfdbe7976537cbc7243e3..543f881c983643460cfd9e77ea5d31731aaaeb75 100644 (file)
        * 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
index 02b3ff6094a089876cf80acf1a6fa5f82c94dda8..404595405f37889117ceac5cd06ca355e0b67c8b 100644 (file)
@@ -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));
 }
 \f
+/* 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);
+    }
+}
+\f
 /* 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;
index 884e49a9d4a7a5ff7d14c3b13b94f6a98cfa1f58..e0f0ea62f4e7a921ff7ecd9ce54e98e94bb3cd24 100644 (file)
@@ -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)
 \f
 /* Addressing modes, and classification of registers for them.  */
 
This page took 0.11745 seconds and 5 git commands to generate.