This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [arm] Fix thumb register allocation failure
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Apr 2004 12:47:17 +0100
- Subject: Re: [arm] Fix thumb register allocation failure
- References: <200404072109.17137.paul@codesourcery.com>
On Wed, 2004-04-07 at 21:09, Paul Brook wrote:
> The patch below fixes a register allocation failure when compiling for thumb.
> When the code below is compiled with gcc -mthumb -O2 -fno-omit-frame pointer
> combine keep the argument registers (r0-r3) live up until the call to z. r7
> is use for the frame pointer, which leaves only 3 register available. This is
> insufficient to perform the doubleword add.
>
> The fix is make CLASS_LIKELY_SPILLED_P return true for LO_REGS.
>
> Tested with cross-compiler to arm-none-elf.
> Ok?
>
> Paul
>
> void z(int, int *);
> int foo(int a, int b, int c, int d, long long *q)
> {
> int p;
> *q=*q+1;
> z (a+b+c+d, &p);
> }
>
> 2004-04-07 Paul Brook <paul@codesourcery.com>
>
> * arm.h (CLASS_LIKELY_SPILLED_P): Define.
Note that CC_REG class registers are always used as fixed registers (not
available to the register allocator), so I'd be surprised if it was
necessary to check that.
I suppose this patch is necessary even though it will probably pessimize
code. There's been a large jump in code size (particularly at -O2 --
0.5%) in the CSiBE benchmark at about the time this patch went in. Is
this patch responsible, or do I need to hunt for some other culprit?
R.