Hi, all I am interested in how jump-table representated in DAG. I find the method visitJumpTable will Emit JumpTable node in the current MBB. visitJumpTableHeader - This function emits necessary code to produce index in the JumpTable from switch case. but how switch case emits? I would like to make this clearly. Thanks, yaoxiao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180522/1638cde1/attachment.html>
Hans Wennborg via llvm-dev
2018-May-22 10:09 UTC
[llvm-dev] How jump-table representated in DAG
Hi Yao, On Tue, May 22, 2018 at 4:30 AM, yao via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi, all > > I am interested in how jump-table representated in DAG. > I find the method visitJumpTable will Emit JumpTable node in the current > MBB. > visitJumpTableHeader - This function emits necessary code to produce index > in the JumpTable from switch case. > but how switch case emits? > > I would like to make this clearly.It sounds like you're already looking in the right places. The switch lowering starts in SelectionDAGBuilder::visitSwitch which analyses the switch and decides how to lower it. For jump tables, it calls SelectionDAGBuilder::buildJumpTable which creates and populates the JumpTable and JumpTableHeader Hope this helps, Hans