Fix uninitialized register read problem.
* builtins.c (expand_builtin_return_addr): Set current_function_accesses_prior_frames when count != 0. Use frame_pointer_rtx when count == 0. * function.h (struct function): Add accesses_prior_frames field. (current_function_accesses_prior_frames): Define. * reload1.c (init_elim_table): Check current_function_accesses_prior_frames. * doc/tm.texi (INITIAL_FRAME_ADDRESS_RTX): Update docs. From-SVN: r103294
This commit is contained in:
parent
48b5c5c173
commit
c8f27794b8
5 changed files with 38 additions and 9 deletions
|
@ -1,3 +1,14 @@
|
|||
2005-08-19 James E Wilson <wilson@specifix.com>
|
||||
|
||||
* builtins.c (expand_builtin_return_addr): Set
|
||||
current_function_accesses_prior_frames when count != 0. Use
|
||||
frame_pointer_rtx when count == 0.
|
||||
* function.h (struct function): Add accesses_prior_frames field.
|
||||
(current_function_accesses_prior_frames): Define.
|
||||
* reload1.c (init_elim_table): Check
|
||||
current_function_accesses_prior_frames.
|
||||
* doc/tm.texi (INITIAL_FRAME_ADDRESS_RTX): Update docs.
|
||||
|
||||
2005-08-19 Diego Novillo <dnovillo@redhat.com>
|
||||
|
||||
* tree-cfgcleanup.c (cleanup_tree_cfg): Fix flowgraph change
|
||||
|
|
|
@ -485,7 +485,22 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
|
|||
#ifdef INITIAL_FRAME_ADDRESS_RTX
|
||||
rtx tem = INITIAL_FRAME_ADDRESS_RTX;
|
||||
#else
|
||||
rtx tem = hard_frame_pointer_rtx;
|
||||
rtx tem;
|
||||
|
||||
/* For a zero count, we don't care what frame address we return, so frame
|
||||
pointer elimination is OK, and using the soft frame pointer is OK.
|
||||
For a non-zero count, we require a stable offset from the current frame
|
||||
pointer to the previous one, so we must use the hard frame pointer, and
|
||||
we must disable frame pointer elimination. */
|
||||
if (count == 0)
|
||||
tem = frame_pointer_rtx;
|
||||
else
|
||||
{
|
||||
tem = hard_frame_pointer_rtx;
|
||||
|
||||
/* Tell reload not to eliminate the frame pointer. */
|
||||
current_function_accesses_prior_frames = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Some machines need special handling before we can access
|
||||
|
|
|
@ -2812,14 +2812,11 @@ machines. See @file{function.c} for details.
|
|||
|
||||
@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.
|
||||
stack frame. This address is passed to @code{RETURN_ADDR_RTX} and
|
||||
@code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable
|
||||
default value will be used. Define this macro in order to make frame pointer
|
||||
elimination work in the presence of @code{__builtin_frame_address (count)} and
|
||||
@code{__builtin_return_address (count)} for @code{count} not equal to zero.
|
||||
@end defmac
|
||||
|
||||
@defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
|
||||
|
|
|
@ -394,6 +394,10 @@ struct function GTY(())
|
|||
either as a subroutine or builtin. */
|
||||
unsigned int calls_alloca : 1;
|
||||
|
||||
/* Nonzero if function being compiled called builtin_return_addr or
|
||||
builtin_frame_address with non-zero count. */
|
||||
unsigned int accesses_prior_frames : 1;
|
||||
|
||||
/* Nonzero if the function calls __builtin_eh_return. */
|
||||
unsigned int calls_eh_return : 1;
|
||||
|
||||
|
@ -483,6 +487,7 @@ extern int trampolines_created;
|
|||
#define current_function_returns_pointer (cfun->returns_pointer)
|
||||
#define current_function_calls_setjmp (cfun->calls_setjmp)
|
||||
#define current_function_calls_alloca (cfun->calls_alloca)
|
||||
#define current_function_accesses_prior_frames (cfun->accesses_prior_frames)
|
||||
#define current_function_calls_eh_return (cfun->calls_eh_return)
|
||||
#define current_function_is_thunk (cfun->is_thunk)
|
||||
#define current_function_args_info (cfun->args_info)
|
||||
|
|
|
@ -3492,6 +3492,7 @@ init_elim_table (void)
|
|||
sp-adjusting insns for this case. */
|
||||
|| (current_function_calls_alloca
|
||||
&& EXIT_IGNORE_STACK)
|
||||
|| current_function_accesses_prior_frames
|
||||
|| FRAME_POINTER_REQUIRED);
|
||||
|
||||
num_eliminable = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue