diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-22 15:13:11 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-22 15:13:11 +0000 |
commit | d76f0bfccce008e429bade00759abb6327ed02a4 (patch) | |
tree | 9c154cfdf4312c9e311f8012260feced42d742c3 /gcc/config/iq2000/iq2000.c | |
parent | 7193d01d3a6896c189ca509ac868af31afceb04c (diff) | |
download | gcc-d76f0bfccce008e429bade00759abb6327ed02a4.tar.gz |
* config/iq2000/iq2000.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
(TARGET_TRAMPOLINE_INIT): New.
(iq2000_asm_trampoline_template, iq2000_trampoline_init): New.
* config/iq2000/iq2000.h (TRAMPOLINE_TEMPLATE): Move code to
iq2000_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Move code to iq2000_trampoline_init.
(TRAMPOLINE_CODE_SIZE): New.
(TRAMPOLINE_SIZE): Use it.
(TRAMPOLINE_ALIGNMENT): Follow Pmode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151995 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/iq2000/iq2000.c')
-rw-r--r-- | gcc/config/iq2000/iq2000.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 85a8e5ac9f4..2e2f29aaeb7 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -166,6 +166,8 @@ static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, static void iq2000_va_start (tree, rtx); static bool iq2000_legitimate_address_p (enum machine_mode, rtx, bool); static bool iq2000_can_eliminate (const int, const int); +static void iq2000_asm_trampoline_template (FILE *); +static void iq2000_trampoline_init (rtx, tree, rtx); #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS iq2000_init_builtins @@ -218,6 +220,11 @@ static bool iq2000_can_eliminate (const int, const int); #undef TARGET_CAN_ELIMINATE #define TARGET_CAN_ELIMINATE iq2000_can_eliminate +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE +#define TARGET_ASM_TRAMPOLINE_TEMPLATE iq2000_asm_trampoline_template +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT iq2000_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; /* Return nonzero if we split the address into high and low parts. */ @@ -3410,4 +3417,47 @@ iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total, return true; } +/* Worker for TARGET_ASM_TRAMPOLINE_TEMPLATE. */ + +static void +iq2000_asm_trampoline_template (FILE *f) +{ + fprintf (f, "\t.word\t0x03e00821\t\t# move $1,$31\n"); + fprintf (f, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n"); + fprintf (f, "\t.word\t0x00000000\t\t# nop\n"); + if (Pmode == DImode) + { + fprintf (f, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n"); + fprintf (f, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n"); + } + else + { + fprintf (f, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n"); + fprintf (f, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n"); + } + fprintf (f, "\t.word\t0x0060c821\t\t# move $25,$3 (abicalls)\n"); + fprintf (f, "\t.word\t0x00600008\t\t# jr $3\n"); + fprintf (f, "\t.word\t0x0020f821\t\t# move $31,$1\n"); + fprintf (f, "\t.word\t0x00000000\t\t# <function address>\n"); + fprintf (f, "\t.word\t0x00000000\t\t# <static chain value>\n"); +} + +/* Worker for TARGET_TRAMPOLINE_INIT. */ + +static void +iq2000_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_CODE_SIZE), BLOCK_OP_NORMAL); + + mem = adjust_address (m_tramp, Pmode, TRAMPOLINE_CODE_SIZE); + emit_move_insn (mem, fnaddr); + mem = adjust_address (m_tramp, Pmode, + TRAMPOLINE_CODE_SIZE + GET_MODE_SIZE (Pmode)); + emit_move_insn (mem, chain_value); +} + #include "gt-iq2000.h" |