Peter Barada wrote:

> I figured out how to make it work using LEGITIMIZE_RELOAD_ADDRESS(at
> least for gcc-3.4.3) via:

I seem to recall rth opposing any use of LEGITIMIZE_RELOAD_ADDRESS
to ensure *correctness* of generated code; L_R_A's only purpose
is supposed to provide additional optimizations. 

> For ColdFire v4e, FP loads and stores can not use REG+REG addressing.
> 
> I think you are correct that this current hack can be improved by
> making an array of mode to determine if double_reg_address_ok should
> be true, but I think in the end that a more flexible scheme be thought
> about since this isn't the *only* peculiarity of the ColdFire.  One is
> that pc-relative addressing is only available on the *source*, not the
> destination, and currently GO_IF_LEGITIMATE_ADDRESS nor
> LEGITIMIZE_ADDRESS have no way of know if its a source or destination.

It looks like you really have different types of valid addresses,
depending on which instruction uses the address.  We have a similar
situation on s390, and to handle this I've introduced the
EXTRA_MEMORY_CONSTRAINT mechanism.

The idea is, you keep GO_IF_LEGITIMIZE_ADDRESS defined so as to accept
the most general form of addresses accepted by any instruction.  You
continue to use the 'm' constraint for instructions accepting the most
general form.

For each more restricted form of address you define an extra constraint,
and recognize exactly the appropriate forms in your implementation of
EXTRA_CONSTRAINT.  You use these constraints instead of 'm' in those
instructions that accept only a restricted form of addresses.

In addition, you define EXTRA_MEMORY_CONSTRAINT and have it accept all
constraints that correspond to such restricted memory addresses.  (Note
that EXTRA_MEMORY_CONSTRAINT assumes that at least a single base
register will be a valid address accepted by any constraint marked
thus.)

Reload will now go and first try to handle each operand marked with
an EXTRA_MEMORY_CONSTRAINT just like it does 'm' operands.  However,
it additionally checks EXTRA_CONSTRAINT, and if the current operand
is rejected, reload will automatically reload the operand into a
base register.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  [EMAIL PROTECTED]

Reply via email to