This is the mail archive of the
mailing list for the GCC project.
Re: pa.c clean-up
- To: Jeffrey A Law <law at redhat dot com>
- Subject: Re: pa.c clean-up
- From: Richard Henderson <rth at redhat dot com>
- Date: Thu, 1 Feb 2001 01:20:21 -0800
- Cc: Alan Modra <alan at linuxcare dot com dot au>, gcc-patches at gcc dot gnu dot org
- References: <20010131183924.D14026@redhat.com> <email@example.com>
On Wed, Jan 31, 2001 at 08:01:18PM -0700, Jeffrey A Law wrote:
> When we have a frame pointer our prologue looks something like this:
> store return pointer into stack
> copy fp, scratch
> copy sp, fp
> stwm scratch size(sp) /* store scratch into stack and allocate
> stack space for new frame */
> store other callee saved registers via fp
So what keeps "store other callee" from moving in front of "stwm scratch"?
Or, in general, anything else that uses memory from moving in front of
"stwm scratch"? Nothing, I'll warrant.
I couldn't make anything bad happen with the simplest of test cases,
because I kept getting a stupid extra copy out of the register allocator
that would throw off the schedule. But it's simple enough, for the
purposes of illustration, to cheat and use a global register variable.
register int y __asm__("r26");
const int x = y;
I get (-O2 -fno-omit-frame-pointer)
Note that the store of r26 has advanced in front of the stack allocation.
Even with a less contrived example, if you examine the sched2 dumps you'll
see that there is no dependancy between *any* frame pointer store and the
stack allocation. So you only survive this far by luck.
This is _exactly_ the problem I've encountered before. You'll run into it
every single time the frame pointer is at the opposite end of the frame as
the stack pointer. Examine the prologue_allocate_stack pattern in ia64.md
and the pro_epilogue_adjust_stack pattern in i386.md.