This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Query with legitimate_constant_p
- From: "D. Towner" <towner at compsci dot bristol dot ac dot uk>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Feb 2002 15:58:00 +0000 (GMT)
- Subject: Re: Query with legitimate_constant_p
> >
> >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