+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>
* config/t-freebsd: Don't install "assert.h" in gcc. Compile crtbeginS.o
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,
{
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);
+ }
+}
\f
/* Declaration of types. */
#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)))
#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
\f
/* Definitions for register eliminations.
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
{ OFFSET = m68hc11_initial_elimination_offset (FROM, TO); }
-/* LONGJMP_RESTORE_FROM_STACK */
-
\f
/* Passing Function Arguments on the Stack. */
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))
+
\f
/* If defined, a C expression whose value is nonzero if IDENTIFIER