From 579f294624827c80f01af119cc3f52265371a353 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 11 Oct 2015 00:47:52 +0000 Subject: [PATCH] always define INITIAL_FRAME_ADDRESS_RTX gcc/ChangeLog: 2015-10-10 Trevor Saunders * builtins.c (expand_builtin_return_addr): Adjust. * defaults.h (INITIAL_FRAME_ADDRESS_RTX): New default definition. From-SVN: r228685 --- gcc/ChangeLog | 5 +++++ gcc/builtins.c | 39 ++++++++++++++++++--------------------- gcc/defaults.h | 4 ++++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 531ea11f155..5da4a5dd09f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-10-10 Trevor Saunders + + * builtins.c (expand_builtin_return_addr): Adjust. + * defaults.h (INITIAL_FRAME_ADDRESS_RTX): New default definition. + 2015-10-10 Jan Hubicka * tree.c (type_with_interoperable_signedness): New. diff --git a/gcc/builtins.c b/gcc/builtins.c index 643eeef2106..3bbe763b031 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -761,31 +761,28 @@ static rtx expand_builtin_return_addr (enum built_in_function fndecl_code, int count) { int i; - -#ifdef INITIAL_FRAME_ADDRESS_RTX rtx tem = INITIAL_FRAME_ADDRESS_RTX; -#else - rtx tem; - - /* For a zero count with __builtin_return_address, we don't care what - frame address we return, because target-specific definitions will - override us. Therefore frame pointer elimination is OK, and using - the soft frame pointer is OK. - - For a nonzero count, or a zero count with __builtin_frame_address, - 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 && fndecl_code == BUILT_IN_RETURN_ADDRESS) - tem = frame_pointer_rtx; - else + if (tem == NULL_RTX) { - tem = hard_frame_pointer_rtx; + /* For a zero count with __builtin_return_address, we don't care what + frame address we return, because target-specific definitions will + override us. Therefore frame pointer elimination is OK, and using + the soft frame pointer is OK. - /* Tell reload not to eliminate the frame pointer. */ - crtl->accesses_prior_frames = 1; + For a nonzero count, or a zero count with __builtin_frame_address, + 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 && fndecl_code == BUILT_IN_RETURN_ADDRESS) + tem = frame_pointer_rtx; + else + { + tem = hard_frame_pointer_rtx; + + /* Tell reload not to eliminate the frame pointer. */ + crtl->accesses_prior_frames = 1; + } } -#endif /* Some machines need special handling before we can access arbitrary frames. For example, on the SPARC, we must first flush diff --git a/gcc/defaults.h b/gcc/defaults.h index 14ef91ad4b5..c4d953622be 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1277,6 +1277,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN #endif +#ifndef INITIAL_FRAME_ADDRESS_RTX +#define INITIAL_FRAME_ADDRESS_RTX NULL +#endif + #ifdef GCC_INSN_FLAGS_H /* Dependent default target macro definitions