m68k.h (RETURN_ADDR_RTX): Define.
authorPaul Brook <paul@codesourcery.com>
Thu, 29 Dec 2005 15:23:23 +0000 (15:23 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Thu, 29 Dec 2005 15:23:23 +0000 (15:23 +0000)
2005-12-29  Paul Brook  <paul@codesourcery.com>

* config/m68k/m68k.h (RETURN_ADDR_RTX): Define.
* config/m68k/m68k.c (m68k_initial_elimination_offset): Remove FIXME.
Include offset due to FIRST_PARM_OFFSET.

From-SVN: r109147

gcc/ChangeLog
gcc/config/m68k/m68k.c
gcc/config/m68k/m68k.h

index 40f2887..32606d7 100644 (file)
@@ -1,5 +1,11 @@
 2005-12-29  Paul Brook  <paul@codesourcery.com>
 
+       * config/m68k/m68k.h (RETURN_ADDR_RTX): Define.
+       * config/m68k/m68k.c (m68k_initial_elimination_offset): Remove FIXME.
+       Include offset due to FIRST_PARM_OFFSET.
+
+2005-12-29  Paul Brook  <paul@codesourcery.com>
+
        * config/m68k/lb1sf68.asm (__cmpdf2): Fix typo in immediate mask.
        Create wrapper and rename body...
        (__cmpdf2_internal): ... to this.  Return correct value for unordered
index fa3f0e0..0eb4736 100644 (file)
@@ -434,11 +434,13 @@ m68k_compute_frame_layout (void)
 HOST_WIDE_INT
 m68k_initial_elimination_offset (int from, int to)
 {
-  /* FIXME: The correct offset to compute here would appear to be
-       (frame_pointer_needed ? -UNITS_PER_WORD * 2 : -UNITS_PER_WORD);
-     but for some obscure reason, this must be 0 to get correct code.  */
+  int argptr_offset;
+  /* The arg pointer points 8 bytes before the start of the arguments,
+     as defined by FIRST_PARM_OFFSET.  This makes it coincident with the
+     frame pointer in most frames.  */
+  argptr_offset = frame_pointer_needed ? 0 : UNITS_PER_WORD;
   if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
-    return 0;
+    return argptr_offset;
 
   m68k_compute_frame_layout ();
 
@@ -446,8 +448,7 @@ m68k_initial_elimination_offset (int from, int to)
   switch (from)
     {
     case ARG_POINTER_REGNUM:
-      return (current_frame.offset + current_frame.size
-             + (frame_pointer_needed ? -UNITS_PER_WORD * 2 : -UNITS_PER_WORD));
+      return current_frame.offset + current_frame.size - argptr_offset;
     case FRAME_POINTER_REGNUM:
       return current_frame.offset + current_frame.size;
     default:
index 3f140d4..245747f 100644 (file)
@@ -890,6 +890,12 @@ do { if (cc_prev_status.flags & CC_IN_68881)                       \
 #define INCOMING_RETURN_ADDR_RTX \
   gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
 
+/* After the prologue, RA is at 4(AP) in the current frame.  */
+#define RETURN_ADDR_RTX(COUNT, FRAME)                                     \
+  ((COUNT) == 0                                                                   \
+   ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, UNITS_PER_WORD)) \
+   : gen_rtx_MEM (Pmode, plus_constant (FRAME, UNITS_PER_WORD)))
+
 /* We must not use the DBX register numbers for the DWARF 2 CFA column
    numbers because that maps to numbers beyond FIRST_PSEUDO_REGISTER.
    Instead use the identity mapping.  */