Commit c6d01079 by Andreas Krebbel Committed by Ulrich Weigand

builtins.c (expand_builtin_return_addr): Remove tem parameter.

2005-02-17  Andreas Krebbel  <krebbel1@de.ibm.com>

	* builtins.c (expand_builtin_return_addr): Remove tem parameter.
	tem becomes a local variable which is set to the value of the
	back end defined INITIAL_FRAME_ADDRESS macro.
	(expand_builtin_frame_address): Omit the base parameter to
	expand_builtin_return_addr.
	(expand_builtin_profile_func): Likewise.
	* config/s390/s390.h (INITIAL_FRAME_ADDRESS_RTX): Define new macro.
	(DYNAMIC_CHAIN_ADDRESS): Remove the case for the initial frame.
	* doc/tm.texi: Documentation for INITIAL_FRAME_ADDRESS_RTX added.

From-SVN: r95194
parent 7b210806
2005-02-17 Andreas Krebbel <krebbel1@de.ibm.com>
* builtins.c (expand_builtin_return_addr): Remove tem parameter.
tem becomes a local variable which is set to the value of the
back end defined INITIAL_FRAME_ADDRESS macro.
(expand_builtin_frame_address): Omit the base parameter to
expand_builtin_return_addr.
(expand_builtin_profile_func): Likewise.
* config/s390/s390.h (INITIAL_FRAME_ADDRESS_RTX): Define new macro.
(DYNAMIC_CHAIN_ADDRESS): Remove the case for the initial frame.
* doc/tm.texi: Documentation for INITIAL_FRAME_ADDRESS_RTX added.
2005-02-17 Jakub Jelinek <jakub@redhat.com> 2005-02-17 Jakub Jelinek <jakub@redhat.com>
* config/s390/s390.c (s390_alloc_pool, s390_free_pool, * config/s390/s390.c (s390_alloc_pool, s390_free_pool,
......
...@@ -453,11 +453,16 @@ builtin_save_expr (tree exp) ...@@ -453,11 +453,16 @@ builtin_save_expr (tree exp)
address located within it (depending on FNDECL_CODE). */ address located within it (depending on FNDECL_CODE). */
static rtx static rtx
expand_builtin_return_addr (enum built_in_function fndecl_code, int count, expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
rtx tem)
{ {
int i; int i;
#ifdef INITIAL_FRAME_ADDRESS_RTX
rtx tem = INITIAL_FRAME_ADDRESS_RTX;
#else
rtx tem = hard_frame_pointer_rtx;
#endif
/* Some machines need special handling before we can access /* Some machines need special handling before we can access
arbitrary frames. For example, on the sparc, we must first flush arbitrary frames. For example, on the sparc, we must first flush
all register windows to the stack. */ all register windows to the stack. */
...@@ -4221,8 +4226,7 @@ expand_builtin_frame_address (tree fndecl, tree arglist) ...@@ -4221,8 +4226,7 @@ expand_builtin_frame_address (tree fndecl, tree arglist)
{ {
rtx tem rtx tem
= expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl), = expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl),
tree_low_cst (TREE_VALUE (arglist), 1), tree_low_cst (TREE_VALUE (arglist), 1));
hard_frame_pointer_rtx);
/* Some ports cannot access arbitrary stack frames. */ /* Some ports cannot access arbitrary stack frames. */
if (tem == NULL) if (tem == NULL)
...@@ -4855,7 +4859,7 @@ expand_builtin_profile_func (bool exitp) ...@@ -4855,7 +4859,7 @@ expand_builtin_profile_func (bool exitp)
emit_library_call (which, LCT_NORMAL, VOIDmode, 2, this, Pmode, emit_library_call (which, LCT_NORMAL, VOIDmode, 2, this, Pmode,
expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS, expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
0, hard_frame_pointer_rtx), 0),
Pmode); Pmode);
return const0_rtx; return const0_rtx;
......
...@@ -612,20 +612,22 @@ extern int current_function_outgoing_args_size; ...@@ -612,20 +612,22 @@ extern int current_function_outgoing_args_size;
the argument area. */ the argument area. */
#define FIRST_PARM_OFFSET(FNDECL) 0 #define FIRST_PARM_OFFSET(FNDECL) 0
/* Defining this macro makes __builtin_frame_address(0) and
__builtin_return_address(0) work with -fomit-frame-pointer. */
#define INITIAL_FRAME_ADDRESS_RTX \
(TARGET_PACKED_STACK ? \
plus_constant (arg_pointer_rtx, -UNITS_PER_WORD) : \
plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET))
/* The return address of the current frame is retrieved /* The return address of the current frame is retrieved
from the initial value of register RETURN_REGNUM. from the initial value of register RETURN_REGNUM.
For frames farther back, we use the stack slot where For frames farther back, we use the stack slot where
the corresponding RETURN_REGNUM register was saved. */ the corresponding RETURN_REGNUM register was saved. */
#define DYNAMIC_CHAIN_ADDRESS(FRAME) \
(TARGET_PACKED_STACK ? \
plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) : (FRAME))
#define DYNAMIC_CHAIN_ADDRESS(FRAME) \ #define RETURN_ADDR_RTX(COUNT, FRAME) \
(TARGET_PACKED_STACK ? \
((FRAME) != hard_frame_pointer_rtx ? \
plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) : \
plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) : \
((FRAME) != hard_frame_pointer_rtx ? (FRAME) : \
plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)))
#define RETURN_ADDR_RTX(COUNT, FRAME) \
s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME))) s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
/* In 31-bit mode, we need to mask off the high bit of return addresses. */ /* In 31-bit mode, we need to mask off the high bit of return addresses. */
......
...@@ -2931,6 +2931,18 @@ length of the outgoing arguments. The default is correct for most ...@@ -2931,6 +2931,18 @@ length of the outgoing arguments. The default is correct for most
machines. See @file{function.c} for details. machines. See @file{function.c} for details.
@end defmac @end defmac
@defmac INITIAL_FRAME_ADDRESS_RTX
A C expression whose value is RTL representing the address of the initial
stack frame. This address is passed to @code{RETURN_ADDR_RTX} and
@code{DYNAMIC_CHAIN_ADDRESS}.
If you don't define this macro, the default is to return
@code{hard_frame_pointer_rtx}.
This default is usually correct unless @code{-fomit-frame-pointer} is in
effect.
Define this macro in order to make @code{__builtin_frame_address (0)} and
@code{__builtin_return_address (0)} work even in absence of a hard frame pointer.
@end defmac
@defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr}) @defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
A C expression whose value is RTL representing the address in a stack A C expression whose value is RTL representing the address in a stack
frame where the pointer to the caller's frame is stored. Assume that frame where the pointer to the caller's frame is stored. Assume that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment