This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for -mcaller-super-interworking & stack arguments
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 01 Sep 2004 16:45:23 +0100
- Subject: Re: Patch for -mcaller-super-interworking & stack arguments
- Organization: GNU
- References: <87isbsx07u.fsf@redhat.com> <1093604695.22129.97.camel@pc960.cambridge.arm.com> <87zn4am5yf.fsf@redhat.com>
On Wed, 2004-09-01 at 15:14, Richard Sandiford wrote:
> Richard Earnshaw <rearnsha@gcc.gnu.org> writes:
> > Another approach would be to use r11 (fp) to hold the 'frame pointer' in
> > the case where we didn't really need a frame (and continue to pretend
> > that the function was frameless). It would mean a further function stub
> > in libgcc (unless you always made it work that way) but would mean that
> > we didn't loose a low register. You'd end up with a prologue sequence
> > something like
> >
> > push {r4-r7, lr}
> > mov r4, fp
> > push {r4}
> > sub sp, sp, #4
> > mov fp, sp
> >
> > The interwork stub would be similar to the one in your proposed patch,
> > but use fp instead of r7.
> >
> > To make this work you'd probably have to make r11 a fixed register for
> > -mthumb -mcaller-super-interworking, but that wouldn't hurt very much.
>
> OK, here's a patch to do that. In most other respects, it's the same
> as the patch I posted before.
>
> The main difficulty with using r11 is that we need to make it fixed
> while at the same time:
>
> (a) making sure it is treated as call-saved rather than call-clobbered and
r11 (fp) is *always* call saved. Whatever made you think it was
otherwise?
> (b) making sure that every CALL_INSN is treated as using r11.
>
Again this seems wrong.
I think all you need to do is make sure that
fixed_regs [11] = call_used_regs[11] = 1
in environments where you want to play this trick and everything else
should just fall out in the wash. The only slightly tricky bit is
ensuring that you save r11 correctly when it's needed for this purpose
and not otherwise, but I think you can work that all out given the other
variables you have to hand.
R.