Query with legitimate_constant_p
Dan Towner
dant@picochip.com
Tue Feb 12 09:33:00 GMT 2002
Nick Ing-Simmons wrote:
>
> Dan Towner <dant@picochip.com> writes:
> >> > Instead of doing that, use `n' constraints, and suitable predicates
> >> > where appropriate, to prevent GCC generating symbol references as
> >> > immediate operands where they won't work.
> >
> >That doesn't work though. Consider the following:
> >
> > reg0 := symbol_ref("s")
> > reg1 := mem(reg0 + 2)
> >
> >Because the symbol_ref is a valid constant, gcc propagates the constant
> >into the memory load:
> >
> > reg1 := mem(symbol_ref("s") + 2)
>
> It won't do that if you deny that it is a LEGITIMATE_ADDRESS
I deny that any symbol_ref is a legitimate address, but constant
propagation still puts the symbol ref into the memory operation. If I
deny that any memory base (e.g., offset to a register) is valid, then
the problem doesn't occur, but this is the means that I can't take
advantage of the regBase+constOffset instructions the machine offers.
Perhaps it is better to rephrase my question - how can I allow
load/stores which are to register-based addresses (with constant
offsets), but not to symbol refs?
Thanks for all your help.
Dan.
=============================================================================
Daniel Towner
picoChip Designs Ltd., Riverside Buildings, 108, Walcot Street, BATH,
BA1 5BG
dant@picochip.com
07786 702589
More information about the Gcc
mailing list