A question about define_insn and force-reg

Paolo Bonzini bonzini@gnu.org
Wed Oct 26 16:11:00 GMT 2005


> Thanks. It seems work now. But... when I define the like insn for QImode,
> (define_insn "loadqi_men"
>   [(set (match_operand:QI 0 "register_operand" "=r")
>   	(mem:QI (match_operand:SI 1 "general_operand" "r")))]
>   ""
>   "lbu.u\t%0,0(%1)"
>   )
> 
>  The compiler comes out such error,
>  error: insn does not satisfy its constraints
>   (insn 349 53 46 4 ../../gcc-3.4.4/gcc/unwind-pe.h:212 (set (reg:QI 1 $1)
>         (mem/s:QI (plus:SI (reg/v/f:SI 9 $9 [orig:154 p ] [154])
>                 (const_int 1 [0x1])) [12 S1 A8])) 45 {} (nil)
>     (nil))
> 
>  Well, it seems not work.

Then it's not really that you have registers.  You wanted to use a 
register, but (of course) you have more addressing modes than that.

(mem:QI (match_operand:QI 1 "address_operand" "p"))) will do the trick. 
  You could have searched the gccint documentation for "Constraints" and 
you would have found this:

      An operand that is a valid memory address is allowed.  This is for
      "load address" and "push address" instructions.

      `p' in the constraint must be accompanied by `address_operand' as
      the predicate in the `match_operand'.  This predicate interprets
      the mode specified in the `match_operand' as the mode of the memory
      reference for which the address would be valid.

(Note I have match_operand:QI).

Or you could have grepped a small .md file for "(mem:QI" and see how it 
behaves.

Paolo



More information about the Gcc mailing list