shding at mtu.edu
2005-Oct-17 15:38 UTC
[LLVMdev] about switch and select instructions in SparcV9
Hi: In the file of SparcV9BurgISel.cpp, you said you didn't implement the "Switch" instruction and I also can't find how the "Select" instruction is implemented. So do you do some work to handle these two kind of instructions in other parts? Where can I find it? Thank you! -- Shuhan
Chris Lattner
2005-Oct-17 16:02 UTC
[LLVMdev] about switch and select instructions in SparcV9
On Mon, 17 Oct 2005 shding at mtu.edu wrote:> Hi: > In the file of SparcV9BurgISel.cpp, you said you didn't implement the > "Switch" instruction and I also can't find how the "Select" instruction > is implemented. So do you do some work to handle these two kind of > instructions in other parts? Where can I find it? Thank you!The SparcV9 backend does not handle these natively, instead lowering them to branches. In particular, the SparcV9TargetMachine.cpp file includes this: // FIXME: implement the switch instruction in the instruction selector. PM.add(createLowerSwitchPass()); ... PM.add(createLowerSelectPass()); However, you probably shouldn't be following the example of the SparcV9 backend. Instead, I would suggest following the example of one of the targets that uses the target-independent code generator (e.g. the PowerPC backend). In particular, I just happened to update some documentation about this stuff yesterday: http://llvm.org/docs/CodeGenerator.html -Chris -- http://nondot.org/sabre/ http://llvm.org/