aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2002-12-31 18:31:59 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2002-12-31 18:31:59 +0000
commit9e56a932f967a037cb38f8d939e5250736e39d68 (patch)
tree2354d2b9607fe3d7b0f4abc109323522e2a2e183
parent3f4f56e27a8f1666c455b8913bd426e329336f00 (diff)
downloadgcc-9e56a932f967a037cb38f8d939e5250736e39d68.zip
gcc-9e56a932f967a037cb38f8d939e5250736e39d68.tar.gz
gcc-9e56a932f967a037cb38f8d939e5250736e39d68.tar.bz2
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/h8300/h8300.h62
2 files changed, 39 insertions, 29 deletions
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 <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.h (TRAMPOLINE_TEMPLATE): Remove.
+ (TRAMPOLINE_SIZE): Support the normal mode.
+ (INITIALIZE_TRAMPOLINE): Emit the entire trampoline.
+
2002-12-31 Mark Mitchell <mark@codesourcery.com>
* 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. */