<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>There is also the LowerSwitch pass that converts switch instructions to a sequence of branches. </div><br><div><div>On May 6, 2013, at 1:24 PM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">I mean an llvm Pass that transforms switch statements into if statements. For example, if I have code with switch statements then running the pass will convert all switches to ifs in the bytecode.<div><br></div><div>George</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 6, 2013 at 4:20 PM, Hal Finkel<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="HOEnZb"><div class="h5">----- Original Message -----<br>> From: "George Baah" <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>><br>> To: "LLVM Developers Mailing List" <<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>><br>> Sent: Monday, May 6, 2013 3:09:33 PM<br>> Subject: [LLVMdev] convert switch stmts to If statements<br>><br>><br>><br>><br>> Hi All, Is there a pass in llvm that converts switch statements to if<br>> statements?<br>><br><br></div></div>What do you mean by convert? SelectionDAGBuilder::visitSwitch in lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp converts the switch statements for code generation either into indirect jump tables or into binary-search trees (which I suppose you could call if statements).<br><br> -Hal<br><br>><br>> George<br>> _______________________________________________<br>> LLVM Developers mailing list<br>><span class="Apple-converted-space"> </span><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>       <span class="Apple-converted-space"> </span><a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>><span class="Apple-converted-space"> </span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>><br></blockquote></div><br></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div><br></body></html>