]> gcc.gnu.org Git - gcc.git/commitdiff
mips.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, [...]): New.
authorRichard Henderson <rth@redhat.com>
Tue, 22 Sep 2009 15:14:15 +0000 (08:14 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 22 Sep 2009 15:14:15 +0000 (08:14 -0700)
        * config/mips/mips.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
        mips_asm_trampoline_template, TARGET_TRAMPOLINE_INIT,
        mips_trampoline_init): New.
        * config/mips/mips.h (TRAMPOLINE_TEMPLATE): Move code to
        mips_asm_trampoline_template.
        (INITIALIZE_TRAMPOLINE): Move code to mips_trampoline_init;
        update for hook parameters.

From-SVN: r152001

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.h

index 14de92a75d9e291f3fc9da0c72c97927c9822ce5..f0a2c75d1779b214081c70c2b21861894ea91b8d 100644 (file)
        update for hook parameters.
        * config/mep/mep-protos.h (mep_init_trampoline): Remove.
 
+       * config/mips/mips.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
+       mips_asm_trampoline_template, TARGET_TRAMPOLINE_INIT,
+       mips_trampoline_init): New.
+       * config/mips/mips.h (TRAMPOLINE_TEMPLATE): Move code to
+       mips_asm_trampoline_template.
+       (INITIALIZE_TRAMPOLINE): Move code to mips_trampoline_init;
+       update for hook parameters.
+
 2009-09-22  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
index ace48bafe7923a2b100c92b80138f47b51ac6fc3..4c83ea505a0ee78dce33732aa8408139e2f0e622 100644 (file)
@@ -15873,6 +15873,66 @@ mips_final_postscan_insn (FILE *file ATTRIBUTE_UNUSED, rtx insn,
   if (mips_need_noat_wrapper_p (insn, opvec, noperands))
     mips_pop_asm_switch (&mips_noat);
 }
