Query with legitimate_constant_p
D. Towner
towner@compsci.bristol.ac.uk
Wed Feb 13 08:06:00 GMT 2002
> >
> >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
The only things I allow to be legitimate addresses are registers, and
constant offsets to registers.
I have been looking at the internals of gcc, and have discovered that
after the copy propagation occurs, the new address (symbol_ref("s") + 2)
is checked, and found to be invalid. However, despite the presence of
code which supposedly fixes the invalid address , nothing happens, and
the invalid address makes it through into the assembly language. It
appears that the `find_reloads_address', and `find_reloads_address_1'
functions are unable to fix the invalid address. It this a bug in gcc,
or in my code? I can't see any way of customising the code which tries
to fix the invalid address? Also, the invalid address is of the form
(plus (symbol_ref) (const_int)) - this isn't identified as a CONSTANT_P
so one potential means of fixing the error becomes unavailable...
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