* config/mn10300/mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Sep 2009 15:14:32 +0000 (15:14 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Sep 2009 15:14:32 +0000 (15:14 +0000)
        mn10300_asm_trampoline_template, TARGET_TRAMPOLINE_INIT,
        mn10300_trampoline_init): New.
        * config/mn10300/mn10300.h (TRAMPOLINE_TEMPLATE): Move code to
        mn10300_asm_trampoline_template.
        (INITIALIZE_TRAMPOLINE): Move code to mn10300_trampoline_init.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152003 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.h

index efcf989..8a1a13b 100644 (file)
        (TRAMPOLINE_ALIGNMENT): New.
        * gcc/config/mmix/mmix-protos.h: Update.
 
+       * config/mn10300/mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
+       mn10300_asm_trampoline_template, TARGET_TRAMPOLINE_INIT,
+       mn10300_trampoline_init): New.
+       * config/mn10300/mn10300.h (TRAMPOLINE_TEMPLATE): Move code to
+       mn10300_asm_trampoline_template.
+       (INITIALIZE_TRAMPOLINE): Move code to mn10300_trampoline_init.
+
 2009-09-22  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
index 608f8a0..1a0eb37 100644 (file)
@@ -83,6 +83,9 @@ static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
                                      tree, bool);
 static unsigned int mn10300_case_values_threshold (void);
+static void mn10300_encode_section_info (tree, rtx, int);
+static void mn10300_asm_trampoline_template (FILE *);
+static void mn10300_trampoline_init (rtx, tree, rtx);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -131,7 +134,11 @@ static unsigned int mn10300_case_values_threshold (void);
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P    mn10300_legitimate_address_p
 
-static void mn10300_encode_section_info (tree, rtx, int);
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE mn10300_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT mn10300_trampoline_init
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Implement TARGET_HANDLE_OPTION.  */
@@ -2165,3 +2172,36 @@ unsigned int mn10300_case_values_threshold (void)
 {
   return 6;
 }
+
+/* Worker function for TARGET_ASM_TRAMPOLINE_TEMPLATE.  */
+
+static void
+mn10300_asm_trampoline_template (FILE *f)
+{
+  fprintf (f, "\tadd -4,sp\n");
+  fprintf (f, "\t.long 0x0004fffa\n");
+  fprintf (f, "\tmov (0,sp),a0\n");
+  fprintf (f, "\tadd 4,sp\n");
+  fprintf (f, "\tmov (13,a0),a1\n");   
+  fprintf (f, "\tmov (17,a0),a0\n");
+  fprintf (f, "\tjmp (a0)\n");
+  fprintf (f, "\t.long 0\n");
+  fprintf (f, "\t.long 0\n");
+}
+
+/* Worker function for TARGET_TRAMPOLINE_INIT.  */
+
+static void
+mn10300_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_SIZE), BLOCK_OP_NORMAL);
+
+  mem = adjust_address (m_tramp, SImode, 0x14);
+  emit_move_insn (mem, chain_value);
+  mem = adjust_address (m_tramp, SImode, 0x18);
+  emit_move_insn (mem, fnaddr);
+}
index 7d15e05..fc2ece3 100644 (file)
@@ -598,36 +598,12 @@ struct cum_arg {int nbytes; };
 
 #define FUNCTION_PROFILER(FILE, LABELNO) ;
 
-#define TRAMPOLINE_TEMPLATE(FILE)                      \
-  do {                                                 \
-    fprintf (FILE, "\tadd -4,sp\n");                   \
-    fprintf (FILE, "\t.long 0x0004fffa\n");            \
-    fprintf (FILE, "\tmov (0,sp),a0\n");               \
-    fprintf (FILE, "\tadd 4,sp\n");                    \
-    fprintf (FILE, "\tmov (13,a0),a1\n");              \
-    fprintf (FILE, "\tmov (17,a0),a0\n");              \
-    fprintf (FILE, "\tjmp (a0)\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 0x1b
 
 #define TRAMPOLINE_ALIGNMENT 32
 
-/* 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), 0x14)), \
-                (CXT));                                                \
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 0x18)), \
-                (FNADDR));                                             \
-}
 /* A C expression whose value is RTL representing the value of the return
    address for the frame COUNT steps up from the current frame.