This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Store motion rewrite
On Wed, Mar 05, 2003 at 10:55:01PM +0100, Zdenek Dvorak wrote:
> ! /* If we are handling exceptions, we must be careful with memory references
> ! that may trap. If we are not, the behavior is undefined, so we may just
> ! continue. */
> ! if (flag_exceptions && may_trap_p (x))
> ! return 0;
Really, this can be stricter -- flag_non_call_exceptions instead.
> ! /* Do not consider MEMs that mention stack pointer; in the following
> ! we rely on that constant functions do not read memory, which of course
> ! does not include their arguments if passed on stack. */
> ! if (reg_mentioned_p (stack_pointer_rtx, dest))
> return;
Really this needs to be any value whose *base* is the stack
pointer. Consider passing a large structure on the stack,
large enough that we overflow the architecture's immediate
offset from the sp, so we've generated
(set (reg temp) (plus (reg sp) (const_int high_part))
(set (mem (plus (reg temp) (const_int low_part))) (foo))
For a target like SH that has very limited immediate offsets,
this might be a real problem. You should be able to test this
using a function of about 20 arguments, I think.
Otherwise it looks good. I've had it in my alpha builds for
about a week with success.
r~