Patch: Bug in reload.c

Ulrich Weigand Ulrich.Weigand@de.ibm.com
Mon Feb 18 10:44:00 GMT 2002


>Bernd Schmidt wrote:
>
>On Thu, 14 Feb 2002, Ulrich Weigand wrote:
>
>> Not with the current s390 backend because this always accepts a literal
>> pool address as legitimate; however we are experimenting with changing
>> this to declaring them illegitimate and replacing them by base register
>> + offset in LEGITIMIZE_RELOAD_ADDRESS  (the goal of this is to avoid the
>> need for a fixed base register and instead having reload allocate one
>> when needed...).
>
>That may not be a valid use of that macro.  It should be thought of as
>useful for optimization, but I don't think one should try to use it to
>achieve correctness.

But if this cannot be done in LEGITIMIZE_RELOAD_ADDRESS, is there any
other way to handle the situation that the result of 'force_const_mem'
may not be a directly addressable memory location?

On S/390 we currently use a fixed register to point to the literal pool
base, and transform literal pool addresses to this register plus a
displacement only just when outputting the final assembly code.

However, if the literal pool of a routine exceeds 4KB, the displacement
is no longer legitimate itself.  In this case, we'd really need an
additional register to compute the address, but this would have to
be allocated by reload.


In any case, even if LEGITIMIZE_RELOADS_ADDRESS is only used for
optimization purposes, find_reloads_address_part appears to be
incorrect.  The return value of force_const_mem either always
contains a legitimate memory address, in which case the call to
find_reloads_address appears pointless, or else there are some
situations where the address is illegitimate.  However, in the
latter case (assuming LEGITIMIZE_RELOADS_ADDRESS does not touch
these addresses), find_reloads_address will always try to force
the address inself to the constant pool, which would appear to
cause an infinite recursion between find_reloads_address_part
and find_reloads_address ...

So of what use is the call to find_reloads_address in
find_reloads_address_part anyway?  Am I overlooking something
here?


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com



More information about the Gcc-patches mailing list