On 19/08/14 15:24, Kito Cheng wrote: > Hi Richard: >> Hmm, I'm not sure about this. It might not be used at present, but on: >> AArch64, with more call-clobbered registers than call-saved registers, I >> would expect this ought to be a win. The fact that it isn't on today >> may say more about the way it works than the concept that it's the wrong >> thing to do in principle. > > In my view, calculate cost/profit should be done by register allocator instead > of a target hook/marco is more reasonable since register allocator can > have more globe view to it, and IRA do it now. > > And as Joseph say, no code calling it, so I think it's time to remove it. > thanks for your comment :) > >
Objection withdrawn. R. > > Hi Joseph: > >> Nothing uses it - not just no targets defining it, but no code calling it. >> If you have a use in future for a target hook doing something suggested by >> the name of this macro, by all means add one - but there's no point at all >> in keeping the macro until then. (It should of course be poisoned in >> system.h when removing it, as standard when removing target macros.) > Thanks, I add poison for CALLER_SAVE_PROFITABLE to system.h, > updated patch attached. > > thanks for your review :) > > ChangLog > 2014-08-19 Kito Cheng <k...@0xlab.org> > > * system.h (CALLER_SAVE_PROFITABLE): Poison. > * doc/tm.texi.in (CALLER_SAVE_PROFITABLE): Remove. > * gcc/doc/tm.texi: Regenerate. > * gcc/regs.h (CALLER_SAVE_PROFITABLE): Remove. > > On Tue, Aug 19, 2014 at 4:26 AM, Joseph S. Myers > <jos...@codesourcery.com> wrote: >> On Mon, 18 Aug 2014, Richard Earnshaw wrote: >> >>> Hmm, I'm not sure about this. It might not be used at present, but on >>> AArch64, with more call-clobbered registers than call-saved registers, I >>> would expect this ought to be a win. The fact that it isn't on today >>> may say more about the way it works than the concept that it's the wrong >>> thing to do in principle. >> >> Nothing uses it - not just no targets defining it, but no code calling it. >> If you have a use in future for a target hook doing something suggested by >> the name of this macro, by all means add one - but there's no point at all >> in keeping the macro until then. (It should of course be poisoned in >> system.h when removing it, as standard when removing target macros.) >> >> -- >> Joseph S. Myers >> jos...@codesourcery.com >> >> 0001-Remove-CALLER_SAVE_PROFITABLE-since-nobody-use-it-no.patch >> >> >> From 6a99f77eb6785c8d471329bda4bc67885f35909a Mon Sep 17 00:00:00 2001 >> From: Kito Cheng <k...@0xlab.org> >> Date: Tue, 19 Aug 2014 22:10:47 +0800 >> Subject: [PATCH] Remove CALLER_SAVE_PROFITABLE since nobody use it now. >> >> --- >> gcc/doc/tm.texi | 10 ---------- >> gcc/doc/tm.texi.in | 10 ---------- >> gcc/regs.h | 8 -------- >> gcc/system.h | 3 ++- >> 4 files changed, 2 insertions(+), 29 deletions(-) >> >> diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi >> index 9dd8d68..4d6492b 100644 >> --- a/gcc/doc/tm.texi >> +++ b/gcc/doc/tm.texi >> @@ -4528,16 +4528,6 @@ If you enable it, GCC can save registers around >> function calls. This >> makes it possible to use call-clobbered registers to hold variables that >> must live across calls. >> >> -@defmac CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls}) >> -A C expression to determine whether it is worthwhile to consider placing >> -a pseudo-register in a call-clobbered hard register and saving and >> -restoring it around each function call. The expression should be 1 when >> -this is worth doing, and 0 otherwise. >> - >> -If you don't define this macro, a default is used which is good on most >> -machines: @code{4 * @var{calls} < @var{refs}}. >> -@end defmac >> - >> @defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs}) >> A C expression specifying which mode is required for saving @var{nregs} >> of a pseudo-register in call-clobbered hard register @var{regno}. If >> diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in >> index dd72b98..7a63353 100644 >> --- a/gcc/doc/tm.texi.in >> +++ b/gcc/doc/tm.texi.in >> @@ -3683,16 +3683,6 @@ If you enable it, GCC can save registers around >> function calls. This >> makes it possible to use call-clobbered registers to hold variables that >> must live across calls. >> >> -@defmac CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls}) >> -A C expression to determine whether it is worthwhile to consider placing >> -a pseudo-register in a call-clobbered hard register and saving and >> -restoring it around each function call. The expression should be 1 when >> -this is worth doing, and 0 otherwise. >> - >> -If you don't define this macro, a default is used which is good on most >> -machines: @code{4 * @var{calls} < @var{refs}}. >> -@end defmac >> - >> @defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs}) >> A C expression specifying which mode is required for saving @var{nregs} >> of a pseudo-register in call-clobbered hard register @var{regno}. If >> diff --git a/gcc/regs.h b/gcc/regs.h >> index be81db4..36e803d 100644 >> --- a/gcc/regs.h >> +++ b/gcc/regs.h >> @@ -214,14 +214,6 @@ extern short *reg_renumber; >> >> extern int caller_save_needed; >> >> -/* Predicate to decide whether to give a hard reg to a pseudo which >> - is referenced REFS times and would need to be saved and restored >> - around a call CALLS times. */ >> - >> -#ifndef CALLER_SAVE_PROFITABLE >> -#define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS)) >> -#endif >> - >> /* Select a register mode required for caller save of hard regno REGNO. */ >> #ifndef HARD_REGNO_CALLER_SAVE_MODE >> #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ >> diff --git a/gcc/system.h b/gcc/system.h >> index 29da797..3f2cfa1 100644 >> --- a/gcc/system.h >> +++ b/gcc/system.h >> @@ -933,7 +933,8 @@ extern void fancy_abort (const char *, int, const char >> *) ATTRIBUTE_NORETURN; >> CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT \ >> REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT \ >> EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \ >> - EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P >> + EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \ >> + CALLER_SAVE_PROFITABLE >> >> /* Hooks that are no longer used. */ >> #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE >> \