fr30.h (TRAMPOLINE_TEMPLATE): Use nops to ensure the static chain and destination...
authorJeffrey A Law <law@cygnus.com>
Fri, 14 Jan 2000 09:28:10 +0000 (09:28 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 14 Jan 2000 09:28:10 +0000 (02:28 -0700)
        * fr30.h (TRAMPOLINE_TEMPLATE): Use nops to ensure the static chain
        and destination functions are 32bit aligned within the trampoline.
        (TRAMPOLINE_SIZE, INITIALIZE_TRAMPOLINE): Corresponding changes.
        (TRAMPOLINE_ALIGNMENT): Define.

From-SVN: r31409

gcc/ChangeLog
gcc/config/fr30/fr30.h

index 08ce9e2e328a9d1f134d3af6d6c8381d0706c1ff..c52c015d94048202c4128e38465a568710b19268 100644 (file)
@@ -1,5 +1,10 @@
 Fri Jan 14 00:28:06 2000  Jeffrey A Law  (law@cygnus.com)
 
+       * fr30.h (TRAMPOLINE_TEMPLATE): Use nops to ensure the static chain
+       and destination functions are 32bit aligned within the trampoline.
+       (TRAMPOLINE_SIZE, INITIALIZE_TRAMPOLINE): Corresponding changes.
+       (TRAMPOLINE_ALIGNMENT): Define.
+
        * cse.c (cse_insn): When changing (set (pc) (reg)) to
        (set (pc) (label_ref)), verify the change creates a valid insn.
 
index f28ab374da20477280c5b53262e48b72ec76e573..b7ea8b2239ec9863ada0453ae64d3f92f13ed6c7 100644 (file)
@@ -1139,22 +1139,36 @@ typedef int CUMULATIVE_ARGS;
 
 /* On the FR30, the trampoline is:
 
+   nop
    ldi:32 STATIC, r12
+   nop
    ldi:32 FUNCTION, r0
-   jmp    @r0 */
+   jmp    @r0
+
+   The no-ops are to guarantee that the the static chain and final
+   target are 32 bit ailgned within the trampoline.  That allows us to
+   initialize those locations with simple SImode stores.   The alternative
+   would be to use HImode stores.  */
    
 /* A C statement to output, on the stream FILE, assembler code for a block of
    data that contains the constant parts of a trampoline.  This code should not
    include a label--the label is taken care of automatically.  */
 #define TRAMPOLINE_TEMPLATE(FILE)                                              \
 {                                                                              \
+  fprintf (FILE, "\tnop\n");                                                   \
   fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]);       \
+  fprintf (FILE, "\tnop\n");                                                   \
   fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \
   fprintf (FILE, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]);       \
 }
 
 /* A C expression for the size in bytes of the trampoline, as an integer.  */
-#define TRAMPOLINE_SIZE 14
+#define TRAMPOLINE_SIZE 18
+
+/* We want the trampoline to be aligned on a 32bit boundary so that we can
+   make sure the location of the static chain & target function within
+   the trampoline is also aligned on a 32bit boundary.  */
+#define TRAMPOLINE_ALIGNMENT 32
 
 /* 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
@@ -1163,8 +1177,8 @@ typedef int CUMULATIVE_ARGS;
 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN)                      \
 do                                                                             \
 {                                                                              \
-  emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 2)), STATIC_CHAIN);\
-  emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 8)), FNADDR);     \
+  emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 4)), STATIC_CHAIN);\
+  emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 12)), FNADDR);    \
 } while (0);
 
 /*}}}*/ \f