Dummy questions on GCC internals

DJ Delorie dj@redhat.com
Wed May 21 19:14:00 GMT 2003


> 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.



More information about the Gcc mailing list