This is the mail archive of the gcc@gcc.gnu.org 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: Matching Constraints and Predicate


"Paulo J. Matos" <pocmatos@gmail.com> writes:

> However, if I have register constraints that define constraint x to
> match a certain register class X and I define predicate:
> (define_predicate "x_operand"
>     (and (match_operand 0 "register_operand")
>              (match_test "REGNO_REG_CLASS(REGNO(op)) == X")))

As you observe, this is wrong.  A pseudo-register has no register class.
You can only test the register class if you first test that you have a
hard register.

This also makes no sense.  The operand predicate should test whether the
value is acceptable.  The constraints should tell the register allocator
where the value should go.  The paragraph you quoted is saying that the
operand predicate should restrict the value as much as possible to
ensure that the constraints will match.  The paragraph is not saying
that you should test the register class of a register in the operand
predicate.

Ian


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