From 9e56a932f967a037cb38f8d939e5250736e39d68 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 31 Dec 2002 18:31:59 +0000 Subject: h8300.h (TRAMPOLINE_TEMPLATE): Remove. * config/h8300/h8300.h (TRAMPOLINE_TEMPLATE): Remove. (TRAMPOLINE_SIZE): Support the normal mode. (INITIALIZE_TRAMPOLINE): Emit the entire trampoline. From-SVN: r60705 --- gcc/ChangeLog | 6 +++++ gcc/config/h8300/h8300.h | 62 ++++++++++++++++++++++++++---------------------- 2 files changed, 39 insertions(+), 29 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 473aab2..333647d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-12-31 Kazu Hirata + + * config/h8300/h8300.h (TRAMPOLINE_TEMPLATE): Remove. + (TRAMPOLINE_SIZE): Support the normal mode. + (INITIALIZE_TRAMPOLINE): Emit the entire trampoline. + 2002-12-31 Mark Mitchell * c-common.h (pending_lang_change): Declare. diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 2f9ba30..384ddd2 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -719,54 +719,58 @@ struct cum_arg #define EXIT_IGNORE_STACK 0 -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. +/* We emit the entire trampoline with INITIALIZE_TRAMPOLINE. + Depending on the pointer size, we use a different trampoline. - H8/300 + Pmode == HImode vvvv context 1 0000 7903xxxx mov.w #0x1234,r3 2 0004 5A00xxxx jmp @0x1234 ^^^^ function - H8/300H + Pmode == SImode vvvvvvvv context 2 0000 7A03xxxxxxxx mov.l #0x12345678,er3 3 0006 5Axxxxxx jmp @0x123456 ^^^^^^ function */ -#define TRAMPOLINE_TEMPLATE(FILE) \ - do \ - { \ - if (TARGET_H8300) \ - { \ - fprintf (FILE, "\tmov.w #0x1234,r3\n"); \ - fprintf (FILE, "\tjmp @0x1234\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmov.l #0x12345678,er3\n"); \ - fprintf (FILE, "\tjmp @0x123456\n"); \ - } \ - } \ - while (0) - /* Length in units of the trampoline for entering a nested function. */ -#define TRAMPOLINE_SIZE (TARGET_H8300 ? 8 : 12) +#define TRAMPOLINE_SIZE ((TARGET_H8300 || TARGET_NORMAL_MODE) ? 8 : 12) -/* Emit RTL insns to initialize the variable parts of a trampoline. +/* 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) \ -{ \ - emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 2)), CXT); \ - emit_move_insn (gen_rtx_MEM (Pmode, plus_constant ((TRAMP), 6)), FNADDR); \ - if (TARGET_H8300H || TARGET_H8300S) \ - emit_move_insn (gen_rtx_MEM (QImode, plus_constant ((TRAMP), 6)), \ - GEN_INT (0x5A)); \ -} + 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. */ -- cgit v1.1