[llvm-dev] Operand does not exist in operand list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Operand does not exist in operand list

韩玉 via llvm-dev

Hi,

Absolute LLVM newbie here. I am trying to define an add instruction which takes 2 register inputs ra and rb and writes the sum into ra.


def ADDR : F_R<0b000000,(outs) , (ins CPURegs:$rb, CPURegs:$ra),"ADDR $ra, $rb",[(set CPURegs:$ra, (add CPURegs:$ra, CPURegs:$rb))] >;


I get this error:
error: In ADDR: Operand $rb does not exist in operand list!


Does anybody know what that means?

Thanks.


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Operand does not exist in operand list

韩玉 via llvm-dev
You need a register in the outs list too. To inform everything that your instruction produces an output. And it needs to be a different name than $ra and $rb. So let's say $rd for destination. You need to do this:

let Constraints = "$ra = $rd"
def ADDR : F_R<0b000000,(outs CPURegs:$rd) , (ins CPURegs:$rb, CPURegs:$ra),"ADDR $ra, $rb",[(set CPURegs:$rd, (add CPURegs:$ra, CPURegs:$rb))] >;  

The Constraints line will tell the register allocation system that $ra and $rd should always be the same physical register.


~Craig


On Tue, Oct 16, 2018 at 5:30 PM m m via llvm-dev <[hidden email]> wrote:

Hi,

Absolute LLVM newbie here. I am trying to define an add instruction which takes 2 register inputs ra and rb and writes the sum into ra.


def ADDR : F_R<0b000000,(outs) , (ins CPURegs:$rb, CPURegs:$ra),"ADDR $ra, $rb",[(set CPURegs:$ra, (add CPURegs:$ra, CPURegs:$rb))] >;


I get this error:
error: In ADDR: Operand $rb does not exist in operand list!


Does anybody know what that means?

Thanks.

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev