Turn RETURN_ADDR_IN_PREVIOUS_FRAME into C expression

This allows a target to support both windowed and non-windowed ABI.

2015-03-03  Max Filippov  <jcmvbkbc@gmail.com>

gcc/
	* builtins.c (expand_builtin_return_addr): Add
	RETURN_ADDR_IN_PREVIOUS_FRAME to 'if' condition, remove
	surrounding #ifdef.
	* config/sparc/sparc.h (RETURN_ADDR_IN_PREVIOUS_FRAME): Change
	definition to 1.
	* config/xtensa/xtensa.h (RETURN_ADDR_IN_PREVIOUS_FRAME):
	Likewise.
	* defaults.h (RETURN_ADDR_IN_PREVIOUS_FRAME): Define to 0 if
	undefined.
	* doc/tm.texi.in (RETURN_ADDR_IN_PREVIOUS_FRAME): Update
	paragraph.

From-SVN: r221150
This commit is contained in:
Max Filippov 2015-03-03 15:04:02 +00:00 committed by Max Filippov
parent 9dd44d1c80
commit 2e612c470d
6 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,17 @@
2015-03-03 Max Filippov <jcmvbkbc@gmail.com>
* builtins.c (expand_builtin_return_addr): Add
RETURN_ADDR_IN_PREVIOUS_FRAME to 'if' condition, remove
surrounding #ifdef.
* config/sparc/sparc.h (RETURN_ADDR_IN_PREVIOUS_FRAME): Change
definition to 1.
* config/xtensa/xtensa.h (RETURN_ADDR_IN_PREVIOUS_FRAME):
Likewise.
* defaults.h (RETURN_ADDR_IN_PREVIOUS_FRAME): Define to 0 if
undefined.
* doc/tm.texi.in (RETURN_ADDR_IN_PREVIOUS_FRAME): Update
paragraph.
2015-03-03 Martin Jambor <mjambor@suse.cz>
Eric Botcazou <ebotcazou@adacore.com>

View File

@ -802,10 +802,8 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
register. There is no way to access it off of the current frame
pointer, but it can be accessed off the previous frame pointer by
reading the value from the register window save area. */
#ifdef RETURN_ADDR_IN_PREVIOUS_FRAME
if (fndecl_code == BUILT_IN_RETURN_ADDRESS)
if (RETURN_ADDR_IN_PREVIOUS_FRAME && fndecl_code == BUILT_IN_RETURN_ADDRESS)
count--;
#endif
/* Scan back COUNT frames to the specified frame. */
for (i = 0; i < count; i++)

View File

@ -1293,7 +1293,7 @@ do { \
access it from the current frame pointer. We can access it from the
previous frame pointer though by reading a value from the register window
save area. */
#define RETURN_ADDR_IN_PREVIOUS_FRAME
#define RETURN_ADDR_IN_PREVIOUS_FRAME 1
/* This is the offset of the return address to the true next instruction to be
executed for the current function. */

View File

@ -615,7 +615,7 @@ typedef struct xtensa_args
/* Define this if the return address of a particular stack frame is
accessed from the frame pointer of the previous stack frame. */
#define RETURN_ADDR_IN_PREVIOUS_FRAME
#define RETURN_ADDR_IN_PREVIOUS_FRAME 1
/* A C expression whose value is RTL representing the value of the
return address for the frame COUNT steps up from the current

View File

@ -1095,6 +1095,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define FRAME_GROWS_DOWNWARD 0
#endif
#ifndef RETURN_ADDR_IN_PREVIOUS_FRAME
#define RETURN_ADDR_IN_PREVIOUS_FRAME 0
#endif
/* On most machines, the CFA coincides with the first incoming parm. */
#ifndef ARG_POINTER_CFA_OFFSET
#define ARG_POINTER_CFA_OFFSET(FNDECL) \

View File

@ -2650,7 +2650,7 @@ A C expression whose value is RTL representing the value of the return
address for the frame @var{count} steps up from the current frame, after
the prologue. @var{frameaddr} is the frame pointer of the @var{count}
frame, or the frame pointer of the @var{count} @minus{} 1 frame if
@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is nonzero.
The value of the expression must always be the correct address when
@var{count} is zero, but may be @code{NULL_RTX} if there is no way to
@ -2658,8 +2658,9 @@ determine the return address of other frames.
@end defmac
@defmac RETURN_ADDR_IN_PREVIOUS_FRAME
Define this if the return address of a particular stack frame is accessed
from the frame pointer of the previous stack frame.
Define this macro to nonzero value if the return address of a particular
stack frame is accessed from the frame pointer of the previous stack
frame. The zero default for this macro is suitable for most ports.
@end defmac
@defmac INCOMING_RETURN_ADDR_RTX