Hello,

I am quite confused with the following from the internals:
; Operand predicates can allow operands that are not actually
; acceptable to the hardware, as long as the constraints give
; reload the ability to fix them up (see Constraints). However,
; GCC will usually generate better code if the predicates specify
; the requirements of the machine instructions as closely as
; possible. Reload cannot fix up operands that must be
; constants (immediate operands); you must use a predicate that
; allows only constants, or else enforce the requirement in the
; extra condition.

This seems to imply that if the predicates specify the same
requirements of constraints, then resulting code if better.

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")))

and then I have a match_operand on an insn (match_operand 0
"x_operand" "x") this is quite disastrous as gcc promptly stops since
any pseudo-register during will fail the predicate and no rule will
not be matched.
It feels like I should say in the predicate something like: it's
either a pseudo, or a register from X.

What am I misinterpreting?

Cheers,

-- 
PMatos

Reply via email to