This is the mail archive of the 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: Query with legitimate_constant_p

Nick Ing-Simmons wrote:
> Dan Towner <> 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.

Daniel Towner
picoChip Designs Ltd., Riverside Buildings, 108, Walcot Street, BATH,
07786 702589

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