Commit bdeb5f0c by Richard Henderson Committed by Richard Henderson

mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, [...]): New.

        * 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.

From-SVN: r152003
parent dbbdb385
...@@ -176,6 +176,13 @@ ...@@ -176,6 +176,13 @@
(TRAMPOLINE_ALIGNMENT): New. (TRAMPOLINE_ALIGNMENT): New.
* gcc/config/mmix/mmix-protos.h: Update. * 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> 2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
......
...@@ -83,6 +83,9 @@ static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, ...@@ -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, static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool); tree, bool);
static unsigned int mn10300_case_values_threshold (void); 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);
/* Initialize the GCC target structure. */ /* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP #undef TARGET_ASM_ALIGNED_HI_OP
...@@ -131,7 +134,11 @@ static unsigned int mn10300_case_values_threshold (void); ...@@ -131,7 +134,11 @@ static unsigned int mn10300_case_values_threshold (void);
#undef TARGET_LEGITIMATE_ADDRESS_P #undef TARGET_LEGITIMATE_ADDRESS_P
#define TARGET_LEGITIMATE_ADDRESS_P mn10300_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; struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */ /* Implement TARGET_HANDLE_OPTION. */
...@@ -2165,3 +2172,36 @@ unsigned int mn10300_case_values_threshold (void) ...@@ -2165,3 +2172,36 @@ unsigned int mn10300_case_values_threshold (void)
{ {
return 6; 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);
}
...@@ -598,36 +598,12 @@ struct cum_arg {int nbytes; }; ...@@ -598,36 +598,12 @@ struct cum_arg {int nbytes; };
#define FUNCTION_PROFILER(FILE, LABELNO) ; #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. */ /* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_SIZE 0x1b #define TRAMPOLINE_SIZE 0x1b
#define TRAMPOLINE_ALIGNMENT 32 #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 /* A C expression whose value is RTL representing the value of the return
address for the frame COUNT steps up from the current frame. address for the frame COUNT steps up from the current frame.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment