v850.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
authorRichard Henderson <rth@redhat.com>
Tue, 22 Sep 2009 15:16:26 +0000 (08:16 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 22 Sep 2009 15:16:26 +0000 (08:16 -0700)
        * config/v850/v850.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
        (TARGET_TRAMPOLINE_INIT): New.
        (v850_can_eliminate): Make static.
        (v850_asm_trampoline_template, v850_trampoline_init): New.
        * config/v850/v850.h (TRAMPOLINE_TEMPLATE): Move code to
        v850_asm_trampoline_template.
        (INITIALIZE_TRAMPOLINE): Move code to v850_trampoline_init
        and adjust for target hook parameters.

From-SVN: r152015

gcc/ChangeLog
gcc/config/v850/v850.c
gcc/config/v850/v850.h

index f9ef657..ce3b1c0 100644 (file)
        (TARGET_TRAMPOLINE_INIT): New.
        * config/stormy16/stormy16.h (INITIALIZE_TRAMPOLINE): Remove.
 
+       * config/v850/v850.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
+       (TARGET_TRAMPOLINE_INIT): New.
+       (v850_can_eliminate): Make static.
+       (v850_asm_trampoline_template, v850_trampoline_init): New.
+       * config/v850/v850.h (TRAMPOLINE_TEMPLATE): Move code to
+       v850_asm_trampoline_template.
+       (INITIALIZE_TRAMPOLINE): Move code to v850_trampoline_init
+       and 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
index 19268e2..8e1f27b 100644 (file)
@@ -73,6 +73,8 @@ static bool v850_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 static int v850_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
                                   tree, bool);
 static bool v850_can_eliminate       (const int, const int);
+static void v850_asm_trampoline_template (FILE *);
+static void v850_trampoline_init (rtx, tree, rtx);
 
 /* Information about the various small memory areas.  */
 struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
@@ -177,6 +179,11 @@ static const struct attribute_spec v850_attribute_table[] =
 #undef TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE v850_can_eliminate
 
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE v850_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT v850_trampoline_init
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Set the maximum size of small memory area TYPE to the value given
@@ -2963,10 +2970,41 @@ v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
 
 /* Worker function for TARGET_CAN_ELIMINATE.  */
 
-bool
+static bool
 v850_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
 {
   return (to == STACK_POINTER_REGNUM ? ! frame_pointer_needed : true);
 }
 
+\f
+/* Worker function for TARGET_ASM_TRAMPOLINE_TEMPLATE.  */
+
+static void
+v850_asm_trampoline_template (FILE *f)
+{
+  fprintf (f, "\tjarl .+4,r12\n");
+  fprintf (f, "\tld.w 12[r12],r20\n");
+  fprintf (f, "\tld.w 16[r12],r12\n");
+  fprintf (f, "\tjmp [r12]\n");
+  fprintf (f, "\tnop\n");
+  fprintf (f, "\t.long 0\n");
+  fprintf (f, "\t.long 0\n");
+}
+
+/* Worker function for TARGET_TRAMPOLINE_INIT.  */
+
+static void
+v850_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
+{
+  rtx mem, fnaddr = XEXP (DECL_RTL (fndecl), 0);
+
+  emit_block_move (m_tramp, assemble_trampoline_template (),
+                  GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
+
+  mem = adjust_address (m_tramp, SImode, 16);
+  emit_move_insn (mem, chain_value);
+  mem = adjust_address (m_tramp, SImode, 20);
+  emit_move_insn (mem, fnaddr);
+}
+\f
 #include "gt-v850.h"
index 026a229..1a4ca74 100644 (file)
@@ -658,33 +658,10 @@ struct cum_arg { int nbytes; int anonymous_args; };
 
 #define FUNCTION_PROFILER(FILE, LABELNO) ;
 
-#define TRAMPOLINE_TEMPLATE(FILE)                      \
-  do {                                                 \
-    fprintf (FILE, "\tjarl .+4,r12\n");                        \
-    fprintf (FILE, "\tld.w 12[r12],r20\n");            \
-    fprintf (FILE, "\tld.w 16[r12],r12\n");            \
-    fprintf (FILE, "\tjmp [r12]\n");                   \
-    fprintf (FILE, "\tnop\n");                         \
-    fprintf (FILE, "\t.long 0\n");                     \
-    fprintf (FILE, "\t.long 0\n");                     \
-  } while (0)
-
 /* Length in units of the trampoline for entering a nested function.  */
 
 #define TRAMPOLINE_SIZE 24
 
-/* Emit RTL insns to initialize the variable parts of 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)                      \
-{                                                                      \
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)),   \
-                (CXT));                                                \
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)),   \
-                (FNADDR));                                             \
-}
-
 /* Addressing modes, and classification of registers for them.  */
 
 \f