pdp11.c (pdp11_trampoline_init): New.

* config/pdp11/pdp11.c (pdp11_trampoline_init): New.
        (TARGET_TRAMPOLINE_INIT): New.
        * config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Remove.
        (INITIALIZE_TRAMPOLINE): Move code to pdp11_trampoline_init.

From-SVN: r152006
This commit is contained in:
Richard Henderson 2009-09-22 08:14:54 -07:00 committed by Richard Henderson
parent 859c146ca0
commit 8dd65c37e5
3 changed files with 37 additions and 33 deletions

View File

@ -204,6 +204,11 @@
adjust for hook parameters.
(TRAMPOLINE_ADJUST_ADDRESS): Move code to pa_trampoline_adjust_address.
* config/pdp11/pdp11.c (pdp11_trampoline_init): New.
(TARGET_TRAMPOLINE_INIT): New.
* config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Remove.
(INITIALIZE_TRAMPOLINE): Move code to pdp11_trampoline_init.
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes

View File

@ -152,6 +152,7 @@ static void pdp11_output_function_prologue (FILE *, HOST_WIDE_INT);
static void pdp11_output_function_epilogue (FILE *, HOST_WIDE_INT);
static bool pdp11_rtx_costs (rtx, int, int, int *, bool);
static bool pdp11_return_in_memory (const_tree, const_tree);
static void pdp11_trampoline_init (rtx, tree, rtx);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_BYTE_OP
@ -185,6 +186,9 @@ static bool pdp11_return_in_memory (const_tree, const_tree);
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT pdp11_trampoline_init
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@ -1740,3 +1744,31 @@ pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
return (TYPE_MODE (type) == DImode
|| (TYPE_MODE (type) == DFmode && ! TARGET_AC0));
}
/* Worker function for TARGET_TRAMPOLINE_INIT.
trampoline - how should i do it in separate i+d ?
have some allocate_trampoline magic???
the following should work for shared I/D:
MV #STATIC, $4 0x940Y 0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
JMP FUNCTION 0x0058 0x0000 <- FUNCTION
*/
static void
pdp11_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{
rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
rtx mem;
gcc_assert (!TARGET_SPLIT);
mem = adjust_address (m_tramp, HImode, 0);
emit_move_insn (mem, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));
mem = adjust_address (m_tramp, HImode, 2);
emit_move_insn (mem, chain_value);
mem = adjust_address (m_tramp, HImode, 4);
emit_move_insn (mem, GEN_INT (0x0058));
emit_move_insn (mem, fnaddr);
}

View File

@ -983,42 +983,9 @@ extern struct rtx_def *cc0_reg_rtx;
fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO]) \
)
/* trampoline - how should i do it in separate i+d ?
have some allocate_trampoline magic???
the following should work for shared I/D: */
/* lets see whether this works as trampoline:
MV #STATIC, $4 0x940Y 0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
JMP FUNCTION 0x0058 0x0000 <- FUNCTION
*/
#define TRAMPOLINE_TEMPLATE(FILE) \
{ \
gcc_assert (!TARGET_SPLIT); \
\
assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \
assemble_aligned_integer (2, const0_rtx); \
assemble_aligned_integer (2, GEN_INT(0x0058)); \
assemble_aligned_integer (2, const0_rtx); \
}
#define TRAMPOLINE_SIZE 8
#define TRAMPOLINE_ALIGNMENT 16
/* 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) \
{ \
gcc_assert (!TARGET_SPLIT); \
\
emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
}
/* Some machines may desire to change what optimizations are
performed for various optimization levels. This macro, if
defined, is executed once just after the optimization level is