PR target/21299 (reload accepting invalid asm)
Richard Sandiford
richard@codesourcery.com
Thu Aug 10 09:52:00 GMT 2006
Ian Lance Taylor <iant@google.com> writes:
> Richard Sandiford <richard@codesourcery.com> writes:
>> Ian Lance Taylor <iant@google.com> writes:
>> > Richard Sandiford <richard@codesourcery.com> writes:
>> >> I think we need to clarify what it means to have several register
>> >> classes in the same alternative. Which interpretation is right?
>> >> constrain_operands(), or find_reloads() and preprocess_constraints()?
>> >
>> > Thanks for helping to clarify the issue. As I noted in my earlier
>> > reply, I believe that both interpretations are right, because MD file
>> > writers are required to follow rules such that both are right.
>>
>> Wasn't sure whether to reply to that message or this one, but...
>>
>> I think that message missed the point. At least it misses the point of
>> what I was trying to say in my reply. What happens if you have constraints
>> for two register classes C1 and C2, and a union C1+C2? Must a register
>> belong to either C1 or C2, or may it straddle both? constrain_operands()
>> does not allow it to straddle both classes, but find_reloads() and
>> preprocess_constraints() do.
>
> I believe that an MD file for which this question arises is buggy.
>
> It can only arise if you use a value which requires multiple
> registers, and you put multiple register class constraints in a single
> alternative, and it is possible, due to register numbering and the
> definition of HARD_REGNO_MODE_OK, for the multiple registers to cross
> from one register class to another.
Right. I was thinking of cases where we define classes for a subset
of a logical register bank. Something like Q_REGS for x86. If you
mix those classes together, HARD_REGNO_MODE_OK may not necessarily
force the register to be in one class or the other.
> I see no reason that we ever need to support this case. Therefore,
> the MD file is buggy. You should fix HARD_REGNO_MODE_OK, or you
> should separate the constraints into two separate alternatives, or you
> should use the union class.
I'm happy with that. But I was trying to pin down what the rules were
so that we can enforce those same rules for user asms. So if that's
the rule, then I think we should be checking something like:
"Two register class constraints may not be used in the same
alternative for a value of mode M if the backend allows values
of mode M to be stored in a register that straddles both classes."
Hopefully that's a more general fix than the ones suggested so far.
Richard
More information about the Gcc-patches
mailing list