This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: how can RETURN_ADDR_RTX possibly do its work?
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Dave Korn <dk at artimi dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 25 May 2004 14:40:12 +0100
- Subject: Re: how can RETURN_ADDR_RTX possibly do its work?
- Organization: Codesourcery LLC
- References: <NUTMEGPZrIkyPzGNsok00000039@NUTMEG.CAM.ARTIMI.COM>
Dave Korn wrote:
Is there some better solution to this problem that I'm overlooking? The
rs6000 solution of setting a flag to force the epilog generator to save the
link register whether it thinks it needs to or not seems like the most
robust to me, and I guess it's only a very tiny pessimisation in only those
leaf functions that call __builtin_return_address, but it still seems
inelegant to me.
I found that,
XXX.c
/* The return address of the current function. */
rtx
XXX_return_addr (void)
{
return get_hard_reg_initial_val (Pmode, LINK_REGNUM);
}
XXX.h
#define RETURN_ADDR_RTX(count,frame) \
((count) ? NULL_RTX : XXX_return_addr ())
did the trick. I stole it from one of the other config files, but I forget
which.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk