]> gcc.gnu.org Git - gcc.git/commitdiff
m68hc11.h (STATIC_CHAIN_REGNUM): Use soft z register instead of _.d1.
authorStephane Carrez <Stephane.Carrez@worldnet.fr>
Thu, 3 May 2001 20:52:43 +0000 (22:52 +0200)
committerStephane Carrez <ciceron@gcc.gnu.org>
Thu, 3 May 2001 20:52:43 +0000 (22:52 +0200)
* 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

gcc/ChangeLog
gcc/config/m68hc11/m68hc11-protos.h
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h

index c17d2106a260a0ba25ff34e2c99ba6a208aed0c3..81dc3c49846876121183d18a5f8850e6a83482c1 100644 (file)
@@ -1,3 +1,14 @@
+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
index 8aaa76ce9bf8c156ab133351d40ba1587bbda30a..e8ccaefb1226b0a9cbe155e60a2f7b9057945114 100644 (file)
@@ -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,
index 99baa51a102762ff5f0101c9b2ba3b7818083929..1ae397932fbf5f716296091a3d337ff1316724d5 100644 (file)
@@ -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);
+    }
+}
 \f
 /* Declaration of types.  */
 
index 475bf9ccd20530a6bd6eb1740bbb5ab32dc82e35..f8589c59cdae6b93cf473d50ac101c80336ec57e 100644 (file)
@@ -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
 
 \f
 /* 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 */
-
 \f
 /* 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))
+
 \f
 
 /* If defined, a C expression whose value is nonzero if IDENTIFIER
This page took 0.085121 seconds and 5 git commands to generate.