From 4ef4358c13cdcc9e4ac0b1f5aa28ab2c0f316906 Mon Sep 17 00:00:00 2001 From: ciceron Date: Thu, 3 May 2001 20:52:43 +0000 Subject: [PATCH] * config/m68hc11/m68hc11.h (STATIC_CHAIN_REGNUM): Use soft z register instead of _.d1. (INITIALIZE_TRAMPOLINE): Call it. (TRAMPOLINE_SIZE): Define according to 68HC11/68HC12. (TRAMPOLINE_TEMPLATE): Remove. * config/m68hc11/m68hc11.c (m68hc11_initialize_trampoline): New. * config/m68hc11/m68hc11-protos.h (m68hc11_initialize_trampoline): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41808 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++ gcc/config/m68hc11/m68hc11-protos.h | 2 ++ gcc/config/m68hc11/m68hc11.c | 48 +++++++++++++++++++++++++++++++++++++ gcc/config/m68hc11/m68hc11.h | 19 +++++++-------- 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c17d210..81dc3c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2001-05-03 Stephane Carrez + + * config/m68hc11/m68hc11.h (STATIC_CHAIN_REGNUM): Use soft z register + instead of _.d1. + (INITIALIZE_TRAMPOLINE): Call it. + (TRAMPOLINE_SIZE): Define according to 68HC11/68HC12. + (TRAMPOLINE_TEMPLATE): Remove. + * config/m68hc11/m68hc11.c (m68hc11_initialize_trampoline): New. + * config/m68hc11/m68hc11-protos.h (m68hc11_initialize_trampoline): + Declare. + 2001-05-03 David O'Brien * config/t-freebsd: Don't install "assert.h" in gcc. Compile crtbeginS.o diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 8aaa76c..e8ccaef 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -39,6 +39,8 @@ extern int m68hc11_block_profiler PARAMS((FILE*,int)); extern void m68hc11_asm_file_start PARAMS((FILE*, char*)); #ifdef TREE_CODE +extern void m68hc11_initialize_trampoline PARAMS((rtx, rtx, rtx)); + extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, enum machine_mode, tree, diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 99baa51..1ae3979 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1056,6 +1056,54 @@ m68hc11_function_block_profiler (out, block_or_label) { return 0; } + +/* Emit the code to build the trampoline used to call a nested function. + + 68HC11 68HC12 + + ldy #&CXT movw #&CXT,*_.d1 + sty *_.d1 jmp FNADDR + jmp FNADDR + +*/ +void +m68hc11_initialize_trampoline (tramp, fnaddr, cxt) + rtx tramp; + rtx fnaddr; + rtx cxt; +{ + char *static_chain_reg = reg_names[STATIC_CHAIN_REGNUM]; + + /* Skip the '*'. */ + if (*static_chain_reg == '*') + static_chain_reg++; + if (TARGET_M6811) + { + emit_move_insn (gen_rtx_MEM (HImode, tramp), GEN_INT (0x18ce)); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 4)), + GEN_INT (0x18df)); + emit_move_insn (gen_rtx_MEM (QImode, plus_constant (tramp, 6)), + gen_rtx_CONST (QImode, + gen_rtx_SYMBOL_REF (Pmode, + static_chain_reg))); + emit_move_insn (gen_rtx_MEM (QImode, plus_constant (tramp, 7)), + GEN_INT (0x7e)); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 8)), fnaddr); + } + else + { + emit_move_insn (gen_rtx_MEM (HImode, tramp), GEN_INT (0x1803)); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 4)), + gen_rtx_CONST (HImode, + gen_rtx_SYMBOL_REF (Pmode, + static_chain_reg))); + emit_move_insn (gen_rtx_MEM (QImode, plus_constant (tramp, 6)), + GEN_INT (0x06)); + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 7)), fnaddr); + } +} /* Declaration of types. */ diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 475bf9c..f8589c5 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -714,6 +714,9 @@ enum reg_class #define Y_REGNO_P(REGNO) ((REGNO) == HARD_Y_REGNUM) #define Y_REG_P(X) (REG_P (X) && Y_REGNO_P (REGNO (X))) +#define Z_REGNO_P(REGNO) ((REGNO) == HARD_Z_REGNUM) +#define Z_REG_P(X) (REG_P (X) && Z_REGNO_P (REGNO (X))) + #define SP_REGNO_P(REGNO) ((REGNO) == HARD_SP_REGNUM) #define SP_REG_P(X) (REG_P (X) && SP_REGNO_P (REGNO (X))) @@ -932,7 +935,7 @@ extern int m68hc11_sp_correction; #define ARG_POINTER_REGNUM SOFT_AP_REGNUM /* Register in which static-chain is passed to a function. */ -#define STATIC_CHAIN_REGNUM SOFT_REG_FIRST +#define STATIC_CHAIN_REGNUM SOFT_Z_REGNUM /* Definitions for register eliminations. @@ -975,8 +978,6 @@ extern int m68hc11_sp_correction; #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ { OFFSET = m68hc11_initial_elimination_offset (FROM, TO); } -/* LONGJMP_RESTORE_FROM_STACK */ - /* Passing Function Arguments on the Stack. */ @@ -1183,21 +1184,17 @@ typedef struct m68hc11_args asm ("puly"); \ } -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. */ -#define TRAMPOLINE_TEMPLATE(FILE) { \ - fprintf (FILE, "\t.bogus\t\t; TRAMPOLINE_TEMPLATE unimplemented\n"); } - /* Length in units of the trampoline for entering a nested function. */ -#define TRAMPOLINE_SIZE 0 +#define TRAMPOLINE_SIZE (TARGET_M6811 ? 11 : 9) /* A C statement to initialize the variable parts of a trampoline. ADDR is an RTX for the address of the trampoline; FNADDR is an RTX for the address of the nested function; STATIC_CHAIN is an RTX for the static chain value that should be passed to the function when it is called. */ -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) { \ - } +#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ + m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT)) + /* If defined, a C expression whose value is nonzero if IDENTIFIER -- 2.7.4