This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix builtin_return_addr for HC11/HC12 port
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH]: Fix builtin_return_addr for HC11/HC12 port
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sun, 10 Jun 2001 12:18:13 +0200
Hi!
The builtin_return_address() was wrong for HC11/HC12 port. The stack slot
for the return address is relative to the argument pointer.
Verified on 3_0-branch with gcc.c-torture/execute/20010122-1.c.
I've commited this patch on 3_0 and mainline.
Stephane
2001-06-10 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.h (RETURN_ADDR_RTX): Define the return
address as relative to the argument pointer.
Index: config/m68hc11/m68hc11.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.4.4.5
diff -u -p -r1.4.4.5 m68hc11.h
--- m68hc11.h 2001/05/04 19:51:27 1.4.4.5
+++ m68hc11.h 2001/06/10 10:09:02
@@ -928,6 +928,12 @@ extern int m68hc11_sp_correction;
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
+/* After the prologue, RA is at -2(AP) in the current frame. */
+#define RETURN_ADDR_RTX(COUNT, FRAME) \
+ ((COUNT) == 0 \
+ ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -2))\
+ : 0)
+
/* Before the prologue, the top of the frame is at 2(sp). */
#define INCOMING_FRAME_SP_OFFSET 2