Re: i386 stack slot optimisation

2005-04-19 Thread Øyvind Harboe
> I see what I missed the first time. Without optimization, we have stack > locals, which get allocated early. With optimization, we have > pseudo-regs which get spilled to the stack, which get allocated late. > So you are right, it is FRAME_GROWS_DOWNWARD that caused the behaviour > you saw.

Re: i386 stack slot optimisation

2005-04-19 Thread James E Wilson
Øyvind Harboe wrote: The external functions in my example using the arrays ensures that the arrays are not optimized away. Ah, right, stupid mistake on my part. The registers that are spilled are allocated place in the stack frame last, so when FRAME_GROWS_DOWNWARD, the displacement offsets are sma

Re: i386 stack slot optimisation

2005-04-19 Thread Øyvind Harboe
> -O3 enables function inlining. With function inlining, we can see that > the arrays are unused and we optimize them away. Without the arrays, > the stack frames are small, and hence you get small offsets. The external functions in my example using the arrays ensures that the arrays are not o

Re: i386 stack slot optimisation

2005-04-19 Thread James E Wilson
Øyvind Harboe wrote: How does the i386 backend optimise the stack slot assignment to minimize the displacement offset? We don't. We just assign sequential addresses as we allocate stack slots. ; -O0 => large offset leal8268(%esp), %eax incl(%eax) ; -O3 => small offset