This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with address reloading

Juul Vanderspek wrote:
In order to enable indexed loads, I extended
GO_IF_LEGITIMATE_ADDRESS to also match indexed
addresses, added a memory constraint 'R' to match
nonindexed addresses, and used R for stores in the
'mov' rule (see below).

This may be easier if you do it the other way. I.e. remove indexed addresses from GO_IF_LEGITIMATE_ADDRESS, add an 'R' constraint that only matches indexed addresses, and then use "mR" for load memory operands, and "m" for store memory operands. With a proper predicate for input_operands that accepts memory_operand plus indexed addresses, combine can create the indexed loads.

It should be possible to make your approach work. First thing is that you have to fix the predicate. You can't use nonimmediate_operand here, as this will accept invalid indexed addresses. Define your own output_operand predicate that rejects indexed addresses. It is always better to reject an operand than to rely on reload to fix it. You probably also need a mov* expander that fixes a store indexed address if one is passed in, since it is a bad idea for the mov* patterns to fail.

Another problem here is that reload knows how to fix simple things like 'm' and 'r' operands, but it doesn't know how to fix an 'R' operand. This means you either have to be careful to only accept operands that will never be reloading, or add code to reload it yourself, or add hints to help reload. The last one is the easiest option, see the EXTRA_MEMORY_CONSTRAINT documentation. If you define this, then reload will know that it can always fix an 'R' by reloading the address into a register.
Jim Wilson, GNU Tools Support,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]