[LLVMdev] about switch and select instructions in SparcV9

Chris Lattner sabre at nondot.org
Mon Oct 17 09:02:33 PDT 2005


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/




More information about the llvm-dev mailing list