[LLVMdev] ISel using an operand as both source and destination

Chris Lattner sabre at nondot.org
Thu Mar 1 11:04:35 PST 2007


On Thu, 1 Mar 2007, Christopher Lamb wrote:
> I see in the x86 InstInfo.td the following for the INC instructions:
>
> def INC8r  : I<0xFE, MRM0r, (ops GR8 :$dst, GR8 :$src), "inc{b} $dst",
>                [(set GR8:$dst, (add GR8:$src, 1))]>;
>
> Which seem to have the same restriction that I'm trying to implement,
> but I don't understand how this ensures that $src and $dst are the
> same register.

The trick is that it's nested in this block:

let isTwoAddress = 1 in {
...

Marking an instruction 'two address' tells the codegen that the first two 
registers must be constrained to be the same physreg.  There is a more 
general mechanism wih constraints you can also use.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list