This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization
- From: Richard Henderson <rth at redhat dot com>
- To: Piotr Wyderski <piotr dot wyderski at hoga dot pl>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 2 May 2003 16:06:18 -0700
- Subject: Re: Optimization
- References: <000201c310a3$850de5a0$acf84dd5@voltan>
On Fri, May 02, 2003 at 01:32:39PM +0200, Piotr Wyderski wrote:
> Why don't you optimize the "jump to ret" construction?
We do, depending on the target, and the epilogue.
int foo(int p, int *q, int *r)
{
if (p) *q = 1; else *r = 2;
}
movl 4(%esp), %eax
testl %eax, %eax
je .L2
movl 8(%esp), %eax
movl $1, (%eax)
ret
.p2align 2,,3
.L2:
movl 12(%esp), %eax
movl $2, (%eax)
ret
> I see that there's also a greedy stack frame allocator instead
> of a lazy one. Using the previous example
[...]
> when C is short and can be computed using only the scratch
> registers, i.e. eax, edx and ecx, and D is complex and needs
> to save/restore the remaining GP registers,
Yes, this is called "shrink-wrapping", and we don't implement it.
r~