Commit 7bdf2c65 by Stephane Carrez Committed by Stephane Carrez

m68hc11.h (STATIC_CHAIN_REGNUM): Use soft z register instead of _.d1.

	* 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.

From-SVN: r41808
parent f8e4b51d
2001-05-03 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* 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 <obrien@FreeBSD.org> 2001-05-03 David O'Brien <obrien@FreeBSD.org>
* config/t-freebsd: Don't install "assert.h" in gcc. Compile crtbeginS.o * config/t-freebsd: Don't install "assert.h" in gcc. Compile crtbeginS.o
......
...@@ -39,6 +39,8 @@ extern int m68hc11_block_profiler PARAMS((FILE*,int)); ...@@ -39,6 +39,8 @@ extern int m68hc11_block_profiler PARAMS((FILE*,int));
extern void m68hc11_asm_file_start PARAMS((FILE*, char*)); extern void m68hc11_asm_file_start PARAMS((FILE*, char*));
#ifdef TREE_CODE #ifdef TREE_CODE
extern void m68hc11_initialize_trampoline PARAMS((rtx, rtx, rtx));
extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*,
enum machine_mode, enum machine_mode,
tree, tree,
......
...@@ -1056,6 +1056,54 @@ m68hc11_function_block_profiler (out, block_or_label) ...@@ -1056,6 +1056,54 @@ m68hc11_function_block_profiler (out, block_or_label)
{ {
return 0; 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. */ /* Declaration of types. */
......
...@@ -714,6 +714,9 @@ enum reg_class ...@@ -714,6 +714,9 @@ enum reg_class
#define Y_REGNO_P(REGNO) ((REGNO) == HARD_Y_REGNUM) #define Y_REGNO_P(REGNO) ((REGNO) == HARD_Y_REGNUM)
#define Y_REG_P(X) (REG_P (X) && Y_REGNO_P (REGNO (X))) #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_REGNO_P(REGNO) ((REGNO) == HARD_SP_REGNUM)
#define SP_REG_P(X) (REG_P (X) && SP_REGNO_P (REGNO (X))) #define SP_REG_P(X) (REG_P (X) && SP_REGNO_P (REGNO (X)))
...@@ -932,7 +935,7 @@ extern int m68hc11_sp_correction; ...@@ -932,7 +935,7 @@ extern int m68hc11_sp_correction;
#define ARG_POINTER_REGNUM SOFT_AP_REGNUM #define ARG_POINTER_REGNUM SOFT_AP_REGNUM
/* Register in which static-chain is passed to a function. */ /* 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. /* Definitions for register eliminations.
...@@ -975,8 +978,6 @@ extern int m68hc11_sp_correction; ...@@ -975,8 +978,6 @@ extern int m68hc11_sp_correction;
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
{ OFFSET = m68hc11_initial_elimination_offset (FROM, TO); } { OFFSET = m68hc11_initial_elimination_offset (FROM, TO); }
/* LONGJMP_RESTORE_FROM_STACK */
/* Passing Function Arguments on the Stack. */ /* Passing Function Arguments on the Stack. */
...@@ -1183,21 +1184,17 @@ typedef struct m68hc11_args ...@@ -1183,21 +1184,17 @@ typedef struct m68hc11_args
asm ("puly"); \ 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. */ /* 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. /* A C statement to initialize the variable parts of a trampoline.
ADDR is an RTX for the address of the trampoline; FNADDR is an 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 address of the nested function; STATIC_CHAIN is an
RTX for the static chain value that should be passed to the RTX for the static chain value that should be passed to the
function when it is called. */ 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 /* If defined, a C expression whose value is nonzero if IDENTIFIER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment