ARM Thumb byte stores
Richard Earnshaw
rearnsha@arm.com
Wed Apr 4 07:21:00 GMT 2001
> Richard Earnshaw wrote:
> >
> > > > This is a bug in gcc. There is no strb instruction that stores to the
> > > > stack in thumb mode. It was fixed (I hope) in the cvs in early December:
> > >
> > > My problem was with cvs gcc yesterday :). I'm still trying to get a small
> > > test case to reproduce the problem.
> > >
> >
> > Drat. I thought that problem was behind us... A test case is going to be
> > need before I can progress this. My guess is that it is likely to be some
> > sort of reload problem, so it may be hard to whittle it down to a very
> > short function.
>
> [ much time passes ]
>
> I have the test case now:
Thanks.
The problem occurs because we have r8 (a high register) equal to sp; so
when we try to reload the store (which is based off r8), we substitute in
SP, since it is in BASE_REGS_CLASS and hence 'a valid alternative'.
Here is what I think should be a suitable patch. I've run some code
through it, and it doesn't seem to cause anything horrible to happen; but
messing around with the register classes is fraught with potential
problems, so this may throw up something I haven't considered. However,
the AVR port seems to manage without having the stack pointer part of
BASE_REG_CLASS, so maybe thumb compiles can too.
This change does not seem to prevent sp from being used as an address
register at other times, but it should stop it being used for this purpose
when we need to push a reload.
Please let me know if this causes any further problems.
<date> Richard Earnshaw (rearnsha@arm.com)
* arm.h (BASE_REG_CLASS): For thumb, don't allow the stack register
to be in this class.
More information about the Gcc
mailing list