This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [GCC 3.0] Bad regression, binary size


On Mon, Jul 09, 2001 at 03:22:09PM -0700, Linus Torvalds wrote:
> Ehh, what's wrong with just
> 
>         pushl %ebp
>         movl %esp,%ebp
>         subl $needed+16,%esp
>         andl $-15,%esp
> 
> which is just one instruction longer than the current regular frame 
> prologue, and leaves you with a aligned stack pointer AND a perfectly   
> good way to get to the argument frame (the frame pointer).

Hmm.  Normally we eliminate all stack frame references to EBP.
This would work ok except when alloca is used.

> Sure, if people use "alloca()" or other fancy stuff (variable-sized
> automatic variables etc), then you might need an extra instruction or   
> two to actually align the stack. How common is that?

It's not uncommon, but certainly less common than needing
aligned stack frames.

> Statistics, anyone? I bet heavy FP code has FP arguments, which means
> that the stack needs alignment very seldom indeed. Same is probably true
> for XMM etc too.

It'd be a decent thing to collect.

That said, for the newest processors, P4, Athlon, and x86-64,
it's a win to allocate all of the outgoing argument space in
the prologue and use mov instaed of push.  At which point keeping
the stack aligned takes zero extra instructions.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]