This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC 1/2] Turn RETURN_ADDR_IN_PREVIOUS_FRAME into C expression
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Sterling Augustine <augustine dot sterling at gmail dot com>, Richard Henderson <rth at redhat dot com>, "David S. Miller" <davem at redhat dot com>, Eric Botcazou <ebotcazou at libertysurf dot fr>
- Date: Sun, 1 Mar 2015 09:34:38 +0300
- Subject: Re: [RFC 1/2] Turn RETURN_ADDR_IN_PREVIOUS_FRAME into C expression
- Authentication-results: sourceware.org; auth=none
- References: <1425147282-7415-1-git-send-email-jcmvbkbc at gmail dot com> <1425147282-7415-2-git-send-email-jcmvbkbc at gmail dot com>
Richard, David, Eric,
could you please take a look and possibly approve the below changes for
sparc?
On Sat, Feb 28, 2015 at 9:14 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> This allows a target to support both windowed and non-windowed ABI.
>
> 2015-02-28 Max Filippov <jcmvbkbc@gmail.com>
>
> gcc/
> * builtins.c (expand_builtin_return_addr): Add
> RETURN_ADDR_IN_PREVIOUS_FRAME to 'if' condition.
> * config/sparc/sparc.h (RETURN_ADDR_IN_PREVIOUS_FRAME): Change
> definition to 1.
> * config/xtensa/xtensa.h (RETURN_ADDR_IN_PREVIOUS_FRAME):
> Likewise.
> ---
> gcc/builtins.c | 2 +-
> gcc/config/sparc/sparc.h | 2 +-
> gcc/config/xtensa/xtensa.h | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/builtins.c b/gcc/builtins.c
> index fb871e6..0cc0c68 100644
> --- a/gcc/builtins.c
> +++ b/gcc/builtins.c
> @@ -803,7 +803,7 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
> 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
>
> diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
> index c6100a1..27ad748 100644
> --- a/gcc/config/sparc/sparc.h
> +++ b/gcc/config/sparc/sparc.h
> @@ -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. */
> diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
> index 74ca240..14fe4bb 100644
> --- a/gcc/config/xtensa/xtensa.h
> +++ b/gcc/config/xtensa/xtensa.h
> @@ -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
> --
> 1.8.1.4
>
--
Thanks.
-- Max