This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Half-baked i386 stack alignment thoughts
- To: gcc at gcc dot gnu dot org
- Subject: Half-baked i386 stack alignment thoughts
- From: John Wehle <john at feith dot com>
- Date: Thu, 2 Nov 2000 19:00:39 -0500 (EST)
Given:
int
func(int a, int b, int c)
{
int d;
d = 0;
if (a)
d += subr(a, a);
if (b)
d += subr(b, b);
d += subr(c, c);
return d;
}
produces:
-O2 -O2 -maccumulate-outgoing-args
... ...
subl $8, %esp
pushl %eax movl %eax, (%esp)
pushl %eax movl %eax, 4(%esp)
call subr call subr
movl %eax, %ebx movl %eax, %ebx
addl $16, %esp
... ...
The default code generation suffers from too many stack adjustments.
-maccumulate-outgoing-args solves that problem, however it suffers
from using a more expensive addressing mode.
What I propose is making -maccumulate-outgoing-args the default
and use push to place the arguments on the stack. I.e.:
...
addl $8, %esp
pushl %eax
pushl %eax
call subr
movl %eax, %ebx
...
Questions, comments, and suggestions welcomed.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------