ARM/iwmmxt sibling call fix

Daniel Jacobowitz drow@false.org
Thu Apr 22 17:42:00 GMT 2004


On Thu, Apr 22, 2004 at 06:37:25PM +0100, Paul Brook wrote:
> > By the way, I believe that most of the TARGET_REALLY_IWMMXT code related to
> > preserving the stack pointer alignment ought to be conditionalized on
> > ARM_DOUBLEWORD_ALIGN instead. 
> 
> Yes, but only if we would otherwise have adjusted the stack by exactly 4 
> bytes.

You mean, if the difference between the TARGET_REALLY_IWMMXT case and
ARM_DOUBLEWORD_ALIGN case would be exactly 4 bytes?  It always is 4 or
0; all iWMMXt mandates is doubleword alignment.

> > Doesn't calling another function with a 
> > non-doubleword-aligned stack pointer violate the AAPCS?
> 
> It would. Proper alignment is ensured in arm_get_frame_offsets.

Ah, OK - another instance of fixing the same problem in a lot of places
:)  I suppose that's more efficient (prevents wasting 4 bytes of stack
space in some cases) but it does seem more natural to also do it the
way the iWMMXt code does, by giving our stack frame eight-byte
alignment instead of just our outgoing args pointer.

> 
> <...>
> > +      /* If r3 is marked as a saved register, than it was saved just to
> > +        preserve stack alignment.  We don't want to actually restore
> > +        it if we're doing a sibcall, since it might have an outgoing
> > +        argument by this point.  */
> > +      if (! really_return && (live_regs_mask & (1 << 3)))
> 
> Interrupt functions also save r3.

Thanks.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gcc-patches mailing list