Ayonam Ray <ayonam@xxxxxxxxx> writes: > I have an address (symbolicRef + indexReg * scaleFactor) that is > rejected by my TARGET_LEGITIMATE_ADDRESS_P. However, at -O2, the same > address gets recreated in the post reload CSE pass. The symbolic > reference just after the reload is in a register and the address > "register + indexReg * scaleFactor" is a valid address for my > architecture. The CSE figures out that the symbolic reference is in a > register (the notes say so) and replaces the "register + indexReg * > scaleFactor" address with "symbolicRef + indexReg * scaleFactor". > > Is there a way to prevent this from happening? Am I missing some > target definitions which is causing this? Or is it an incorrect > predicate definition? > > I get the failure in "movsi" when, after the post reload CSE, it tries > to match the constraints for that memory operand. The 'm' constraint > ends up calling the TARGET_LEGITIMATE_ADDRESS_P which returns a zero > and the constraint check fails. I'm really guessing here, but it sounds like you have an insn with an operand that uses an m constraint but for which the operand predicate accepts operands that do not meet that constraint. In general for every RTL that the operand predicate accepts you must have a constraint that can match that operand. Based on your description even general_operand ought to reject the symbolicRef address. Ian