This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Dummy questions on GCC internals
> One more question: what's meant under the "insn does not satisfy its
> constraints"? I have addhi3 defined as:
>
> (define_insn "addhi3"
> [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r")
The important thing to realize is that the predicate determines what
types of operands gcc will give to this insn, and the constraints do
*not*. Thus, it is critically important that every type of operand
that the predicate allows be able to match at least one of the
constraints, or at least that the predicate reject any operand that
won't match any of the constraints.
In this case, a nonimmediate_operand allows memory references, which
do not match the "r" constraint. You probably need a register_operand
predicate instead.
Note that you'll find yourself writing lots of target-specific (and
often insn-specific) predicates eventually.