Dobes wrote:
I am working on a port to an architecture with some strict rules. The
restriction that I am unable to figure out how to enforce is a base register
that is allowed in the destination operand, but not in a source operand.
GCC does not provide any way in the old GO_IF_LEGITIMATE_ADDRESS (or the
new TARGET_LEGITIMATE_ADDRESS_P) to distinguish between an address used
in a dest and an address used in a source. You probably just have to
limit this to addresses that are valid in both places. You can then add
extra constraints to try to recognize other types of memory addresses.
So you could use "mR" for destination operands and "mS" for source
operands, where R and S are extra constraints that have been defined
appropriately. An example to look at might be the s390 port. The movti
pattern for instance uses QRST, where only Q and S can be in the dest,
but any of Q, R, S, or T can be in the source. And it doesn't seem to
use 'm' much.
If you don't have a set of base registers that are valid both in source
and dest addresses, then this probably gets messy.
Of course, it would be nice if gcc handled this better, but fixing this
is probably a lot of work.
Jim