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

Evan Cheng evan.cheng at apple.com
Fri Mar 2 18:01:25 PST 2007


Yes, please use operand constraint instead (see class Instruction,  
field Constraints in Target.td). isTwoAddress is left in only because  
I am too lazy to convert all the existing patterns to operand  
constraint.

In this example, the constraint would look like "$src = $dst". ARM  
has some examples if you are interested.

Evan

On Mar 1, 2007, at 11:04 AM, Chris Lattner wrote:

> 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/
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list