aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-12-29 15:23:23 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2005-12-29 15:23:23 +0000
commit42b67c06ed335cf1c6f0cf9a3751ea35099393f4 (patch)
tree8fda8b56306c02f457f73f7a57e9782141294a95
parent1a50d5e9d2eee7a84abcdac1c856b663b4e96b70 (diff)
downloadgcc-42b67c06ed335cf1c6f0cf9a3751ea35099393f4.zip
gcc-42b67c06ed335cf1c6f0cf9a3751ea35099393f4.tar.gz
gcc-42b67c06ed335cf1c6f0cf9a3751ea35099393f4.tar.bz2
m68k.h (RETURN_ADDR_RTX): Define.
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/m68k/m68k.c13
-rw-r--r--gcc/config/m68k/m68k.h6
3 files changed, 19 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 40f2887..32606d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index fa3f0e0..0eb4736 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -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:
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 3f140d4..245747f 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -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. */