+\f
+/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE.  */
+
+static void
+mips_asm_trampoline_template (FILE *f)
+{
+  if (ptr_mode == DImode)
+    fprintf (f, "\t.word\t0x03e0082d\t\t# dmove   $1,$31\n");
+  else
+    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 (ptr_mode == DImode)
+    {
+      fprintf (f, "\t.word\t0xdff90014\t\t# ld     $25,20($31)\n");
+      fprintf (f, "\t.word\t0xdfef001c\t\t# ld     $15,28($31)\n");
+    }
+  else
+    {
+      fprintf (f, "\t.word\t0x8ff90010\t\t# lw     $25,16($31)\n");
+      fprintf (f, "\t.word\t0x8fef0014\t\t# lw     $15,20($31)\n");
+    }
+  fprintf (f, "\t.word\t0x03200008\t\t# jr     $25\n");
+  if (ptr_mode == DImode)
+    {
+      fprintf (f, "\t.word\t0x0020f82d\t\t# dmove   $31,$1\n");
+      fprintf (f, "\t.word\t0x00000000\t\t# <padding>\n");
+      fprintf (f, "\t.dword\t0x00000000\t\t# <function address>\n");
+      fprintf (f, "\t.dword\t0x00000000\t\t# <static chain value>\n");
+    }
+  else
+    {
+      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");
+    }
+}
+
+/* Implement TARGET_TRAMPOLINE_INIT.  */
+
+static void
+mips_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
+{
+  rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
+  rtx mem, addr, end_addr;
+
+  emit_block_move (m_tramp, assemble_trampoline_template (),
+                  GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
+
+  mem = adjust_address (m_tramp, ptr_mode, ptr_mode == DImode ? 32 : 28);
+  mips_emit_move (mem, force_reg (ptr_mode, fnaddr));
+  mem = adjust_address (mem, ptr_mode, GET_MODE_SIZE (ptr_mode));
+  mips_emit_move (mem, force_reg (ptr_mode, chain_value));
+
+  addr = force_reg (ptr_mode, XEXP (m_tramp, 0));
+  end_addr = gen_reg_rtx (ptr_mode);
+  emit_insn (gen_add3_insn (end_addr, addr, GEN_INT (TRAMPOLINE_SIZE)));
+  emit_insn (gen_clear_cache (addr, end_addr));
+}
+
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -16054,6 +16114,11 @@ mips_final_postscan_insn (FILE *file ATTRIBUTE_UNUSED, rtx insn,
 #undef TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE mips_can_eliminate
 
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE mips_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT mips_trampoline_init
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-mips.h"
index defcd6ef7df702a40595d0108a58851b2c94f4cc..934e0fafa906c2e6b4082970ab2dede06039f8bf 100644 (file)
@@ -2433,45 +2433,6 @@ typedef struct mips_args {
 #define EXIT_IGNORE_STACK 1
 
 \f
-/* 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)                                    \
-{                                                                      \
-  if (ptr_mode == DImode)                                              \
-    fprintf (STREAM, "\t.word\t0x03e0082d\t\t# dmove   $1,$31\n");     \
-  else                                                                 \
-    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 (ptr_mode == DImode)                                              \
-    {                                                                  \
-      fprintf (STREAM, "\t.word\t0xdff90014\t\t# ld     $25,20($31)\n"); \
-      fprintf (STREAM, "\t.word\t0xdfef001c\t\t# ld     $15,28($31)\n"); \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      fprintf (STREAM, "\t.word\t0x8ff90010\t\t# lw     $25,16($31)\n"); \
-      fprintf (STREAM, "\t.word\t0x8fef0014\t\t# lw     $15,20($31)\n"); \
-    }                                                                  \
-  fprintf (STREAM, "\t.word\t0x03200008\t\t# jr     $25\n");           \
-  if (ptr_mode == DImode)                                              \
-    {                                                                  \
-      fprintf (STREAM, "\t.word\t0x0020f82d\t\t# dmove   $31,$1\n");   \
-      fprintf (STREAM, "\t.word\t0x00000000\t\t# <padding>\n");                \
-      fprintf (STREAM, "\t.dword\t0x00000000\t\t# <function address>\n"); \
-      fprintf (STREAM, "\t.dword\t0x00000000\t\t# <static chain value>\n"); \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      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"); \
-    }                                                                  \
-}
-
 /* A C expression for the size in bytes of the trampoline, as an
    integer.  */
 
@@ -2481,7 +2442,7 @@ typedef struct mips_args {
 
 #define TRAMPOLINE_ALIGNMENT GET_MODE_BITSIZE (ptr_mode)
 
-/* INITIALIZE_TRAMPOLINE calls this library function to flush
+/* mips_trampoline_init calls this library function to flush
    program and data caches.  */
 
 #ifndef CACHE_FLUSH_FUNC
@@ -2495,25 +2456,6 @@ typedef struct mips_args {
                     LCT_NORMAL, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode, \
                     GEN_INT (3), TYPE_MODE (integer_type_node))
 
-/* 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)                           \
-{                                                                          \
-  rtx func_addr, chain_addr, end_addr;                                      \
-                                                                           \
-  func_addr = plus_constant (ADDR, ptr_mode == DImode ? 32 : 28);          \
-  chain_addr = plus_constant (func_addr, GET_MODE_SIZE (ptr_mode));        \
-  mips_emit_move (gen_rtx_MEM (ptr_mode, func_addr), FUNC);                \
-  mips_emit_move (gen_rtx_MEM (ptr_mode, chain_addr), CHAIN);              \
-  end_addr = gen_reg_rtx (Pmode);                                          \
-  emit_insn (gen_add3_insn (end_addr, copy_rtx (ADDR),                     \
-                            GEN_INT (TRAMPOLINE_SIZE)));                   \
-  emit_insn (gen_clear_cache (copy_rtx (ADDR), end_addr));                 \
-}
 \f
 /* Addressing modes, and classification of registers for them.  */
 
This page took 0.121723 seconds and 5 git commands to generate.