Commit e0c6c273 by Richard Henderson Committed by Richard Henderson

v850.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.

        * 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
parent fb8d0fac
...@@ -276,6 +276,15 @@ ...@@ -276,6 +276,15 @@
(TARGET_TRAMPOLINE_INIT): New. (TARGET_TRAMPOLINE_INIT): New.
* config/stormy16/stormy16.h (INITIALIZE_TRAMPOLINE): Remove. * 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> 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
......
...@@ -73,6 +73,8 @@ static bool v850_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, ...@@ -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, static int v850_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool); tree, bool);
static bool v850_can_eliminate (const int, const int); 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. */ /* Information about the various small memory areas. */
struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
...@@ -177,6 +179,11 @@ static const struct attribute_spec v850_attribute_table[] = ...@@ -177,6 +179,11 @@ static const struct attribute_spec v850_attribute_table[] =
#undef TARGET_CAN_ELIMINATE #undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE v850_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; struct gcc_target targetm = TARGET_INITIALIZER;
/* Set the maximum size of small memory area TYPE to the value given /* Set the maximum size of small memory area TYPE to the value given
...@@ -2963,10 +2970,41 @@ v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca, ...@@ -2963,10 +2970,41 @@ v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
/* Worker function for TARGET_CAN_ELIMINATE. */ /* Worker function for TARGET_CAN_ELIMINATE. */
bool static bool
v850_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) v850_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{ {
return (to == STACK_POINTER_REGNUM ? ! frame_pointer_needed : true); return (to == STACK_POINTER_REGNUM ? ! frame_pointer_needed : true);
} }
/* 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);
}
#include "gt-v850.h" #include "gt-v850.h"
...@@ -658,33 +658,10 @@ struct cum_arg { int nbytes; int anonymous_args; }; ...@@ -658,33 +658,10 @@ struct cum_arg { int nbytes; int anonymous_args; };
#define FUNCTION_PROFILER(FILE, LABELNO) ; #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. */ /* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_SIZE 24 #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. */ /* Addressing modes, and classification of registers for them. */
......
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