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]
Other format: [Raw text]

Re: Optimization


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~


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