Message ID | 1444523150-15236-3-git-send-email-tbsaunde+gcc@tbsaunde.org |
---|---|
State | New |
Headers | show |
On 10/11/2015 02:25 AM, tbsaunde+gcc@tbsaunde.org wrote: > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org> > > gcc/ChangeLog: > > 2015-10-10 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> > > * defaults.h (SETUP_FRAME_ADDRESSES): New default definition. > * builtins.c (expand_builtin_return_addr): Adjust. > * doc/tm.texi: Likewise. > * doc/tm.texi.in: Likewise. > * except.c (expand_builtin_unwind_init): Likewise. If we go to the trouble of changing this, could we convert macros to target hooks instead while we're there? REVERSE_CONDITION, SETUP_FRAME_ADDRESSES and FRAME_ADDR_RTX all seem to be used only in a handful of ports, and INITIAL_FRAME_ADDRESS_RTX only in one. Bernd
On Mon, Oct 12, 2015 at 12:19:08PM +0200, Bernd Schmidt wrote: > On 10/11/2015 02:25 AM, tbsaunde+gcc@tbsaunde.org wrote: > >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org> > > > >gcc/ChangeLog: > > > >2015-10-10 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> > > > > * defaults.h (SETUP_FRAME_ADDRESSES): New default definition. > > * builtins.c (expand_builtin_return_addr): Adjust. > > * doc/tm.texi: Likewise. > > * doc/tm.texi.in: Likewise. > > * except.c (expand_builtin_unwind_init): Likewise. > > If we go to the trouble of changing this, could we convert macros to target > hooks instead while we're there? REVERSE_CONDITION, SETUP_FRAME_ADDRESSES > and FRAME_ADDR_RTX all seem to be used only in a handful of ports, and > INITIAL_FRAME_ADDRESS_RTX only in one. I'm definitely planning to do that, but I think this is still somewhat useful even if only to have one list to look at for what hooks need to be added. Trev > > > Bernd
On 10/15/2015 04:13 AM, Trevor Saunders wrote: > On Mon, Oct 12, 2015 at 12:19:08PM +0200, Bernd Schmidt wrote: >> If we go to the trouble of changing this, could we convert macros to target >> hooks instead while we're there? REVERSE_CONDITION, SETUP_FRAME_ADDRESSES >> and FRAME_ADDR_RTX all seem to be used only in a handful of ports, and >> INITIAL_FRAME_ADDRESS_RTX only in one. > > I'm definitely planning to do that, but I think this is still somewhat > useful even if only to have one list to look at for what hooks need to > be added. I'd prefer to do things right from the start, at least for easy cases such as these. Each change we make has a chance of introducing errors, and there is a cost for people working on patches each time the code changes under them. And for you it'll be less work in the long run as well. Bernd
On Thu, Oct 15, 2015 at 11:47:10AM +0200, Bernd Schmidt wrote: > On 10/15/2015 04:13 AM, Trevor Saunders wrote: > >On Mon, Oct 12, 2015 at 12:19:08PM +0200, Bernd Schmidt wrote: > >>If we go to the trouble of changing this, could we convert macros to target > >>hooks instead while we're there? REVERSE_CONDITION, SETUP_FRAME_ADDRESSES > >>and FRAME_ADDR_RTX all seem to be used only in a handful of ports, and > >>INITIAL_FRAME_ADDRESS_RTX only in one. > > > >I'm definitely planning to do that, but I think this is still somewhat > >useful even if only to have one list to look at for what hooks need to > >be added. > > I'd prefer to do things right from the start, at least for easy cases such > as these. Each change we make has a chance of introducing errors, and there > is a cost for people working on patches each time the code changes under > them. And for you it'll be less work in the long run as well. Its a fair concern that changing things has risks, on the other hand breaking the change up into parts makes the parts simpler to check for correctness. At any rate I don't have any more tiny patches like this coming, so I don't know how much this discussion is getting us ;) thanks! Trev > > > Bernd
diff --git a/gcc/builtins.c b/gcc/builtins.c index 3bbe763..bd95acb 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -784,13 +784,8 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count) } } - /* Some machines need special handling before we can access - arbitrary frames. For example, on the SPARC, we must first flush - all register windows to the stack. */ -#ifdef SETUP_FRAME_ADDRESSES if (count > 0) SETUP_FRAME_ADDRESSES (); -#endif /* On the SPARC, the return address is not in the frame, it is in a register. There is no way to access it off of the current frame diff --git a/gcc/defaults.h b/gcc/defaults.h index c4d9536..5f1ea76 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1281,6 +1281,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define INITIAL_FRAME_ADDRESS_RTX NULL #endif +#ifndef SETUP_FRAME_ADDRESSES +#define SETUP_FRAME_ADDRESSES() do { } while (0) +#endif + #ifdef GCC_INSN_FLAGS_H /* Dependent default target macro definitions diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 72366b9..d09e646 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3020,11 +3020,11 @@ address of the stack word that points to the previous frame. @end defmac @defmac SETUP_FRAME_ADDRESSES -If defined, a C expression that produces the machine-specific code to +A C expression that produces the machine-specific code to setup the stack so that arbitrary frames can be accessed. For example, on the SPARC, we must flush all of the register windows to the stack before we can access arbitrary stack frames. You will seldom need to -define this macro. +define this macro. The default is to do nothing. @end defmac @deftypefn {Target Hook} rtx TARGET_BUILTIN_SETJMP_FRAME_VALUE (void) diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index d8d0087..33939ec 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -2626,11 +2626,11 @@ address of the stack word that points to the previous frame. @end defmac @defmac SETUP_FRAME_ADDRESSES -If defined, a C expression that produces the machine-specific code to +A C expression that produces the machine-specific code to setup the stack so that arbitrary frames can be accessed. For example, on the SPARC, we must flush all of the register windows to the stack before we can access arbitrary stack frames. You will seldom need to -define this macro. +define this macro. The default is to do nothing. @end defmac @hook TARGET_BUILTIN_SETJMP_FRAME_VALUE diff --git a/gcc/except.c b/gcc/except.c index fed18ee..8f77653 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2120,9 +2120,7 @@ expand_builtin_unwind_init (void) able to copy the saved values for any registers from frames we unwind. */ crtl->saves_all_registers = 1; -#ifdef SETUP_FRAME_ADDRESSES SETUP_FRAME_ADDRESSES (); -#endif } /* Map a non-negative number to an eh return data register number; expands
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org> gcc/ChangeLog: 2015-10-10 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * defaults.h (SETUP_FRAME_ADDRESSES): New default definition. * builtins.c (expand_builtin_return_addr): Adjust. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * except.c (expand_builtin_unwind_init): Likewise. --- gcc/builtins.c | 5 ----- gcc/defaults.h | 4 ++++ gcc/doc/tm.texi | 4 ++-- gcc/doc/tm.texi.in | 4 ++-- gcc/except.c | 2 -- 5 files changed, 8 insertions(+), 11 deletions(-)