This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ARM] Tweak CLASS_LIKELY_SPILLED_P, MODE_BASE_REG_CLASS for Thumb-2
- From: Julian Brown <julian at codesourcery dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, paul at codesourcery dot com
- Date: Mon, 7 Jun 2010 19:57:16 +0100
- Subject: Re: [PATCH, ARM] Tweak CLASS_LIKELY_SPILLED_P, MODE_BASE_REG_CLASS for Thumb-2
- References: <20100528122322.607c237a@rex.config> <20100528122648.7fb88458@rex.config> <1275051869.12222.19.camel@e102346-lin.cambridge.arm.com>
On Fri, 28 May 2010 14:04:29 +0100
Richard Earnshaw <rearnsha@arm.com> wrote:
>
> On Fri, 2010-05-28 at 12:26 +0100, Julian Brown wrote:
> > /* The class value for index registers, and the one for base regs.
> > */
> > @@ -1260,7 +1263,7 @@ enum reg_class
> > when addressing quantities in QI or HI mode; if we don't know
> > the mode, then we must be conservative. */
> > #define
> > MODE_BASE_REG_CLASS(MODE) \
> > - (TARGET_32BIT ?
> > CORE_REGS : \
> > + (TARGET_32BIT ? (TARGET_THUMB2 ? LO_REGS :
> > CORE_REGS) : \
> > (((MODE) == SImode) ? BASE_REGS : LO_REGS))
> >
>
> Why not change the first test to TARGET_ARM?
(I think you mean like the attached patch.)
> That begs the question as to why this is needed as part of this patch.
> Is there some reason why LO_REGS has to be used here (other than code
> size)? If it's just for size, should this be limited to -Os?
I ran some tests with the attached patch, and it doesn't show any
problems (for gcc, g++, libstdc++ with -mthumb -march=armv7-a). I also
benchmarked for speed: with the attached version of the patch,
performance increases a little (~0.2%) on the same well-known benchmark
(at least on the hardware I tried it on).
(Note that referring to optimize_size in the MODE_BASE_REG_CLASS macro
necessitates shuffling #include order in a few random files to avoid
undefined references.)
OK to apply?
Julian
ChangeLog
Julian Brown <julian@codesourcery.com>
Mark Shinwell <mark@codesourcery.com>
gcc/
* regrename.c (addresses.h): Move include of addresses.h after
include of flags.h.
* recog.c: Likewise.
* regcprop.c: Likewise.
* config/arm/arm.h (CLASS_LIKELY_SPILLED_P): Check against
LO_REGS only for Thumb-1.
(MODE_BASE_REG_CLASS): Restrict base registers to those which can
be used in short instructions when optimising for size on Thumb-2.