mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-03 09:10:36 +08:00
h8300.c (h8300_trampoline_init): New.
* config/h8300/h8300.c (h8300_trampoline_init): New. (TARGET_TRAMPOLINE_INIT): New. * config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code to h8300_trampoline_init and adjust for hook parameters. From-SVN: r151993
This commit is contained in:
parent
e9d5fdb247
commit
9f6ef043a8
@ -103,6 +103,11 @@
|
||||
* config/frv/frv.h (INITIALIZE_TRAMPOLINE): Remove.
|
||||
* config/frv/frv-protos.h (frv_initialize_trampoline): Remove.
|
||||
|
||||
* config/h8300/h8300.c (h8300_trampoline_init): New.
|
||||
(TARGET_TRAMPOLINE_INIT): New.
|
||||
* config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code
|
||||
to h8300_trampoline_init and adjust for hook parameters.
|
||||
|
||||
2009-09-22 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
|
||||
|
@ -5773,6 +5773,56 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|
||||
|| GET_MODE_SIZE (TYPE_MODE (type)) > (TARGET_H8300 ? 4 : 8));
|
||||
}
|
||||
|
||||
/* We emit the entire trampoline here. Depending on the pointer size,
|
||||
we use a different trampoline.
|
||||
|
||||
Pmode == HImode
|
||||
vvvv context
|
||||
1 0000 7903xxxx mov.w #0x1234,r3
|
||||
2 0004 5A00xxxx jmp @0x1234
|
||||
^^^^ function
|
||||
|
||||
Pmode == SImode
|
||||
vvvvvvvv context
|
||||
2 0000 7A03xxxxxxxx mov.l #0x12345678,er3
|
||||
3 0006 5Axxxxxx jmp @0x123456
|
||||
^^^^^^ function
|
||||
*/
|
||||
|
||||
static void
|
||||
h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
|
||||
{
|
||||
rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
|
||||
rtx mem;
|
||||
|
||||
if (Pmode == HImode)
|
||||
{
|
||||
mem = adjust_address (m_tramp, HImode, 0);
|
||||
emit_move_insn (mem, GEN_INT (0x7903));
|
||||
mem = adjust_address (m_tramp, Pmode, 2);
|
||||
emit_move_insn (mem, cxt);
|
||||
mem = adjust_address (m_tramp, HImode, 4);
|
||||
emit_move_insn (mem, GEN_INT (0x5a00));
|
||||
mem = adjust_address (m_tramp, Pmode, 6);
|
||||
emit_move_insn (mem, fnaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtx tem;
|
||||
|
||||
mem = adjust_address (m_tramp, HImode, 0);
|
||||
emit_move_insn (mem, GEN_INT (0x7a03));
|
||||
mem = adjust_address (m_tramp, Pmode, 2);
|
||||
emit_move_insn (mem, cxt);
|
||||
|
||||
tem = copy_to_reg (fnaddr);
|
||||
emit_insn (gen_andsi3 (tem, tem, GEN_INT (0x00ffffff)));
|
||||
emit_insn (gen_iorsi3 (tem, tem, GEN_INT (0x5a000000)));
|
||||
mem = adjust_address (m_tramp, SImode, 6);
|
||||
emit_move_insn (mem, tem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the GCC target structure. */
|
||||
#undef TARGET_ATTRIBUTE_TABLE
|
||||
#define TARGET_ATTRIBUTE_TABLE h8300_attribute_table
|
||||
@ -5818,4 +5868,7 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|
||||
#undef TARGET_CAN_ELIMINATE
|
||||
#define TARGET_CAN_ELIMINATE h8300_can_eliminate
|
||||
|
||||
#undef TARGET_TRAMPOLINE_INIT
|
||||
#define TARGET_TRAMPOLINE_INIT h8300_trampoline_init
|
||||
|
||||
struct gcc_target targetm = TARGET_INITIALIZER;
|
||||
|
@ -672,58 +672,9 @@ struct cum_arg
|
||||
|
||||
#define EXIT_IGNORE_STACK 0
|
||||
|
||||
/* We emit the entire trampoline with INITIALIZE_TRAMPOLINE.
|
||||
Depending on the pointer size, we use a different trampoline.
|
||||
|
||||
Pmode == HImode
|
||||
vvvv context
|
||||
1 0000 7903xxxx mov.w #0x1234,r3
|
||||
2 0004 5A00xxxx jmp @0x1234
|
||||
^^^^ function
|
||||
|
||||
Pmode == SImode
|
||||
vvvvvvvv context
|
||||
2 0000 7A03xxxxxxxx mov.l #0x12345678,er3
|
||||
3 0006 5Axxxxxx jmp @0x123456
|
||||
^^^^^^ function
|
||||
*/
|
||||
|
||||
/* Length in units of the trampoline for entering a nested function. */
|
||||
|
||||
#define TRAMPOLINE_SIZE ((Pmode == HImode) ? 8 : 12)
|
||||
|
||||
/* Emit RTL insns to build 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) \
|
||||
do \
|
||||
{ \
|
||||
if (Pmode == HImode) \
|
||||
{ \
|
||||
emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7903)); \
|
||||
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
|
||||
(CXT)); \
|
||||
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 4)), \
|
||||
GEN_INT (0x5a00)); \
|
||||
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
|
||||
(FNADDR)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
rtx tem = gen_reg_rtx (Pmode); \
|
||||
\
|
||||
emit_move_insn (gen_rtx_MEM (HImode, (TRAMP)), GEN_INT (0x7a03)); \
|
||||
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), \
|
||||
(CXT)); \
|
||||
emit_move_insn (tem, (FNADDR)); \
|
||||
emit_insn (gen_andsi3 (tem, tem, GEN_INT (0x00ffffff))); \
|
||||
emit_insn (gen_iorsi3 (tem, tem, GEN_INT (0x5a000000))); \
|
||||
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), \
|
||||
tem); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Addressing modes, and classification of registers for them. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user