瀏覽代碼

Use SwitchInstruction in CFG->tree lowering

jonathanvdc 8 年之前
父節點
當前提交
a8f5f3434b
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      kernel/modelverse_jit/cfg_to_tree.py

+ 4 - 5
kernel/modelverse_jit/cfg_to_tree.py

@@ -83,16 +83,15 @@ class MultipleBlock(object):
 
     def lower_handled_blocks(self, state):
         """Lowers the handled blocks of this 'multiple' block to a tree."""
-        result = tree_ir.EmptyInstruction()
+        cond_clause_pairs = []
         for entry, block in self.handled_blocks:
-            result = tree_ir.SelectInstruction(
+            cond_clause_pairs.append((
                 tree_ir.BinaryInstruction(
                     tree_ir.LoadLocalInstruction(state.label_variable),
                     '==',
                     tree_ir.LiteralInstruction(entry.index)),
-                block.lower(state),
-                result)
-        return result
+                block.lower(state)))
+        return tree_ir.SwitchInstruction(cond_clause_pairs)
 
     def lower(self, state):
         """Lowers this 'multiple' block to a tree."""