summaryrefslogtreecommitdiff
path: root/vaporize
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize')
-rw-r--r--vaporize/tests/BinaryTree.names.vaporm996
-rw-r--r--vaporize/tests/BinaryTree.opt.names.vaporm797
-rw-r--r--vaporize/tests/BinaryTree.opt.regalloc451
-rw-r--r--vaporize/tests/BinaryTree.opt.vaporm797
-rw-r--r--vaporize/tests/BinaryTree.regalloc703
-rw-r--r--vaporize/tests/BinaryTree.vaporm996
-rw-r--r--vaporize/tests/BubbleSort.names.vaporm316
-rw-r--r--vaporize/tests/BubbleSort.opt.names.vaporm301
-rw-r--r--vaporize/tests/BubbleSort.opt.regalloc230
-rw-r--r--vaporize/tests/BubbleSort.opt.vaporm301
-rw-r--r--vaporize/tests/BubbleSort.regalloc245
-rw-r--r--vaporize/tests/BubbleSort.vaporm316
-rw-r--r--vaporize/tests/Factorial.names.vaporm40
-rw-r--r--vaporize/tests/Factorial.opt.names.vaporm30
-rw-r--r--vaporize/tests/Factorial.opt.regalloc33
-rw-r--r--vaporize/tests/Factorial.opt.vaporm30
-rw-r--r--vaporize/tests/Factorial.regalloc42
-rw-r--r--vaporize/tests/Factorial.vaporm40
-rw-r--r--vaporize/tests/LinearSearch.names.vaporm182
-rw-r--r--vaporize/tests/LinearSearch.opt.names.vaporm162
-rw-r--r--vaporize/tests/LinearSearch.opt.regalloc169
-rw-r--r--vaporize/tests/LinearSearch.opt.vaporm162
-rw-r--r--vaporize/tests/LinearSearch.regalloc193
-rw-r--r--vaporize/tests/LinearSearch.vaporm182
-rw-r--r--vaporize/tests/LinkedList.names.vaporm698
-rw-r--r--vaporize/tests/LinkedList.opt.names.vaporm562
-rw-r--r--vaporize/tests/LinkedList.opt.regalloc362
-rw-r--r--vaporize/tests/LinkedList.opt.vaporm562
-rw-r--r--vaporize/tests/LinkedList.regalloc539
-rw-r--r--vaporize/tests/LinkedList.vaporm698
-rw-r--r--vaporize/tests/MoreThan4.names.vaporm68
-rw-r--r--vaporize/tests/MoreThan4.opt.names.vaporm57
-rw-r--r--vaporize/tests/MoreThan4.opt.regalloc64
-rw-r--r--vaporize/tests/MoreThan4.opt.vaporm57
-rw-r--r--vaporize/tests/MoreThan4.regalloc73
-rw-r--r--vaporize/tests/MoreThan4.vaporm68
-rw-r--r--vaporize/tests/QuickSort.names.vaporm439
-rw-r--r--vaporize/tests/QuickSort.opt.names.vaporm418
-rw-r--r--vaporize/tests/QuickSort.opt.regalloc286
-rw-r--r--vaporize/tests/QuickSort.opt.vaporm418
-rw-r--r--vaporize/tests/QuickSort.regalloc313
-rw-r--r--vaporize/tests/QuickSort.vaporm439
-rw-r--r--vaporize/tests/TreeVisitor.names.vaporm1174
-rw-r--r--vaporize/tests/TreeVisitor.opt.names.vaporm948
-rw-r--r--vaporize/tests/TreeVisitor.opt.regalloc539
-rw-r--r--vaporize/tests/TreeVisitor.opt.vaporm948
-rw-r--r--vaporize/tests/TreeVisitor.regalloc830
-rw-r--r--vaporize/tests/TreeVisitor.vaporm1174
48 files changed, 19448 insertions, 0 deletions
diff --git a/vaporize/tests/BinaryTree.names.vaporm b/vaporize/tests/BinaryTree.names.vaporm
new file mode 100644
index 0000000..e5785ee
--- /dev/null
+++ b/vaporize/tests/BinaryTree.names.vaporm
@@ -0,0 +1,996 @@
+const vmt_BT
+ :BT.Start
+
+const vmt_Tree
+ :Tree.Init
+ :Tree.SetRight
+ :Tree.SetLeft
+ :Tree.GetRight
+ :Tree.GetLeft
+ :Tree.GetKey
+ :Tree.SetKey
+ :Tree.GetHas_Right
+ :Tree.GetHas_Left
+ :Tree.SetHas_Left
+ :Tree.SetHas_Right
+ :Tree.Compare
+ :Tree.Insert
+ :Tree.Delete
+ :Tree.Remove
+ :Tree.RemoveRight
+ :Tree.RemoveLeft
+ :Tree.Search
+ :Tree.Print
+ :Tree.RecPrint
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(4)
+ [$t0{t.0}] = :vmt_BT
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func BT.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{t.0} = HeapAllocZ(28)
+ [$t0{t.0}] = :vmt_Tree
+ $s0{root} = $t0{t.0}
+ if $s0{root} goto :null2
+ Error("null pointer")
+null2:
+ $t0{t.1} = [$s0{root}]
+ $t0{t.1} = [$t0{t.1}]
+ $a0 = $s0{root}
+ $a1 = 16
+ call $t0{t.1}
+ if $s0{root} goto :null3
+ Error("null pointer")
+null3:
+ $t0{t.2} = [$s0{root}]
+ $t0{t.2} = [$t0{t.2}+72]
+ $a0 = $s0{root}
+ call $t0{t.2}
+ PrintIntS(100000000)
+ if $s0{root} goto :null4
+ Error("null pointer")
+null4:
+ $t0{t.3} = [$s0{root}]
+ $t0{t.3} = [$t0{t.3}+48]
+ $a0 = $s0{root}
+ $a1 = 8
+ call $t0{t.3}
+ if $s0{root} goto :null5
+ Error("null pointer")
+null5:
+ $t0{t.4} = [$s0{root}]
+ $t0{t.4} = [$t0{t.4}+72]
+ $a0 = $s0{root}
+ call $t0{t.4}
+ if $s0{root} goto :null6
+ Error("null pointer")
+null6:
+ $t0{t.5} = [$s0{root}]
+ $t0{t.5} = [$t0{t.5}+48]
+ $a0 = $s0{root}
+ $a1 = 24
+ call $t0{t.5}
+ if $s0{root} goto :null7
+ Error("null pointer")
+null7:
+ $t0{t.6} = [$s0{root}]
+ $t0{t.6} = [$t0{t.6}+48]
+ $a0 = $s0{root}
+ $a1 = 4
+ call $t0{t.6}
+ if $s0{root} goto :null8
+ Error("null pointer")
+null8:
+ $t0{t.7} = [$s0{root}]
+ $t0{t.7} = [$t0{t.7}+48]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.7}
+ if $s0{root} goto :null9
+ Error("null pointer")
+null9:
+ $t0{t.8} = [$s0{root}]
+ $t0{t.8} = [$t0{t.8}+48]
+ $a0 = $s0{root}
+ $a1 = 20
+ call $t0{t.8}
+ if $s0{root} goto :null10
+ Error("null pointer")
+null10:
+ $t0{t.9} = [$s0{root}]
+ $t0{t.9} = [$t0{t.9}+48]
+ $a0 = $s0{root}
+ $a1 = 28
+ call $t0{t.9}
+ if $s0{root} goto :null11
+ Error("null pointer")
+null11:
+ $t0{t.10} = [$s0{root}]
+ $t0{t.10} = [$t0{t.10}+48]
+ $a0 = $s0{root}
+ $a1 = 14
+ call $t0{t.10}
+ if $s0{root} goto :null12
+ Error("null pointer")
+null12:
+ $t0{t.11} = [$s0{root}]
+ $t0{t.11} = [$t0{t.11}+72]
+ $a0 = $s0{root}
+ call $t0{t.11}
+ if $s0{root} goto :null13
+ Error("null pointer")
+null13:
+ $t0{t.12} = [$s0{root}]
+ $t0{t.12} = [$t0{t.12}+68]
+ $a0 = $s0{root}
+ $a1 = 24
+ call $t0{t.12}
+ $t0{t.13} = $v0
+ PrintIntS($t0{t.13})
+ if $s0{root} goto :null14
+ Error("null pointer")
+null14:
+ $t0{t.14} = [$s0{root}]
+ $t0{t.14} = [$t0{t.14}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.14}
+ $t0{t.15} = $v0
+ PrintIntS($t0{t.15})
+ if $s0{root} goto :null15
+ Error("null pointer")
+null15:
+ $t0{t.16} = [$s0{root}]
+ $t0{t.16} = [$t0{t.16}+68]
+ $a0 = $s0{root}
+ $a1 = 16
+ call $t0{t.16}
+ $t0{t.17} = $v0
+ PrintIntS($t0{t.17})
+ if $s0{root} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.18} = [$s0{root}]
+ $t0{t.18} = [$t0{t.18}+68]
+ $a0 = $s0{root}
+ $a1 = 50
+ call $t0{t.18}
+ $t0{t.19} = $v0
+ PrintIntS($t0{t.19})
+ if $s0{root} goto :null17
+ Error("null pointer")
+null17:
+ $t0{t.20} = [$s0{root}]
+ $t0{t.20} = [$t0{t.20}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.20}
+ $t0{t.21} = $v0
+ PrintIntS($t0{t.21})
+ if $s0{root} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.22} = [$s0{root}]
+ $t0{t.22} = [$t0{t.22}+52]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.22}
+ if $s0{root} goto :null19
+ Error("null pointer")
+null19:
+ $t0{t.23} = [$s0{root}]
+ $t0{t.23} = [$t0{t.23}+72]
+ $a0 = $s0{root}
+ call $t0{t.23}
+ if $s0{root} goto :null20
+ Error("null pointer")
+null20:
+ $t0{t.24} = [$s0{root}]
+ $t0{t.24} = [$t0{t.24}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.24}
+ $t0{t.25} = $v0
+ PrintIntS($t0{t.25})
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+12] = $t1{v_key}
+ [$t0{this}+16] = 0
+ [$t0{this}+20] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{rn} = $a1
+ [$t0{this}+8] = $t1{rn}
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{ln} = $a1
+ [$t0{this}+4] = $t1{ln}
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+12] = $t1{v_key}
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+20]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+16]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+16] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+20] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{nti} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if1_else
+ $t1{ntb} = 0
+ goto :if1_end
+if1_else:
+ $t2{t.1} = LtS($t0{num1} $t2{nti})
+ $t2{t.2} = Sub(1 $t2{t.1})
+ if0 $t2{t.2} goto :if2_else
+ $t1{ntb} = 0
+ goto :if2_end
+if2_else:
+ $t1{ntb} = 1
+if2_end:
+if1_end:
+ $v0 = $t1{ntb}
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $t0{t.0} = HeapAllocZ(28)
+ [$t0{t.0}] = :vmt_Tree
+ $s2{new_node} = $t0{t.0}
+ if $s2{new_node} goto :null21
+ Error("null pointer")
+null21:
+ $t0{t.1} = [$s2{new_node}]
+ $t0{t.1} = [$t0{t.1}]
+ $a0 = $s2{new_node}
+ $a1 = $s1{v_key}
+ call $t0{t.1}
+ $s0{current_node} = $s0{this}
+ $s3{cont} = 1
+while1_top:
+ if0 $s3{cont} goto :while1_end
+ if $s0{current_node} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.2} = [$s0{current_node}]
+ $t0{t.2} = [$t0{t.2}+20]
+ $a0 = $s0{current_node}
+ call $t0{t.2}
+ $t0{key_aux} = $v0
+ $t0{t.3} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t0{t.3} goto :if3_else
+ if $s0{current_node} goto :null23
+ Error("null pointer")
+null23:
+ $t0{t.4} = [$s0{current_node}]
+ $t0{t.4} = [$t0{t.4}+32]
+ $a0 = $s0{current_node}
+ call $t0{t.4}
+ $t0{t.5} = $v0
+ if0 $t0{t.5} goto :if4_else
+ if $s0{current_node} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.6} = [$s0{current_node}]
+ $t0{t.6} = [$t0{t.6}+16]
+ $a0 = $s0{current_node}
+ call $t0{t.6}
+ $s0{current_node} = $v0
+ goto :if4_end
+if4_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null25
+ Error("null pointer")
+null25:
+ $t0{t.7} = [$s0{current_node}]
+ $t0{t.7} = [$t0{t.7}+36]
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call $t0{t.7}
+ if $s0{current_node} goto :null26
+ Error("null pointer")
+null26:
+ $t0{t.8} = [$s0{current_node}]
+ $t0{t.8} = [$t0{t.8}+8]
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call $t0{t.8}
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0{current_node} goto :null27
+ Error("null pointer")
+null27:
+ $t0{t.9} = [$s0{current_node}]
+ $t0{t.9} = [$t0{t.9}+28]
+ $a0 = $s0{current_node}
+ call $t0{t.9}
+ $t0{t.10} = $v0
+ if0 $t0{t.10} goto :if5_else
+ if $s0{current_node} goto :null28
+ Error("null pointer")
+null28:
+ $t0{t.11} = [$s0{current_node}]
+ $t0{t.11} = [$t0{t.11}+12]
+ $a0 = $s0{current_node}
+ call $t0{t.11}
+ $s0{current_node} = $v0
+ goto :if5_end
+if5_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null29
+ Error("null pointer")
+null29:
+ $t0{t.12} = [$s0{current_node}]
+ $t0{t.12} = [$t0{t.12}+40]
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call $t0{t.12}
+ if $s0{current_node} goto :null30
+ Error("null pointer")
+null30:
+ $t0{t.13} = [$s0{current_node}]
+ $t0{t.13} = [$t0{t.13}+4]
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call $t0{t.13}
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{current_node} = $s0{this}
+ $s3{parent_node} = $s0{this}
+ $s4{cont} = 1
+ $s5{found} = 0
+ $s6{is_root} = 1
+while2_top:
+ if0 $s4{cont} goto :while2_end
+ if $s2{current_node} goto :null31
+ Error("null pointer")
+null31:
+ $t0{t.0} = [$s2{current_node}]
+ $t0{t.0} = [$t0{t.0}+20]
+ $a0 = $s2{current_node}
+ call $t0{t.0}
+ $t0{key_aux} = $v0
+ $t1{t.1} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t1{t.1} goto :if6_else
+ if $s2{current_node} goto :null32
+ Error("null pointer")
+null32:
+ $t1{t.2} = [$s2{current_node}]
+ $t1{t.2} = [$t1{t.2}+32]
+ $a0 = $s2{current_node}
+ call $t1{t.2}
+ $t1{t.3} = $v0
+ if0 $t1{t.3} goto :if7_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null33
+ Error("null pointer")
+null33:
+ $t1{t.4} = [$s2{current_node}]
+ $t1{t.4} = [$t1{t.4}+16]
+ $a0 = $s2{current_node}
+ call $t1{t.4}
+ $s2{current_node} = $v0
+ goto :if7_end
+if7_else:
+ $s4{cont} = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0{t.5} = LtS($t0{key_aux} $s1{v_key})
+ if0 $t0{t.5} goto :if8_else
+ if $s2{current_node} goto :null34
+ Error("null pointer")
+null34:
+ $t0{t.6} = [$s2{current_node}]
+ $t0{t.6} = [$t0{t.6}+28]
+ $a0 = $s2{current_node}
+ call $t0{t.6}
+ $t0{t.7} = $v0
+ if0 $t0{t.7} goto :if9_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null35
+ Error("null pointer")
+null35:
+ $t0{t.8} = [$s2{current_node}]
+ $t0{t.8} = [$t0{t.8}+12]
+ $a0 = $s2{current_node}
+ call $t0{t.8}
+ $s2{current_node} = $v0
+ goto :if9_end
+if9_else:
+ $s4{cont} = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6{is_root} goto :if10_else
+ if $s2{current_node} goto :null36
+ Error("null pointer")
+null36:
+ $t0{t.10} = [$s2{current_node}]
+ $t0{t.10} = [$t0{t.10}+28]
+ $a0 = $s2{current_node}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ $t0{t.12} = Sub(1 $t0{t.11})
+ if0 $t0{t.12} goto :ss1_else
+ if $s2{current_node} goto :null37
+ Error("null pointer")
+null37:
+ $t0{t.13} = [$s2{current_node}]
+ $t0{t.13} = [$t0{t.13}+32]
+ $a0 = $s2{current_node}
+ call $t0{t.13}
+ $t0{t.14} = $v0
+ $t0{t.9} = Sub(1 $t0{t.14})
+ goto :ss1_end
+ss1_else:
+ $t0{t.9} = 0
+ss1_end:
+ if0 $t0{t.9} goto :if11_else
+ goto :if11_end
+if11_else:
+ $t0{t.15} = [$s0{this}]
+ $t0{t.15} = [$t0{t.15}+56]
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call $t0{t.15}
+if11_end:
+ goto :if10_end
+if10_else:
+ $t0{t.16} = [$s0{this}]
+ $t0{t.16} = [$t0{t.16}+56]
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call $t0{t.16}
+if10_end:
+ $s5{found} = 1
+ $s4{cont} = 0
+if8_end:
+if6_end:
+ $s6{is_root} = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5{found}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+ if $s2{c_node} goto :null38
+ Error("null pointer")
+null38:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if12_else
+ $t0{t.2} = [$s0{this}]
+ $t0{t.2} = [$t0{t.2}+64]
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call $t0{t.2}
+ goto :if12_end
+if12_else:
+ if $s2{c_node} goto :null39
+ Error("null pointer")
+null39:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+28]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if0 $t0{t.4} goto :if13_else
+ $t0{t.5} = [$s0{this}]
+ $t0{t.5} = [$t0{t.5}+60]
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call $t0{t.5}
+ goto :if13_end
+if13_else:
+ if $s2{c_node} goto :null40
+ Error("null pointer")
+null40:
+ $t0{t.6} = [$s2{c_node}]
+ $t0{t.6} = [$t0{t.6}+20]
+ $a0 = $s2{c_node}
+ call $t0{t.6}
+ $s2{auxkey1} = $v0
+ if $s1{p_node} goto :null41
+ Error("null pointer")
+null41:
+ $t0{t.7} = [$s1{p_node}]
+ $t0{t.7} = [$t0{t.7}+16]
+ $a0 = $s1{p_node}
+ call $t0{t.7}
+ $t0{t.8} = $v0
+ if $t0{t.8} goto :null42
+ Error("null pointer")
+null42:
+ $t1{t.9} = [$t0{t.8}]
+ $t1{t.9} = [$t1{t.9}+20]
+ $a0 = $t0{t.8}
+ call $t1{t.9}
+ $t1{auxkey2} = $v0
+ $t0{t.10} = [$s0{this}]
+ $t0{t.10} = [$t0{t.10}+44]
+ $a0 = $s0{this}
+ $a1 = $s2{auxkey1}
+ $a2 = $t1{auxkey2}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ if0 $t0{t.11} goto :if14_else
+ if $s1{p_node} goto :null43
+ Error("null pointer")
+null43:
+ $t0{t.12} = [$s1{p_node}]
+ $t0{t.12} = [$t0{t.12}+8]
+ $t1{t.13} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t1{t.13}
+ call $t0{t.12}
+ if $s1{p_node} goto :null44
+ Error("null pointer")
+null44:
+ $t1{t.14} = [$s1{p_node}]
+ $t1{t.14} = [$t1{t.14}+36]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t1{t.14}
+ goto :if14_end
+if14_else:
+ if $s1{p_node} goto :null45
+ Error("null pointer")
+null45:
+ $t1{t.15} = [$s1{p_node}]
+ $t1{t.15} = [$t1{t.15}+4]
+ $t0{t.16} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.16}
+ call $t1{t.15}
+ if $s1{p_node} goto :null46
+ Error("null pointer")
+null46:
+ $t0{t.17} = [$s1{p_node}]
+ $t0{t.17} = [$t0{t.17}+40]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.17}
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while3_top:
+ if $s2{c_node} goto :null47
+ Error("null pointer")
+null47:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+28]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :while3_end
+ if $s2{c_node} goto :null48
+ Error("null pointer")
+null48:
+ $s3{t.2} = [$s2{c_node}]
+ $s3{t.2} = [$s3{t.2}+24]
+ if $s2{c_node} goto :null49
+ Error("null pointer")
+null49:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+12]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :null50
+ Error("null pointer")
+null50:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+20]
+ $a0 = $t0{t.4}
+ call $t1{t.5}
+ $t1{t.6} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t1{t.6}
+ call $s3{t.2}
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null51
+ Error("null pointer")
+null51:
+ $t1{t.7} = [$s2{c_node}]
+ $t1{t.7} = [$t1{t.7}+12]
+ $a0 = $s2{c_node}
+ call $t1{t.7}
+ $s2{c_node} = $v0
+ goto :while3_top
+while3_end:
+ if $s1{p_node} goto :null52
+ Error("null pointer")
+null52:
+ $t1{t.8} = [$s1{p_node}]
+ $t1{t.8} = [$t1{t.8}+4]
+ $t0{t.9} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.9}
+ call $t1{t.8}
+ if $s1{p_node} goto :null53
+ Error("null pointer")
+null53:
+ $t0{t.10} = [$s1{p_node}]
+ $t0{t.10} = [$t0{t.10}+40]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.10}
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while4_top:
+ if $s2{c_node} goto :null54
+ Error("null pointer")
+null54:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :while4_end
+ if $s2{c_node} goto :null55
+ Error("null pointer")
+null55:
+ $s3{t.2} = [$s2{c_node}]
+ $s3{t.2} = [$s3{t.2}+24]
+ if $s2{c_node} goto :null56
+ Error("null pointer")
+null56:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+16]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :null57
+ Error("null pointer")
+null57:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+20]
+ $a0 = $t0{t.4}
+ call $t1{t.5}
+ $t1{t.6} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t1{t.6}
+ call $s3{t.2}
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null58
+ Error("null pointer")
+null58:
+ $t1{t.7} = [$s2{c_node}]
+ $t1{t.7} = [$t1{t.7}+16]
+ $a0 = $s2{c_node}
+ call $t1{t.7}
+ $s2{c_node} = $v0
+ goto :while4_top
+while4_end:
+ if $s1{p_node} goto :null59
+ Error("null pointer")
+null59:
+ $t1{t.8} = [$s1{p_node}]
+ $t1{t.8} = [$t1{t.8}+8]
+ $t0{t.9} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.9}
+ call $t1{t.8}
+ if $s1{p_node} goto :null60
+ Error("null pointer")
+null60:
+ $t0{t.10} = [$s1{p_node}]
+ $t0{t.10} = [$t0{t.10}+36]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.10}
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{v_key} = $a1
+ $s1{current_node} = $t0{this}
+ $s2{cont} = 1
+ $s3{ifound} = 0
+while5_top:
+ if0 $s2{cont} goto :while5_end
+ if $s1{current_node} goto :null61
+ Error("null pointer")
+null61:
+ $t0{t.0} = [$s1{current_node}]
+ $t0{t.0} = [$t0{t.0}+20]
+ $a0 = $s1{current_node}
+ call $t0{t.0}
+ $t0{key_aux} = $v0
+ $t1{t.1} = LtS($s0{v_key} $t0{key_aux})
+ if0 $t1{t.1} goto :if15_else
+ if $s1{current_node} goto :null62
+ Error("null pointer")
+null62:
+ $t1{t.2} = [$s1{current_node}]
+ $t1{t.2} = [$t1{t.2}+32]
+ $a0 = $s1{current_node}
+ call $t1{t.2}
+ $t1{t.3} = $v0
+ if0 $t1{t.3} goto :if16_else
+ if $s1{current_node} goto :null63
+ Error("null pointer")
+null63:
+ $t1{t.4} = [$s1{current_node}]
+ $t1{t.4} = [$t1{t.4}+16]
+ $a0 = $s1{current_node}
+ call $t1{t.4}
+ $s1{current_node} = $v0
+ goto :if16_end
+if16_else:
+ $s2{cont} = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0{t.5} = LtS($t0{key_aux} $s0{v_key})
+ if0 $t0{t.5} goto :if17_else
+ if $s1{current_node} goto :null64
+ Error("null pointer")
+null64:
+ $t0{t.6} = [$s1{current_node}]
+ $t0{t.6} = [$t0{t.6}+28]
+ $a0 = $s1{current_node}
+ call $t0{t.6}
+ $t0{t.7} = $v0
+ if0 $t0{t.7} goto :if18_else
+ if $s1{current_node} goto :null65
+ Error("null pointer")
+null65:
+ $t0{t.8} = [$s1{current_node}]
+ $t0{t.8} = [$t0{t.8}+12]
+ $a0 = $s1{current_node}
+ call $t0{t.8}
+ $s1{current_node} = $v0
+ goto :if18_end
+if18_else:
+ $s2{cont} = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3{ifound} = 1
+ $s2{cont} = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3{ifound}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{current_node} = $t0{this}
+ $t2{t.0} = [$t0{this}]
+ $t2{t.0} = [$t2{t.0}+76]
+ $a0 = $t0{this}
+ $a1 = $t1{current_node}
+ call $t2{t.0}
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{node} = $a1
+ if $s1{node} goto :null66
+ Error("null pointer")
+null66:
+ $t0{t.0} = [$s1{node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s1{node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if19_else
+ $s2{t.2} = [$s0{this}]
+ $s2{t.2} = [$s2{t.2}+76]
+ if $s1{node} goto :null67
+ Error("null pointer")
+null67:
+ $t0{t.3} = [$s1{node}]
+ $t0{t.3} = [$t0{t.3}+16]
+ $a0 = $s1{node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.4}
+ call $s2{t.2}
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1{node} goto :null68
+ Error("null pointer")
+null68:
+ $t0{t.5} = [$s1{node}]
+ $t0{t.5} = [$t0{t.5}+20]
+ $a0 = $s1{node}
+ call $t0{t.5}
+ $t0{t.6} = $v0
+ PrintIntS($t0{t.6})
+ if $s1{node} goto :null69
+ Error("null pointer")
+null69:
+ $t0{t.7} = [$s1{node}]
+ $t0{t.7} = [$t0{t.7}+28]
+ $a0 = $s1{node}
+ call $t0{t.7}
+ $t0{t.8} = $v0
+ if0 $t0{t.8} goto :if20_else
+ $s2{t.9} = [$s0{this}]
+ $s2{t.9} = [$s2{t.9}+76]
+ if $s1{node} goto :null70
+ Error("null pointer")
+null70:
+ $t0{t.10} = [$s1{node}]
+ $t0{t.10} = [$t0{t.10}+12]
+ $a0 = $s1{node}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.11}
+ call $s2{t.9}
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
diff --git a/vaporize/tests/BinaryTree.opt.names.vaporm b/vaporize/tests/BinaryTree.opt.names.vaporm
new file mode 100644
index 0000000..fa61f97
--- /dev/null
+++ b/vaporize/tests/BinaryTree.opt.names.vaporm
@@ -0,0 +1,797 @@
+const empty_BT
+
+const empty_Tree
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_BT
+ call :BT.Start
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func BT.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{root} = HeapAllocZ(24)
+ if $s0{root} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s0{root}
+ $a1 = 16
+ call :Tree.Init
+ if $s0{root} goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s0{root}
+ call :Tree.Print
+ PrintIntS(100000000)
+ if $s0{root} goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s0{root}
+ $a1 = 8
+ call :Tree.Insert
+ if $s0{root} goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s0{root}
+ call :Tree.Print
+ if $s0{root} goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0{root}
+ $a1 = 24
+ call :Tree.Insert
+ if $s0{root} goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0{root}
+ $a1 = 4
+ call :Tree.Insert
+ if $s0{root} goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Insert
+ if $s0{root} goto :null8
+ Error("null pointer")
+null8:
+ $a0 = $s0{root}
+ $a1 = 20
+ call :Tree.Insert
+ if $s0{root} goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s0{root}
+ $a1 = 28
+ call :Tree.Insert
+ if $s0{root} goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s0{root}
+ $a1 = 14
+ call :Tree.Insert
+ if $s0{root} goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s0{root}
+ call :Tree.Print
+ if $s0{root} goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s0{root}
+ $a1 = 24
+ call :Tree.Search
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ if $s0{root} goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ if $s0{root} goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s0{root}
+ $a1 = 16
+ call :Tree.Search
+ $t0{t.2} = $v0
+ PrintIntS($t0{t.2})
+ if $s0{root} goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s0{root}
+ $a1 = 50
+ call :Tree.Search
+ $t0{t.3} = $v0
+ PrintIntS($t0{t.3})
+ if $s0{root} goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.4} = $v0
+ PrintIntS($t0{t.4})
+ if $s0{root} goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Delete
+ if $s0{root} goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0{root}
+ call :Tree.Print
+ if $s0{root} goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.5} = $v0
+ PrintIntS($t0{t.5})
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+8] = $t1{v_key}
+ [$t0{this}+12] = 0
+ [$t0{this}+16] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{rn} = $a1
+ [$t0{this}+4] = $t1{rn}
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{ln} = $a1
+ [$t0{this}] = $t1{ln}
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+8] = $t1{v_key}
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+16]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+12] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+16] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{nti} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if1_else
+ $t1{ntb} = 0
+ goto :if1_end
+if1_else:
+ $t2{t.1} = LtS($t0{num1} $t2{nti})
+ if $t2{t.1} goto :if2_else
+ $t1{ntb} = 0
+ goto :if2_end
+if2_else:
+ $t1{ntb} = 1
+if2_end:
+if1_end:
+ $v0 = $t1{ntb}
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{new_node} = HeapAllocZ(24)
+ if $s2{new_node} goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s2{new_node}
+ $a1 = $s1{v_key}
+ call :Tree.Init
+ $s0{current_node} = $s0{this}
+ $s3{cont} = 1
+while1_top:
+ if0 $s3{cont} goto :while1_end
+ if $s0{current_node} goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t0{t.0} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t0{t.0} goto :if3_else
+ if $s0{current_node} goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0{current_node}
+ call :Tree.GetHas_Left
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if4_else
+ if $s0{current_node} goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0{current_node}
+ call :Tree.GetLeft
+ $s0{current_node} = $v0
+ goto :if4_end
+if4_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call :Tree.SetHas_Left
+ if $s0{current_node} goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call :Tree.SetLeft
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0{current_node} goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.2} = $v0
+ if0 $t0{t.2} goto :if5_else
+ if $s0{current_node} goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s0{current_node}
+ call :Tree.GetRight
+ $s0{current_node} = $v0
+ goto :if5_end
+if5_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call :Tree.SetHas_Right
+ if $s0{current_node} goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call :Tree.SetRight
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{current_node} = $s0{this}
+ $s3{parent_node} = $s0{this}
+ $s4{cont} = 1
+ $s5{found} = 0
+ $s6{is_root} = 1
+while2_top:
+ if0 $s4{cont} goto :while2_end
+ if $s2{current_node} goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s2{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t1{t.0} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t1{t.0} goto :if6_else
+ if $s2{current_node} goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Left
+ $t1{t.1} = $v0
+ if0 $t1{t.1} goto :if7_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s2{current_node}
+ call :Tree.GetLeft
+ $s2{current_node} = $v0
+ goto :if7_end
+if7_else:
+ $s4{cont} = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0{t.2} = LtS($t0{key_aux} $s1{v_key})
+ if0 $t0{t.2} goto :if8_else
+ if $s2{current_node} goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if9_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s2{current_node}
+ call :Tree.GetRight
+ $s2{current_node} = $v0
+ goto :if9_end
+if9_else:
+ $s4{cont} = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6{is_root} goto :if10_else
+ if $s2{current_node} goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :if11_else
+ if $s2{current_node} goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Left
+ $t0{t.5} = $v0
+ if $t0{t.5} goto :if11_else
+ goto :if11_end
+if11_else:
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call :Tree.Remove
+if11_end:
+ goto :if10_end
+if10_else:
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call :Tree.Remove
+if10_end:
+ $s5{found} = 1
+ $s4{cont} = 0
+if8_end:
+if6_end:
+ $s6{is_root} = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5{found}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+ if $s2{c_node} goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if12_else
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call :Tree.RemoveLeft
+ goto :if12_end
+if12_else:
+ if $s2{c_node} goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Right
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if13_else
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call :Tree.RemoveRight
+ goto :if13_end
+if13_else:
+ if $s2{c_node} goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s2{c_node}
+ call :Tree.GetKey
+ $s2{auxkey1} = $v0
+ if $s1{p_node} goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s1{p_node}
+ call :Tree.GetLeft
+ $t0{t.2} = $v0
+ if $t0{t.2} goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $t0{t.2}
+ call :Tree.GetKey
+ $t0{auxkey2} = $v0
+ $a0 = $s0{this}
+ $a1 = $s2{auxkey1}
+ $a2 = $t0{auxkey2}
+ call :Tree.Compare
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if14_else
+ if $s1{p_node} goto :null42
+ Error("null pointer")
+null42:
+ $t0{t.4} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.4}
+ call :Tree.SetLeft
+ if $s1{p_node} goto :null43
+ Error("null pointer")
+null43:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Left
+ goto :if14_end
+if14_else:
+ if $s1{p_node} goto :null44
+ Error("null pointer")
+null44:
+ $t0{t.5} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.5}
+ call :Tree.SetRight
+ if $s1{p_node} goto :null45
+ Error("null pointer")
+null45:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Right
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while3_top:
+ if $s2{c_node} goto :null46
+ Error("null pointer")
+null46:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Right
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :while3_end
+ if $s2{c_node} goto :null47
+ Error("null pointer")
+null47:
+ if $s2{c_node} goto :null48
+ Error("null pointer")
+null48:
+ $a0 = $s2{c_node}
+ call :Tree.GetRight
+ $t0{t.1} = $v0
+ if $t0{t.1} goto :null49
+ Error("null pointer")
+null49:
+ $a0 = $t0{t.1}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t0{t.2}
+ call :Tree.SetKey
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null50
+ Error("null pointer")
+null50:
+ $a0 = $s2{c_node}
+ call :Tree.GetRight
+ $s2{c_node} = $v0
+ goto :while3_top
+while3_end:
+ if $s1{p_node} goto :null51
+ Error("null pointer")
+null51:
+ $t0{t.3} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.3}
+ call :Tree.SetRight
+ if $s1{p_node} goto :null52
+ Error("null pointer")
+null52:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Right
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while4_top:
+ if $s2{c_node} goto :null53
+ Error("null pointer")
+null53:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :while4_end
+ if $s2{c_node} goto :null54
+ Error("null pointer")
+null54:
+ if $s2{c_node} goto :null55
+ Error("null pointer")
+null55:
+ $a0 = $s2{c_node}
+ call :Tree.GetLeft
+ $t0{t.1} = $v0
+ if $t0{t.1} goto :null56
+ Error("null pointer")
+null56:
+ $a0 = $t0{t.1}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t0{t.2}
+ call :Tree.SetKey
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null57
+ Error("null pointer")
+null57:
+ $a0 = $s2{c_node}
+ call :Tree.GetLeft
+ $s2{c_node} = $v0
+ goto :while4_top
+while4_end:
+ if $s1{p_node} goto :null58
+ Error("null pointer")
+null58:
+ $t0{t.3} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.3}
+ call :Tree.SetLeft
+ if $s1{p_node} goto :null59
+ Error("null pointer")
+null59:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Left
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{v_key} = $a1
+ $s1{current_node} = $t0{this}
+ $s2{cont} = 1
+ $s3{ifound} = 0
+while5_top:
+ if0 $s2{cont} goto :while5_end
+ if $s1{current_node} goto :null60
+ Error("null pointer")
+null60:
+ $a0 = $s1{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t1{t.0} = LtS($s0{v_key} $t0{key_aux})
+ if0 $t1{t.0} goto :if15_else
+ if $s1{current_node} goto :null61
+ Error("null pointer")
+null61:
+ $a0 = $s1{current_node}
+ call :Tree.GetHas_Left
+ $t1{t.1} = $v0
+ if0 $t1{t.1} goto :if16_else
+ if $s1{current_node} goto :null62
+ Error("null pointer")
+null62:
+ $a0 = $s1{current_node}
+ call :Tree.GetLeft
+ $s1{current_node} = $v0
+ goto :if16_end
+if16_else:
+ $s2{cont} = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0{t.2} = LtS($t0{key_aux} $s0{v_key})
+ if0 $t0{t.2} goto :if17_else
+ if $s1{current_node} goto :null63
+ Error("null pointer")
+null63:
+ $a0 = $s1{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if18_else
+ if $s1{current_node} goto :null64
+ Error("null pointer")
+null64:
+ $a0 = $s1{current_node}
+ call :Tree.GetRight
+ $s1{current_node} = $v0
+ goto :if18_end
+if18_else:
+ $s2{cont} = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3{ifound} = 1
+ $s2{cont} = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3{ifound}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{current_node} = $t0{this}
+ $a0 = $t0{this}
+ $a1 = $t1{current_node}
+ call :Tree.RecPrint
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{node} = $a1
+ if $s1{node} goto :null65
+ Error("null pointer")
+null65:
+ $a0 = $s1{node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if19_else
+ if $s1{node} goto :null66
+ Error("null pointer")
+null66:
+ $a0 = $s1{node}
+ call :Tree.GetLeft
+ $t0{t.1} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.1}
+ call :Tree.RecPrint
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1{node} goto :null67
+ Error("null pointer")
+null67:
+ $a0 = $s1{node}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ PrintIntS($t0{t.2})
+ if $s1{node} goto :null68
+ Error("null pointer")
+null68:
+ $a0 = $s1{node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if20_else
+ if $s1{node} goto :null69
+ Error("null pointer")
+null69:
+ $a0 = $s1{node}
+ call :Tree.GetRight
+ $t0{t.4} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.4}
+ call :Tree.RecPrint
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
diff --git a/vaporize/tests/BinaryTree.opt.regalloc b/vaporize/tests/BinaryTree.opt.regalloc
new file mode 100644
index 0000000..635f436
--- /dev/null
+++ b/vaporize/tests/BinaryTree.opt.regalloc
@@ -0,0 +1,451 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 9
+Linear Range:
+ t.0: 8-9
+Allocation:
+ t.0: t0
+
+func BT.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this:
+ root: 14 17-18 21-23 26-27 30-31 34-35 38-39 42-43 46-47 50-51 54-55 58-59 62-64 67-69 72-74 77-79 82-84 87-88 91-92 95
+ ntb:
+ t.0: 63
+ t.1: 68
+ t.2: 73
+ t.3: 78
+ t.4: 83
+ t.5: 96
+Linear Range:
+ root: 13-95 (cross call)
+ t.0: 62-63
+ t.1: 67-68
+ t.2: 72-73
+ t.3: 77-78
+ t.4: 82-83
+ t.5: 95-96
+Allocation:
+ root: s0
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func Tree.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 100-102
+ v_key: 100
+Linear Range:
+ this: 99-102
+ v_key: 99-100
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.SetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 106
+ rn: 106
+Linear Range:
+ this: 105-106
+ rn: 105-106
+Allocation:
+ this: t0
+ rn: t1
+
+func Tree.SetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 110
+ ln: 110
+Linear Range:
+ this: 109-110
+ ln: 109-110
+Allocation:
+ this: t0
+ ln: t1
+
+func Tree.GetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 114
+ t.0: 115
+Linear Range:
+ this: 113-114
+ t.0: 114-115
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 118
+ t.0: 119
+Linear Range:
+ this: 117-118
+ t.0: 118-119
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 122
+ t.0: 123
+Linear Range:
+ this: 121-122
+ t.0: 122-123
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 126
+ v_key: 126
+Linear Range:
+ this: 125-126
+ v_key: 125-126
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.GetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 130
+ t.0: 131
+Linear Range:
+ this: 129-130
+ t.0: 130-131
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 134
+ t.0: 135
+Linear Range:
+ this: 133-134
+ t.0: 134-135
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 138
+ val: 138
+Linear Range:
+ this: 137-138
+ val: 137-138
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.SetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 142
+ val: 142
+Linear Range:
+ this: 141-142
+ val: 141-142
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 146-149 153
+ num2: 146-148
+ ntb: 151 156 161
+ nti: 148-149 153
+ t.0: 149
+ t.1: 154
+Linear Range:
+ num1: 145-153
+ num2: 145-148
+ ntb: 150-161
+ nti: 147-153
+ t.0: 148-149
+ t.1: 153-154
+Allocation:
+ num1: t0
+ num2: t1
+ ntb: t1
+ nti: t2
+ t.0: t1
+ t.1: t2
+
+func Tree.Insert
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 164-165 168-169
+ v_key: 164-165 168-173 176-179 182-184 187-191 194-195 198-202 205-207 210-214 217-218 221-224
+ new_node: 165 168-173 176-179 182-184 187-191 194-195 198-202 205-207 210-214 217-218 221-224
+ ntb:
+ current_node: 170-173 176-179 182-184 187-191 194-195 198-202 205-207 210-214 217-218 221-224
+ cont: 172-173 176-179 182-184 187-188 191 194-195 198-202 205-207 210-211 214 217-218 221-224
+ key_aux: 177
+ t.0: 178
+ t.1: 183
+ t.2: 206
+Linear Range:
+ this: 163-169 (cross call)
+ v_key: 163-224 (cross call)
+ new_node: 164-224 (cross call)
+ current_node: 169-224 (cross call)
+ cont: 170-224 (cross call)
+ key_aux: 176-177
+ t.0: 177-178
+ t.1: 182-183
+ t.2: 205-206
+Allocation:
+ this: s0
+ v_key: s1
+ new_node: s2
+ current_node: s0
+ cont: s3
+ key_aux: t0
+ t.0: t0
+ t.1: t0
+ t.2: t0
+
+func Tree.Delete
+ in 0, out 0, callee-saves 7, spills 0
+Live In:
+ this: 229-236 239-242 245-248 251-260 263-266 269-277 280-282 285-301
+ v_key: 229-236 239-242 245-248 251-260 263-266 269-277 280-282 285-301
+ current_node: 230-236 239-242 245-248 251-260 263-266 269-277 280-282 285-301
+ parent_node: 231-236 239-242 245-246 248 251-260 263-264 266 269-277 280-282 285-301
+ cont: 232-236 239-242 245-248 251-252 256-260 263-266 269-270 274 300-301
+ found: 233-236 239-242 245-248 251-260 263-266 269-274 297-303
+ is_root: 235-236 239-241 258-259 276 301
+ key_aux: 240-241 258
+ t.0: 241
+ t.1: 246
+ t.2: 259
+ t.3: 264
+ t.4: 281
+ t.5: 286
+ ntb:
+Linear Range:
+ this: 228-301 (cross call)
+ v_key: 228-301 (cross call)
+ current_node: 229-301 (cross call)
+ parent_node: 230-301 (cross call)
+ cont: 231-301 (cross call)
+ found: 232-303 (cross call)
+ is_root: 233-301 (cross call)
+ key_aux: 239-258
+ t.0: 240-241
+ t.1: 245-246
+ t.2: 258-259
+ t.3: 263-264
+ t.4: 280-281
+ t.5: 285-286
+Allocation:
+ this: s0
+ v_key: s1
+ current_node: s2
+ parent_node: s3
+ cont: s4
+ found: s5
+ is_root: s6
+ key_aux: t0
+ t.0: t1
+ t.1: t1
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func Tree.Remove
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 306 309-311 314 317-319 322 325-326 329-330 333-336 339 347 350
+ p_node: 306 309-311 314 317-319 322 325-326 329-330 333-336 339-341 344 347 350-352 355
+ c_node: 306 309-311 314 317-319 322 325
+ t.0: 310
+ ntb:
+ t.1: 318
+ auxkey1: 326 329-330 333-334
+ t.2: 330 333
+ auxkey2: 334
+ t.3: 335
+ t.4: 340
+ t.5: 351
+Linear Range:
+ this: 305-350 (cross call)
+ p_node: 305-355 (cross call)
+ c_node: 305-325 (cross call)
+ t.0: 309-310
+ t.1: 317-318
+ auxkey1: 325-334 (cross call)
+ t.2: 329-333
+ auxkey2: 333-334
+ t.3: 334-335
+ t.4: 339-340
+ t.5: 350-351
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ auxkey1: s2
+ t.2: t0
+ auxkey2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func Tree.RemoveRight
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 363 366-368 371 374-375 378-381 384-387 390
+ p_node: 363 366-367 381 384-387 390-392 395
+ c_node: 363 366-368 371 374-375 378-381 384-385
+ t.0: 367
+ t.1: 375 378
+ t.2: 379
+ ntb:
+ t.3: 391
+Linear Range:
+ this: 361-390 (cross call)
+ p_node: 361-395 (cross call)
+ c_node: 361-385 (cross call)
+ t.0: 366-367
+ t.1: 374-378
+ t.2: 378-379
+ t.3: 390-391
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+
+func Tree.RemoveLeft
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 400 403-405 408 411-412 415-418 421-424 427
+ p_node: 400 403-404 418 421-424 427-429 432
+ c_node: 400 403-405 408 411-412 415-418 421-422
+ t.0: 404
+ t.1: 412 415
+ t.2: 416
+ ntb:
+ t.3: 428
+Linear Range:
+ this: 398-427 (cross call)
+ p_node: 398-432 (cross call)
+ c_node: 398-422 (cross call)
+ t.0: 403-404
+ t.1: 411-415
+ t.2: 415-416
+ t.3: 427-428
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+
+func Tree.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 436
+ v_key: 436-441 444-447 450-452 455-464 467-469 472-483
+ current_node: 437-441 444-447 450-452 455-464 467-469 472-483
+ cont: 438-441 444-447 450-452 455-456 460-464 467-469 472-473 477 483
+ ifound: 440-441 444-447 450-452 455-464 467-469 472-477 480-485
+ key_aux: 445-446 462
+ t.0: 446
+ t.1: 451
+ t.2: 463
+ t.3: 468
+Linear Range:
+ this: 435-436
+ v_key: 435-483 (cross call)
+ current_node: 436-483 (cross call)
+ cont: 437-483 (cross call)
+ ifound: 438-485 (cross call)
+ key_aux: 444-462
+ t.0: 445-446
+ t.1: 450-451
+ t.2: 462-463
+ t.3: 467-468
+Allocation:
+ this: t0
+ v_key: s0
+ current_node: s1
+ cont: s2
+ ifound: s3
+ key_aux: t0
+ t.0: t1
+ t.1: t1
+ t.2: t0
+ t.3: t0
+
+func Tree.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 488-489
+ current_node: 489
+ ntb:
+Linear Range:
+ this: 487-489
+ current_node: 488-489
+Allocation:
+ this: t0
+ current_node: t1
+
+func Tree.RecPrint
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 493 496-498 501-507 510-512 515-517 520-521
+ node: 493 496-498 501-507 510-512 515-517 520
+ t.0: 497
+ t.1: 502
+ ntb:
+ t.2: 511
+ t.3: 516
+ t.4: 521
+Linear Range:
+ this: 492-521 (cross call)
+ node: 492-520 (cross call)
+ t.0: 496-497
+ t.1: 501-502
+ t.2: 510-511
+ t.3: 515-516
+ t.4: 520-521
+Allocation:
+ this: s0
+ node: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+
diff --git a/vaporize/tests/BinaryTree.opt.vaporm b/vaporize/tests/BinaryTree.opt.vaporm
new file mode 100644
index 0000000..f3bee43
--- /dev/null
+++ b/vaporize/tests/BinaryTree.opt.vaporm
@@ -0,0 +1,797 @@
+const empty_BT
+
+const empty_Tree
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_BT
+ call :BT.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func BT.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = HeapAllocZ(24)
+ if $s0 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s0
+ $a1 = 16
+ call :Tree.Init
+ if $s0 goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s0
+ call :Tree.Print
+ PrintIntS(100000000)
+ if $s0 goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s0
+ $a1 = 8
+ call :Tree.Insert
+ if $s0 goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s0
+ call :Tree.Print
+ if $s0 goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0
+ $a1 = 24
+ call :Tree.Insert
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0
+ $a1 = 4
+ call :Tree.Insert
+ if $s0 goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Insert
+ if $s0 goto :null8
+ Error("null pointer")
+null8:
+ $a0 = $s0
+ $a1 = 20
+ call :Tree.Insert
+ if $s0 goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s0
+ $a1 = 28
+ call :Tree.Insert
+ if $s0 goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s0
+ $a1 = 14
+ call :Tree.Insert
+ if $s0 goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s0
+ call :Tree.Print
+ if $s0 goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s0
+ $a1 = 24
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s0
+ $a1 = 16
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s0
+ $a1 = 50
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Delete
+ if $s0 goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0
+ call :Tree.Print
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ [$t0+12] = 0
+ [$t0+16] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+4] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0]
+ $v0 = $t0
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+16]
+ $v0 = $t0
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+16] = $t1
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if1_else
+ $t1 = 0
+ goto :if1_end
+if1_else:
+ $t2 = LtS($t0 $t2)
+ if $t2 goto :if2_else
+ $t1 = 0
+ goto :if2_end
+if2_else:
+ $t1 = 1
+if2_end:
+if1_end:
+ $v0 = $t1
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = HeapAllocZ(24)
+ if $s2 goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s2
+ $a1 = $s1
+ call :Tree.Init
+ $s0 = $s0
+ $s3 = 1
+while1_top:
+ if0 $s3 goto :while1_end
+ if $s0 goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0
+ call :Tree.GetKey
+ $t0 = $v0
+ $t0 = LtS($s1 $t0)
+ if0 $t0 goto :if3_else
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if4_else
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0
+ call :Tree.GetLeft
+ $s0 = $v0
+ goto :if4_end
+if4_else:
+ $s3 = 0
+ if $s0 goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s0
+ $a1 = 1
+ call :Tree.SetHas_Left
+ if $s0 goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0
+ $a1 = $s2
+ call :Tree.SetLeft
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ if $s0 goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s0
+ call :Tree.GetRight
+ $s0 = $v0
+ goto :if5_end
+if5_else:
+ $s3 = 0
+ if $s0 goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0
+ $a1 = 1
+ call :Tree.SetHas_Right
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0
+ $a1 = $s2
+ call :Tree.SetRight
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $s0
+ $s3 = $s0
+ $s4 = 1
+ $s5 = 0
+ $s6 = 1
+while2_top:
+ if0 $s4 goto :while2_end
+ if $s2 goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s2
+ call :Tree.GetKey
+ $t0 = $v0
+ $t1 = LtS($s1 $t0)
+ if0 $t1 goto :if6_else
+ if $s2 goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t1 = $v0
+ if0 $t1 goto :if7_else
+ $s3 = $s2
+ if $s2 goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $s2 = $v0
+ goto :if7_end
+if7_else:
+ $s4 = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0 = LtS($t0 $s1)
+ if0 $t0 goto :if8_else
+ if $s2 goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if9_else
+ $s3 = $s2
+ if $s2 goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s2
+ call :Tree.GetRight
+ $s2 = $v0
+ goto :if9_end
+if9_else:
+ $s4 = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6 goto :if10_else
+ if $s2 goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if $t0 goto :if11_else
+ if $s2 goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if $t0 goto :if11_else
+ goto :if11_end
+if11_else:
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call :Tree.Remove
+if11_end:
+ goto :if10_end
+if10_else:
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call :Tree.Remove
+if10_end:
+ $s5 = 1
+ $s4 = 0
+if8_end:
+if6_end:
+ $s6 = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+ if $s2 goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if12_else
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call :Tree.RemoveLeft
+ goto :if12_end
+if12_else:
+ if $s2 goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if13_else
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call :Tree.RemoveRight
+ goto :if13_end
+if13_else:
+ if $s2 goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s2
+ call :Tree.GetKey
+ $s2 = $v0
+ if $s1 goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ if $t0 goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $s2
+ $a2 = $t0
+ call :Tree.Compare
+ $t0 = $v0
+ if0 $t0 goto :if14_else
+ if $s1 goto :null42
+ Error("null pointer")
+null42:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetLeft
+ if $s1 goto :null43
+ Error("null pointer")
+null43:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Left
+ goto :if14_end
+if14_else:
+ if $s1 goto :null44
+ Error("null pointer")
+null44:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetRight
+ if $s1 goto :null45
+ Error("null pointer")
+null45:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Right
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while3_top:
+ if $s2 goto :null46
+ Error("null pointer")
+null46:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :while3_end
+ if $s2 goto :null47
+ Error("null pointer")
+null47:
+ if $s2 goto :null48
+ Error("null pointer")
+null48:
+ $a0 = $s2
+ call :Tree.GetRight
+ $t0 = $v0
+ if $t0 goto :null49
+ Error("null pointer")
+null49:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s2
+ $a1 = $t0
+ call :Tree.SetKey
+ $s1 = $s2
+ if $s2 goto :null50
+ Error("null pointer")
+null50:
+ $a0 = $s2
+ call :Tree.GetRight
+ $s2 = $v0
+ goto :while3_top
+while3_end:
+ if $s1 goto :null51
+ Error("null pointer")
+null51:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetRight
+ if $s1 goto :null52
+ Error("null pointer")
+null52:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Right
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while4_top:
+ if $s2 goto :null53
+ Error("null pointer")
+null53:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :while4_end
+ if $s2 goto :null54
+ Error("null pointer")
+null54:
+ if $s2 goto :null55
+ Error("null pointer")
+null55:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $t0 = $v0
+ if $t0 goto :null56
+ Error("null pointer")
+null56:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s2
+ $a1 = $t0
+ call :Tree.SetKey
+ $s1 = $s2
+ if $s2 goto :null57
+ Error("null pointer")
+null57:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $s2 = $v0
+ goto :while4_top
+while4_end:
+ if $s1 goto :null58
+ Error("null pointer")
+null58:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetLeft
+ if $s1 goto :null59
+ Error("null pointer")
+null59:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Left
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 1
+ $s3 = 0
+while5_top:
+ if0 $s2 goto :while5_end
+ if $s1 goto :null60
+ Error("null pointer")
+null60:
+ $a0 = $s1
+ call :Tree.GetKey
+ $t0 = $v0
+ $t1 = LtS($s0 $t0)
+ if0 $t1 goto :if15_else
+ if $s1 goto :null61
+ Error("null pointer")
+null61:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t1 = $v0
+ if0 $t1 goto :if16_else
+ if $s1 goto :null62
+ Error("null pointer")
+null62:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $s1 = $v0
+ goto :if16_end
+if16_else:
+ $s2 = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0 = LtS($t0 $s0)
+ if0 $t0 goto :if17_else
+ if $s1 goto :null63
+ Error("null pointer")
+null63:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if18_else
+ if $s1 goto :null64
+ Error("null pointer")
+null64:
+ $a0 = $s1
+ call :Tree.GetRight
+ $s1 = $v0
+ goto :if18_end
+if18_else:
+ $s2 = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3 = 1
+ $s2 = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $t0
+ $a0 = $t0
+ $a1 = $t1
+ call :Tree.RecPrint
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null65
+ Error("null pointer")
+null65:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if19_else
+ if $s1 goto :null66
+ Error("null pointer")
+null66:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call :Tree.RecPrint
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1 goto :null67
+ Error("null pointer")
+null67:
+ $a0 = $s1
+ call :Tree.GetKey
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s1 goto :null68
+ Error("null pointer")
+null68:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if20_else
+ if $s1 goto :null69
+ Error("null pointer")
+null69:
+ $a0 = $s1
+ call :Tree.GetRight
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call :Tree.RecPrint
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
diff --git a/vaporize/tests/BinaryTree.regalloc b/vaporize/tests/BinaryTree.regalloc
new file mode 100644
index 0000000..68a8265
--- /dev/null
+++ b/vaporize/tests/BinaryTree.regalloc
@@ -0,0 +1,703 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 30-31 34-36
+ t.1: 35-36
+ t.2: 37
+Linear Range:
+ t.0: 29-36
+ t.1: 34-36
+ t.2: 36-37
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func BT.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this:
+ t.0: 42-43
+ root: 44 47-50 53-57 60-63 66-69 72-75 78-81 84-87 90-93 96-99 102-105 108-111 114-118 121-125 128-132 135-139 142-146 149-152 155-158 161-163
+ t.1: 48-49
+ ntb:
+ t.2: 54-55
+ t.3: 61-62
+ t.4: 67-68
+ t.5: 73-74
+ t.6: 79-80
+ t.7: 85-86
+ t.8: 91-92
+ t.9: 97-98
+ t.10: 103-104
+ t.11: 109-110
+ t.12: 115-116
+ t.13: 117
+ t.14: 122-123
+ t.15: 124
+ t.16: 129-130
+ t.17: 131
+ t.18: 136-137
+ t.19: 138
+ t.20: 143-144
+ t.21: 145
+ t.22: 150-151
+ t.23: 156-157
+ t.24: 162-163
+ t.25: 164
+Linear Range:
+ t.0: 41-43
+ root: 43-163 (cross call)
+ t.1: 47-49
+ t.2: 53-55
+ t.3: 60-62
+ t.4: 66-68
+ t.5: 72-74
+ t.6: 78-80
+ t.7: 84-86
+ t.8: 90-92
+ t.9: 96-98
+ t.10: 102-104
+ t.11: 108-110
+ t.12: 114-116
+ t.13: 116-117
+ t.14: 121-123
+ t.15: 123-124
+ t.16: 128-130
+ t.17: 130-131
+ t.18: 135-137
+ t.19: 137-138
+ t.20: 142-144
+ t.21: 144-145
+ t.22: 149-151
+ t.23: 155-157
+ t.24: 161-163
+ t.25: 163-164
+Allocation:
+ t.0: t0
+ root: s0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+ t.15: t0
+ t.16: t0
+ t.17: t0
+ t.18: t0
+ t.19: t0
+ t.20: t0
+ t.21: t0
+ t.22: t0
+ t.23: t0
+ t.24: t0
+ t.25: t0
+
+func Tree.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 168-170
+ v_key: 168
+Linear Range:
+ this: 167-170
+ v_key: 167-168
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.SetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 174
+ rn: 174
+Linear Range:
+ this: 173-174
+ rn: 173-174
+Allocation:
+ this: t0
+ rn: t1
+
+func Tree.SetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 178
+ ln: 178
+Linear Range:
+ this: 177-178
+ ln: 177-178
+Allocation:
+ this: t0
+ ln: t1
+
+func Tree.GetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 182
+ t.0: 183
+Linear Range:
+ this: 181-182
+ t.0: 182-183
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 186
+ t.0: 187
+Linear Range:
+ this: 185-186
+ t.0: 186-187
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 190
+ t.0: 191
+Linear Range:
+ this: 189-190
+ t.0: 190-191
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 194
+ v_key: 194
+Linear Range:
+ this: 193-194
+ v_key: 193-194
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.GetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 198
+ t.0: 199
+Linear Range:
+ this: 197-198
+ t.0: 198-199
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 202
+ t.0: 203
+Linear Range:
+ this: 201-202
+ t.0: 202-203
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 206
+ val: 206
+Linear Range:
+ this: 205-206
+ val: 205-206
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.SetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 210
+ val: 210
+Linear Range:
+ this: 209-210
+ val: 209-210
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 214-217 221
+ num2: 214-216
+ ntb: 219 225 230
+ nti: 216-217 221
+ t.0: 217
+ t.1: 222
+ t.2: 223
+Linear Range:
+ num1: 213-221
+ num2: 213-216
+ ntb: 218-230
+ nti: 215-221
+ t.0: 216-217
+ t.1: 221-222
+ t.2: 222-223
+Allocation:
+ num1: t0
+ num2: t1
+ ntb: t1
+ nti: t2
+ t.0: t1
+ t.1: t2
+ t.2: t2
+
+func Tree.Insert
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 233-236 239-242
+ v_key: 233-236 239-246 249-254 257-261 264-270 273-276 279-285 288-292 295-301 304-307 310-315
+ t.0: 234-235
+ new_node: 236 239-246 249-254 257-261 264-270 273-276 279-285 288-292 295-301 304-307 310-315
+ t.1: 240-241
+ ntb:
+ current_node: 243-246 249-254 257-261 264-270 273-276 279-285 288-292 295-301 304-307 310-315
+ cont: 245-246 249-254 257-261 264-267 270 273-276 279-285 288-292 295-298 301 304-307 310-315
+ t.2: 250-251
+ key_aux: 252
+ t.3: 253
+ t.4: 258-259
+ t.5: 260
+ t.6: 265-266
+ t.7: 274-275
+ t.8: 280-281
+ t.9: 289-290
+ t.10: 291
+ t.11: 296-297
+ t.12: 305-306
+ t.13: 311-312
+Linear Range:
+ this: 232-242 (cross call)
+ v_key: 232-315 (cross call)
+ t.0: 233-235
+ new_node: 235-315 (cross call)
+ t.1: 239-241
+ current_node: 242-315 (cross call)
+ cont: 243-315 (cross call)
+ t.2: 249-251
+ key_aux: 251-252
+ t.3: 252-253
+ t.4: 257-259
+ t.5: 259-260
+ t.6: 264-266
+ t.7: 273-275
+ t.8: 279-281
+ t.9: 288-290
+ t.10: 290-291
+ t.11: 295-297
+ t.12: 304-306
+ t.13: 310-312
+Allocation:
+ this: s0
+ v_key: s1
+ t.0: t0
+ new_node: s2
+ t.1: t0
+ current_node: s0
+ cont: s3
+ t.2: t0
+ key_aux: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+
+func Tree.Delete
+ in 0, out 0, callee-saves 7, spills 0
+Live In:
+ this: 320-327 330-335 338-343 346-357 360-365 368-378 381-386 389-416
+ v_key: 320-327 330-335 338-343 346-357 360-365 368-378 381-386 389-416
+ current_node: 321-327 330-335 338-343 346-357 360-365 368-378 381-386 389-416
+ parent_node: 322-327 330-335 338-341 343 346-357 360-363 365 368-378 381-386 389-416
+ cont: 323-327 330-335 338-343 346-349 353-357 360-365 368-371 375 415-416
+ found: 324-327 330-335 338-343 346-357 360-365 368-375 412-418
+ is_root: 326-327 330-334 355-356 377 416
+ t.0: 331-332
+ key_aux: 333-334 355
+ t.1: 334
+ t.2: 339-340
+ t.3: 341
+ t.4: 347-348
+ t.5: 356
+ t.6: 361-362
+ t.7: 363
+ t.8: 369-370
+ t.10: 382-383
+ t.11: 384
+ t.12: 385
+ t.13: 390-391
+ t.14: 392
+ t.9: 393 397
+ ntb:
+ t.15: 402-403
+ t.16: 408-409
+Linear Range:
+ this: 319-416 (cross call)
+ v_key: 319-416 (cross call)
+ current_node: 320-416 (cross call)
+ parent_node: 321-416 (cross call)
+ cont: 322-416 (cross call)
+ found: 323-418 (cross call)
+ is_root: 324-416 (cross call)
+ t.0: 330-332
+ key_aux: 332-355
+ t.1: 333-334
+ t.2: 338-340
+ t.3: 340-341
+ t.4: 346-348
+ t.5: 355-356
+ t.6: 360-362
+ t.7: 362-363
+ t.8: 368-370
+ t.10: 381-383
+ t.11: 383-384
+ t.12: 384-385
+ t.13: 389-391
+ t.14: 391-392
+ t.9: 392-397
+ t.15: 401-403
+ t.16: 407-409
+Allocation:
+ this: s0
+ v_key: s1
+ current_node: s2
+ parent_node: s3
+ cont: s4
+ found: s5
+ is_root: s6
+ t.0: t0
+ key_aux: t0
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+ t.9: t0
+ t.15: t0
+ t.16: t0
+
+func Tree.Remove
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 421 424-430 433 436-442 445 448-451 454-457 460-467 470-472 482 485-487
+ p_node: 421 424-430 433 436-442 445 448-451 454-457 460-467 470-474 477-479 482 485-489 492-494
+ c_node: 421 424-430 433 436-442 445 448-450
+ t.0: 425-426
+ t.1: 427
+ t.2: 429-430
+ ntb:
+ t.3: 437-438
+ t.4: 439
+ t.5: 441-442
+ t.6: 449-450
+ auxkey1: 451 454-457 460-465
+ t.7: 455-456
+ t.8: 457 460-462
+ t.9: 461-462
+ auxkey2: 463-465
+ t.10: 464-465
+ t.11: 466
+ t.12: 471-473
+ t.13: 473
+ t.14: 478-479
+ t.15: 486-488
+ t.16: 488
+ t.17: 493-494
+Linear Range:
+ this: 420-487 (cross call)
+ p_node: 420-494 (cross call)
+ c_node: 420-450 (cross call)
+ t.0: 424-426
+ t.1: 426-427
+ t.2: 428-430
+ t.3: 436-438
+ t.4: 438-439
+ t.5: 440-442
+ t.6: 448-450
+ auxkey1: 450-465 (cross call)
+ t.7: 454-456
+ t.8: 456-462
+ t.9: 460-462
+ auxkey2: 462-465
+ t.10: 463-465
+ t.11: 465-466
+ t.12: 470-473
+ t.13: 472-473
+ t.14: 477-479
+ t.15: 485-488
+ t.16: 487-488
+ t.17: 492-494
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ auxkey1: s2
+ t.7: t0
+ t.8: t0
+ t.9: t1
+ auxkey2: t1
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t1
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+
+func Tree.RemoveRight
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 502 505-509 512-514 517-520 523-528 531-536 539-541
+ p_node: 502 505-508 528 531-536 539-543 546-548
+ c_node: 502 505-509 512-514 517-520 523-528 531-534
+ t.0: 506-507
+ t.1: 508
+ t.2: 513-514 517-520 523-526
+ t.3: 518-519
+ t.4: 520 523-525
+ t.5: 524-525
+ t.6: 526
+ ntb:
+ t.7: 532-533
+ t.8: 540-542
+ t.9: 542
+ t.10: 547-548
+Linear Range:
+ this: 500-541 (cross call)
+ p_node: 500-548 (cross call)
+ c_node: 500-534 (cross call)
+ t.0: 505-507
+ t.1: 507-508
+ t.2: 512-526 (cross call)
+ t.3: 517-519
+ t.4: 519-525
+ t.5: 523-525
+ t.6: 525-526
+ t.7: 531-533
+ t.8: 539-542
+ t.9: 541-542
+ t.10: 546-548
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: s3
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t0
+ t.10: t0
+
+func Tree.RemoveLeft
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 553 556-560 563-565 568-571 574-579 582-587 590-592
+ p_node: 553 556-559 579 582-587 590-594 597-599
+ c_node: 553 556-560 563-565 568-571 574-579 582-585
+ t.0: 557-558
+ t.1: 559
+ t.2: 564-565 568-571 574-577
+ t.3: 569-570
+ t.4: 571 574-576
+ t.5: 575-576
+ t.6: 577
+ ntb:
+ t.7: 583-584
+ t.8: 591-593
+ t.9: 593
+ t.10: 598-599
+Linear Range:
+ this: 551-592 (cross call)
+ p_node: 551-599 (cross call)
+ c_node: 551-585 (cross call)
+ t.0: 556-558
+ t.1: 558-559
+ t.2: 563-577 (cross call)
+ t.3: 568-570
+ t.4: 570-576
+ t.5: 574-576
+ t.6: 576-577
+ t.7: 582-584
+ t.8: 590-593
+ t.9: 592-593
+ t.10: 597-599
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: s3
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t0
+ t.10: t0
+
+func Tree.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 603
+ v_key: 603-608 611-616 619-623 626-637 640-644 647-660
+ current_node: 604-608 611-616 619-623 626-637 640-644 647-660
+ cont: 605-608 611-616 619-623 626-629 633-637 640-644 647-650 654 660
+ ifound: 607-608 611-616 619-623 626-637 640-644 647-654 657-662
+ t.0: 612-613
+ key_aux: 614-615 635
+ t.1: 615
+ t.2: 620-621
+ t.3: 622
+ t.4: 627-628
+ t.5: 636
+ t.6: 641-642
+ t.7: 643
+ t.8: 648-649
+Linear Range:
+ this: 602-603
+ v_key: 602-660 (cross call)
+ current_node: 603-660 (cross call)
+ cont: 604-660 (cross call)
+ ifound: 605-662 (cross call)
+ t.0: 611-613
+ key_aux: 613-635
+ t.1: 614-615
+ t.2: 619-621
+ t.3: 621-622
+ t.4: 626-628
+ t.5: 635-636
+ t.6: 640-642
+ t.7: 642-643
+ t.8: 647-649
+Allocation:
+ this: t0
+ v_key: s0
+ current_node: s1
+ cont: s2
+ ifound: s3
+ t.0: t0
+ key_aux: t0
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+
+func Tree.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 665-668
+ current_node: 666-668
+ t.0: 667-668
+ ntb:
+Linear Range:
+ this: 664-668
+ current_node: 665-668
+ t.0: 666-668
+Allocation:
+ this: t0
+ current_node: t1
+ t.0: t2
+
+func Tree.RecPrint
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 672 675-681 684-692 695-699 702-708 711-714
+ node: 672 675-681 684-692 695-699 702-708 711-713
+ t.0: 676-677
+ t.1: 678
+ t.2: 680-681 684-687
+ t.3: 685-686
+ t.4: 687
+ ntb:
+ t.5: 696-697
+ t.6: 698
+ t.7: 703-704
+ t.8: 705
+ t.9: 707-708 711-714
+ t.10: 712-713
+ t.11: 714
+Linear Range:
+ this: 671-714 (cross call)
+ node: 671-713 (cross call)
+ t.0: 675-677
+ t.1: 677-678
+ t.2: 679-687 (cross call)
+ t.3: 684-686
+ t.4: 686-687
+ t.5: 695-697
+ t.6: 697-698
+ t.7: 702-704
+ t.8: 704-705
+ t.9: 706-714 (cross call)
+ t.10: 711-713
+ t.11: 713-714
+Allocation:
+ this: s0
+ node: s1
+ t.0: t0
+ t.1: t0
+ t.2: s2
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: s2
+ t.10: t0
+ t.11: t0
+
diff --git a/vaporize/tests/BinaryTree.vaporm b/vaporize/tests/BinaryTree.vaporm
new file mode 100644
index 0000000..ad25de5
--- /dev/null
+++ b/vaporize/tests/BinaryTree.vaporm
@@ -0,0 +1,996 @@
+const vmt_BT
+ :BT.Start
+
+const vmt_Tree
+ :Tree.Init
+ :Tree.SetRight
+ :Tree.SetLeft
+ :Tree.GetRight
+ :Tree.GetLeft
+ :Tree.GetKey
+ :Tree.SetKey
+ :Tree.GetHas_Right
+ :Tree.GetHas_Left
+ :Tree.SetHas_Left
+ :Tree.SetHas_Right
+ :Tree.Compare
+ :Tree.Insert
+ :Tree.Delete
+ :Tree.Remove
+ :Tree.RemoveRight
+ :Tree.RemoveLeft
+ :Tree.Search
+ :Tree.Print
+ :Tree.RecPrint
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(4)
+ [$t0] = :vmt_BT
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func BT.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = HeapAllocZ(28)
+ [$t0] = :vmt_Tree
+ $s0 = $t0
+ if $s0 goto :null2
+ Error("null pointer")
+null2:
+ $t0 = [$s0]
+ $t0 = [$t0]
+ $a0 = $s0
+ $a1 = 16
+ call $t0
+ if $s0 goto :null3
+ Error("null pointer")
+null3:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ PrintIntS(100000000)
+ if $s0 goto :null4
+ Error("null pointer")
+null4:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 8
+ call $t0
+ if $s0 goto :null5
+ Error("null pointer")
+null5:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 24
+ call $t0
+ if $s0 goto :null7
+ Error("null pointer")
+null7:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 4
+ call $t0
+ if $s0 goto :null8
+ Error("null pointer")
+null8:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ if $s0 goto :null9
+ Error("null pointer")
+null9:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 20
+ call $t0
+ if $s0 goto :null10
+ Error("null pointer")
+null10:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 28
+ call $t0
+ if $s0 goto :null11
+ Error("null pointer")
+null11:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 14
+ call $t0
+ if $s0 goto :null12
+ Error("null pointer")
+null12:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ if $s0 goto :null13
+ Error("null pointer")
+null13:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 24
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null14
+ Error("null pointer")
+null14:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null15
+ Error("null pointer")
+null15:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 16
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null16
+ Error("null pointer")
+null16:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 50
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null17
+ Error("null pointer")
+null17:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null18
+ Error("null pointer")
+null18:
+ $t0 = [$s0]
+ $t0 = [$t0+52]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ if $s0 goto :null20
+ Error("null pointer")
+null20:
+ $t0 = [$s0]
+ $t0 = [$t0+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ [$t0+16] = 0
+ [$t0+20] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+4] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+20]
+ $v0 = $t0
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+16]
+ $v0 = $t0
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+16] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+20] = $t1
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if1_else
+ $t1 = 0
+ goto :if1_end
+if1_else:
+ $t2 = LtS($t0 $t2)
+ $t2 = Sub(1 $t2)
+ if0 $t2 goto :if2_else
+ $t1 = 0
+ goto :if2_end
+if2_else:
+ $t1 = 1
+if2_end:
+if1_end:
+ $v0 = $t1
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $t0 = HeapAllocZ(28)
+ [$t0] = :vmt_Tree
+ $s2 = $t0
+ if $s2 goto :null21
+ Error("null pointer")
+null21:
+ $t0 = [$s2]
+ $t0 = [$t0]
+ $a0 = $s2
+ $a1 = $s1
+ call $t0
+ $s0 = $s0
+ $s3 = 1
+while1_top:
+ if0 $s3 goto :while1_end
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $t0 = [$s0]
+ $t0 = [$t0+20]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ $t0 = LtS($s1 $t0)
+ if0 $t0 goto :if3_else
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $t0 = [$s0]
+ $t0 = [$t0+32]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if4_else
+ if $s0 goto :null24
+ Error("null pointer")
+null24:
+ $t0 = [$s0]
+ $t0 = [$t0+16]
+ $a0 = $s0
+ call $t0
+ $s0 = $v0
+ goto :if4_end
+if4_else:
+ $s3 = 0
+ if $s0 goto :null25
+ Error("null pointer")
+null25:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ $a1 = 1
+ call $t0
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0 goto :null27
+ Error("null pointer")
+null27:
+ $t0 = [$s0]
+ $t0 = [$t0+28]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ if $s0 goto :null28
+ Error("null pointer")
+null28:
+ $t0 = [$s0]
+ $t0 = [$t0+12]
+ $a0 = $s0
+ call $t0
+ $s0 = $v0
+ goto :if5_end
+if5_else:
+ $s3 = 0
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $t0 = [$s0]
+ $t0 = [$t0+40]
+ $a0 = $s0
+ $a1 = 1
+ call $t0
+ if $s0 goto :null30
+ Error("null pointer")
+null30:
+ $t0 = [$s0]
+ $t0 = [$t0+4]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $s0
+ $s3 = $s0
+ $s4 = 1
+ $s5 = 0
+ $s6 = 1
+while2_top:
+ if0 $s4 goto :while2_end
+ if $s2 goto :null31
+ Error("null pointer")
+null31:
+ $t0 = [$s2]
+ $t0 = [$t0+20]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t1 = LtS($s1 $t0)
+ if0 $t1 goto :if6_else
+ if $s2 goto :null32
+ Error("null pointer")
+null32:
+ $t1 = [$s2]
+ $t1 = [$t1+32]
+ $a0 = $s2
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if7_else
+ $s3 = $s2
+ if $s2 goto :null33
+ Error("null pointer")
+null33:
+ $t1 = [$s2]
+ $t1 = [$t1+16]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :if7_end
+if7_else:
+ $s4 = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0 = LtS($t0 $s1)
+ if0 $t0 goto :if8_else
+ if $s2 goto :null34
+ Error("null pointer")
+null34:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if9_else
+ $s3 = $s2
+ if $s2 goto :null35
+ Error("null pointer")
+null35:
+ $t0 = [$s2]
+ $t0 = [$t0+12]
+ $a0 = $s2
+ call $t0
+ $s2 = $v0
+ goto :if9_end
+if9_else:
+ $s4 = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6 goto :if10_else
+ if $s2 goto :null36
+ Error("null pointer")
+null36:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ if0 $t0 goto :ss1_else
+ if $s2 goto :null37
+ Error("null pointer")
+null37:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ goto :ss1_end
+ss1_else:
+ $t0 = 0
+ss1_end:
+ if0 $t0 goto :if11_else
+ goto :if11_end
+if11_else:
+ $t0 = [$s0]
+ $t0 = [$t0+56]
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call $t0
+if11_end:
+ goto :if10_end
+if10_else:
+ $t0 = [$s0]
+ $t0 = [$t0+56]
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call $t0
+if10_end:
+ $s5 = 1
+ $s4 = 0
+if8_end:
+if6_end:
+ $s6 = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+ if $s2 goto :null38
+ Error("null pointer")
+null38:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if12_else
+ $t0 = [$s0]
+ $t0 = [$t0+64]
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call $t0
+ goto :if12_end
+if12_else:
+ if $s2 goto :null39
+ Error("null pointer")
+null39:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if13_else
+ $t0 = [$s0]
+ $t0 = [$t0+60]
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call $t0
+ goto :if13_end
+if13_else:
+ if $s2 goto :null40
+ Error("null pointer")
+null40:
+ $t0 = [$s2]
+ $t0 = [$t0+20]
+ $a0 = $s2
+ call $t0
+ $s2 = $v0
+ if $s1 goto :null41
+ Error("null pointer")
+null41:
+ $t0 = [$s1]
+ $t0 = [$t0+16]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null42
+ Error("null pointer")
+null42:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $t0 = [$s0]
+ $t0 = [$t0+44]
+ $a0 = $s0
+ $a1 = $s2
+ $a2 = $t1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if14_else
+ if $s1 goto :null43
+ Error("null pointer")
+null43:
+ $t0 = [$s1]
+ $t0 = [$t0+8]
+ $t1 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t1
+ call $t0
+ if $s1 goto :null44
+ Error("null pointer")
+null44:
+ $t1 = [$s1]
+ $t1 = [$t1+36]
+ $a0 = $s1
+ $a1 = 0
+ call $t1
+ goto :if14_end
+if14_else:
+ if $s1 goto :null45
+ Error("null pointer")
+null45:
+ $t1 = [$s1]
+ $t1 = [$t1+4]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null46
+ Error("null pointer")
+null46:
+ $t0 = [$s1]
+ $t0 = [$t0+40]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while3_top:
+ if $s2 goto :null47
+ Error("null pointer")
+null47:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :while3_end
+ if $s2 goto :null48
+ Error("null pointer")
+null48:
+ $s3 = [$s2]
+ $s3 = [$s3+24]
+ if $s2 goto :null49
+ Error("null pointer")
+null49:
+ $t0 = [$s2]
+ $t0 = [$t0+12]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null50
+ Error("null pointer")
+null50:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $a0 = $s2
+ $a1 = $t1
+ call $s3
+ $s1 = $s2
+ if $s2 goto :null51
+ Error("null pointer")
+null51:
+ $t1 = [$s2]
+ $t1 = [$t1+12]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :while3_top
+while3_end:
+ if $s1 goto :null52
+ Error("null pointer")
+null52:
+ $t1 = [$s1]
+ $t1 = [$t1+4]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null53
+ Error("null pointer")
+null53:
+ $t0 = [$s1]
+ $t0 = [$t0+40]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while4_top:
+ if $s2 goto :null54
+ Error("null pointer")
+null54:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :while4_end
+ if $s2 goto :null55
+ Error("null pointer")
+null55:
+ $s3 = [$s2]
+ $s3 = [$s3+24]
+ if $s2 goto :null56
+ Error("null pointer")
+null56:
+ $t0 = [$s2]
+ $t0 = [$t0+16]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null57
+ Error("null pointer")
+null57:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $a0 = $s2
+ $a1 = $t1
+ call $s3
+ $s1 = $s2
+ if $s2 goto :null58
+ Error("null pointer")
+null58:
+ $t1 = [$s2]
+ $t1 = [$t1+16]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :while4_top
+while4_end:
+ if $s1 goto :null59
+ Error("null pointer")
+null59:
+ $t1 = [$s1]
+ $t1 = [$t1+8]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null60
+ Error("null pointer")
+null60:
+ $t0 = [$s1]
+ $t0 = [$t0+36]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 1
+ $s3 = 0
+while5_top:
+ if0 $s2 goto :while5_end
+ if $s1 goto :null61
+ Error("null pointer")
+null61:
+ $t0 = [$s1]
+ $t0 = [$t0+20]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $t1 = LtS($s0 $t0)
+ if0 $t1 goto :if15_else
+ if $s1 goto :null62
+ Error("null pointer")
+null62:
+ $t1 = [$s1]
+ $t1 = [$t1+32]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if16_else
+ if $s1 goto :null63
+ Error("null pointer")
+null63:
+ $t1 = [$s1]
+ $t1 = [$t1+16]
+ $a0 = $s1
+ call $t1
+ $s1 = $v0
+ goto :if16_end
+if16_else:
+ $s2 = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0 = LtS($t0 $s0)
+ if0 $t0 goto :if17_else
+ if $s1 goto :null64
+ Error("null pointer")
+null64:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if18_else
+ if $s1 goto :null65
+ Error("null pointer")
+null65:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $s1 = $v0
+ goto :if18_end
+if18_else:
+ $s2 = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3 = 1
+ $s2 = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $t0
+ $t2 = [$t0]
+ $t2 = [$t2+76]
+ $a0 = $t0
+ $a1 = $t1
+ call $t2
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null66
+ Error("null pointer")
+null66:
+ $t0 = [$s1]
+ $t0 = [$t0+32]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if19_else
+ $s2 = [$s0]
+ $s2 = [$s2+76]
+ if $s1 goto :null67
+ Error("null pointer")
+null67:
+ $t0 = [$s1]
+ $t0 = [$t0+16]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call $s2
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1 goto :null68
+ Error("null pointer")
+null68:
+ $t0 = [$s1]
+ $t0 = [$t0+20]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s1 goto :null69
+ Error("null pointer")
+null69:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if20_else
+ $s2 = [$s0]
+ $s2 = [$s2+76]
+ if $s1 goto :null70
+ Error("null pointer")
+null70:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call $s2
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
diff --git a/vaporize/tests/BubbleSort.names.vaporm b/vaporize/tests/BubbleSort.names.vaporm
new file mode 100644
index 0000000..9984ffe
--- /dev/null
+++ b/vaporize/tests/BubbleSort.names.vaporm
@@ -0,0 +1,316 @@
+const vmt_BBS
+ :BBS.Start
+ :BBS.Sort
+ :BBS.Print
+ :BBS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(12)
+ [$t0{t.0}] = :vmt_BBS
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func BBS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $t1{t.0} = [$s0{this}]
+ $t1{t.0} = [$t1{t.0}+12]
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call $t1{t.0}
+ $t1{t.1} = [$s0{this}]
+ $t1{t.1} = [$t1{t.1}+8]
+ $a0 = $s0{this}
+ call $t1{t.1}
+ PrintIntS(99999)
+ $t1{t.2} = [$s0{this}]
+ $t1{t.2} = [$t1{t.2}+4]
+ $a0 = $s0{this}
+ call $t1{t.2}
+ $t1{t.3} = [$s0{this}]
+ $t1{t.3} = [$t1{t.3}+8]
+ $a0 = $s0{this}
+ call $t1{t.3}
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func BBS.Sort [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{t.0} = [$t0{this}+8]
+ $t1{i} = Sub($t1{t.0} 1)
+ $t2{aux02} = Sub(0 1)
+while1_top:
+ $t3{t.1} = LtS($t2{aux02} $t1{i})
+ if0 $t3{t.1} goto :while1_end
+ $t3{j} = 1
+while2_top:
+ $t4{t.2} = Add($t1{i} 1)
+ $t4{t.3} = LtS($t3{j} $t4{t.2})
+ if0 $t4{t.3} goto :while2_end
+ $t4{aux07} = Sub($t3{j} 1)
+ $t5{t.4} = [$t0{this}+4]
+ if $t5{t.4} goto :null2
+ Error("null pointer")
+null2:
+ $t6{t.5} = [$t5{t.4}]
+ $t6{t.5} = Lt($t4{aux07} $t6{t.5})
+ if $t6{t.5} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t6{t.5} = MulS($t4{aux07} 4)
+ $t6{t.5} = Add($t6{t.5} $t5{t.4})
+ $t6{aux04} = [$t6{t.5}+4]
+ $t5{t.6} = [$t0{this}+4]
+ if $t5{t.6} goto :null3
+ Error("null pointer")
+null3:
+ $t4{t.7} = [$t5{t.6}]
+ $t4{t.7} = Lt($t3{j} $t4{t.7})
+ if $t4{t.7} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t4{t.7} = MulS($t3{j} 4)
+ $t4{t.7} = Add($t4{t.7} $t5{t.6})
+ $t4{aux05} = [$t4{t.7}+4]
+ $t4{t.8} = LtS($t4{aux05} $t6{aux04})
+ if0 $t4{t.8} goto :if1_else
+ $t4{aux06} = Sub($t3{j} 1)
+ $t6{t.9} = [$t0{this}+4]
+ if $t6{t.9} goto :null4
+ Error("null pointer")
+null4:
+ $t5{t.10} = [$t6{t.9}]
+ $t5{t.10} = Lt($t4{aux06} $t5{t.10})
+ if $t5{t.10} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5{t.10} = MulS($t4{aux06} 4)
+ $t5{t.10} = Add($t5{t.10} $t6{t.9})
+ $t5{t} = [$t5{t.10}+4]
+ $t6{t.11} = [$t0{this}+4]
+ if $t6{t.11} goto :null5
+ Error("null pointer")
+null5:
+ $t7{t.12} = [$t6{t.11}]
+ $t7{t.12} = Lt($t4{aux06} $t7{t.12})
+ if $t7{t.12} goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7{t.12} = MulS($t4{aux06} 4)
+ $t7{t.12} = Add($t7{t.12} $t6{t.11})
+ $t6{t.13} = [$t0{this}+4]
+ if $t6{t.13} goto :null6
+ Error("null pointer")
+null6:
+ $t4{t.14} = [$t6{t.13}]
+ $t4{t.14} = Lt($t3{j} $t4{t.14})
+ if $t4{t.14} goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t4{t.14} = MulS($t3{j} 4)
+ $t4{t.14} = Add($t4{t.14} $t6{t.13})
+ $t4{t.15} = [$t4{t.14}+4]
+ [$t7{t.12}+4] = $t4{t.15}
+ $t4{t.16} = [$t0{this}+4]
+ if $t4{t.16} goto :null7
+ Error("null pointer")
+null7:
+ $t7{t.17} = [$t4{t.16}]
+ $t7{t.17} = Lt($t3{j} $t7{t.17})
+ if $t7{t.17} goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t7{t.17} = MulS($t3{j} 4)
+ $t7{t.17} = Add($t7{t.17} $t4{t.16})
+ [$t7{t.17}+4] = $t5{t}
+ goto :if1_end
+if1_else:
+if1_end:
+ $t3{j} = Add($t3{j} 1)
+ goto :while2_top
+while2_end:
+ $t1{i} = Sub($t1{i} 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func BBS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 0
+while3_top:
+ $t2{t.0} = [$t0{this}+8]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while3_end
+ $t2{t.2} = [$t0{this}+4]
+ if $t2{t.2} goto :null8
+ Error("null pointer")
+null8:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ ret
+
+func BBS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+8] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}+4] = $t0{t.0}
+ $t0{t.1} = [$s0{this}+4]
+ if $t0{t.1} goto :null9
+ Error("null pointer")
+null9:
+ $t1{t.2} = [$t0{t.1}]
+ $t1{t.2} = Lt(0 $t1{t.2})
+ if $t1{t.2} goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t1{t.2} = MulS(0 4)
+ $t1{t.2} = Add($t1{t.2} $t0{t.1})
+ [$t1{t.2}+4] = 20
+ $t1{t.3} = [$s0{this}+4]
+ if $t1{t.3} goto :null10
+ Error("null pointer")
+null10:
+ $t0{t.4} = [$t1{t.3}]
+ $t0{t.4} = Lt(1 $t0{t.4})
+ if $t0{t.4} goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t0{t.4} = MulS(1 4)
+ $t0{t.4} = Add($t0{t.4} $t1{t.3})
+ [$t0{t.4}+4] = 7
+ $t0{t.5} = [$s0{this}+4]
+ if $t0{t.5} goto :null11
+ Error("null pointer")
+null11:
+ $t1{t.6} = [$t0{t.5}]
+ $t1{t.6} = Lt(2 $t1{t.6})
+ if $t1{t.6} goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t1{t.6} = MulS(2 4)
+ $t1{t.6} = Add($t1{t.6} $t0{t.5})
+ [$t1{t.6}+4] = 12
+ $t1{t.7} = [$s0{this}+4]
+ if $t1{t.7} goto :null12
+ Error("null pointer")
+null12:
+ $t0{t.8} = [$t1{t.7}]
+ $t0{t.8} = Lt(3 $t0{t.8})
+ if $t0{t.8} goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t0{t.8} = MulS(3 4)
+ $t0{t.8} = Add($t0{t.8} $t1{t.7})
+ [$t0{t.8}+4] = 18
+ $t0{t.9} = [$s0{this}+4]
+ if $t0{t.9} goto :null13
+ Error("null pointer")
+null13:
+ $t1{t.10} = [$t0{t.9}]
+ $t1{t.10} = Lt(4 $t1{t.10})
+ if $t1{t.10} goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t1{t.10} = MulS(4 4)
+ $t1{t.10} = Add($t1{t.10} $t0{t.9})
+ [$t1{t.10}+4] = 2
+ $t1{t.11} = [$s0{this}+4]
+ if $t1{t.11} goto :null14
+ Error("null pointer")
+null14:
+ $t0{t.12} = [$t1{t.11}]
+ $t0{t.12} = Lt(5 $t0{t.12})
+ if $t0{t.12} goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t0{t.12} = MulS(5 4)
+ $t0{t.12} = Add($t0{t.12} $t1{t.11})
+ [$t0{t.12}+4] = 11
+ $t0{t.13} = [$s0{this}+4]
+ if $t0{t.13} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.14} = [$t0{t.13}]
+ $t1{t.14} = Lt(6 $t1{t.14})
+ if $t1{t.14} goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1{t.14} = MulS(6 4)
+ $t1{t.14} = Add($t1{t.14} $t0{t.13})
+ [$t1{t.14}+4] = 6
+ $t1{t.15} = [$s0{this}+4]
+ if $t1{t.15} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.16} = [$t1{t.15}]
+ $t0{t.16} = Lt(7 $t0{t.16})
+ if $t0{t.16} goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0{t.16} = MulS(7 4)
+ $t0{t.16} = Add($t0{t.16} $t1{t.15})
+ [$t0{t.16}+4] = 9
+ $t0{t.17} = [$s0{this}+4]
+ if $t0{t.17} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.18} = [$t0{t.17}]
+ $t1{t.18} = Lt(8 $t1{t.18})
+ if $t1{t.18} goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1{t.18} = MulS(8 4)
+ $t1{t.18} = Add($t1{t.18} $t0{t.17})
+ [$t1{t.18}+4] = 19
+ $t1{t.19} = [$s0{this}+4]
+ if $t1{t.19} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.20} = [$t1{t.19}]
+ $t0{t.20} = Lt(9 $t0{t.20})
+ if $t0{t.20} goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0{t.20} = MulS(9 4)
+ $t0{t.20} = Add($t0{t.20} $t1{t.19})
+ [$t0{t.20}+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/BubbleSort.opt.names.vaporm b/vaporize/tests/BubbleSort.opt.names.vaporm
new file mode 100644
index 0000000..943b295
--- /dev/null
+++ b/vaporize/tests/BubbleSort.opt.names.vaporm
@@ -0,0 +1,301 @@
+const empty_BBS
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(8)
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call :BBS.Start
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ ret
+
+func BBS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call :BBS.Init
+ $a0 = $s0{this}
+ call :BBS.Print
+ PrintIntS(99999)
+ $a0 = $s0{this}
+ call :BBS.Sort
+ $a0 = $s0{this}
+ call :BBS.Print
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func BBS.Sort [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{t.0} = [$t0{this}+4]
+ $t1{i} = Sub($t1{t.0} 1)
+ $t2{aux02} = Sub(0 1)
+while1_top:
+ $t3{t.1} = LtS($t2{aux02} $t1{i})
+ if0 $t3{t.1} goto :while1_end
+ $t3{j} = 1
+while2_top:
+ $t4{t.2} = Add($t1{i} 1)
+ $t4{t.3} = LtS($t3{j} $t4{t.2})
+ if0 $t4{t.3} goto :while2_end
+ $t4{aux07} = Sub($t3{j} 1)
+ $t5{t.4} = [$t0{this}]
+ if $t5{t.4} goto :null2
+ Error("null pointer")
+null2:
+ $t6{t.5} = [$t5{t.4}]
+ $t6{t.5} = Lt($t4{aux07} $t6{t.5})
+ if $t6{t.5} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t6{t.5} = MulS($t4{aux07} 4)
+ $t6{t.5} = Add($t6{t.5} $t5{t.4})
+ $t6{aux04} = [$t6{t.5}+4]
+ $t5{t.6} = [$t0{this}]
+ if $t5{t.6} goto :null3
+ Error("null pointer")
+null3:
+ $t4{t.7} = [$t5{t.6}]
+ $t4{t.7} = Lt($t3{j} $t4{t.7})
+ if $t4{t.7} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t4{t.7} = MulS($t3{j} 4)
+ $t4{t.7} = Add($t4{t.7} $t5{t.6})
+ $t4{aux05} = [$t4{t.7}+4]
+ $t4{t.8} = LtS($t4{aux05} $t6{aux04})
+ if0 $t4{t.8} goto :if1_else
+ $t4{aux06} = Sub($t3{j} 1)
+ $t6{t.9} = [$t0{this}]
+ if $t6{t.9} goto :null4
+ Error("null pointer")
+null4:
+ $t5{t.10} = [$t6{t.9}]
+ $t5{t.10} = Lt($t4{aux06} $t5{t.10})
+ if $t5{t.10} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5{t.10} = MulS($t4{aux06} 4)
+ $t5{t.10} = Add($t5{t.10} $t6{t.9})
+ $t5{t} = [$t5{t.10}+4]
+ $t6{t.11} = [$t0{this}]
+ if $t6{t.11} goto :null5
+ Error("null pointer")
+null5:
+ $t7{t.12} = [$t6{t.11}]
+ $t7{t.12} = Lt($t4{aux06} $t7{t.12})
+ if $t7{t.12} goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7{t.12} = MulS($t4{aux06} 4)
+ $t7{t.12} = Add($t7{t.12} $t6{t.11})
+ $t6{t.13} = [$t0{this}]
+ if $t6{t.13} goto :null6
+ Error("null pointer")
+null6:
+ $t4{t.14} = [$t6{t.13}]
+ $t4{t.14} = Lt($t3{j} $t4{t.14})
+ if $t4{t.14} goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t4{t.14} = MulS($t3{j} 4)
+ $t4{t.14} = Add($t4{t.14} $t6{t.13})
+ $t4{t.15} = [$t4{t.14}+4]
+ [$t7{t.12}+4] = $t4{t.15}
+ $t4{t.16} = [$t0{this}]
+ if $t4{t.16} goto :null7
+ Error("null pointer")
+null7:
+ $t7{t.17} = [$t4{t.16}]
+ $t7{t.17} = Lt($t3{j} $t7{t.17})
+ if $t7{t.17} goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t7{t.17} = MulS($t3{j} 4)
+ $t7{t.17} = Add($t7{t.17} $t4{t.16})
+ [$t7{t.17}+4] = $t5{t}
+ goto :if1_end
+if1_else:
+if1_end:
+ $t3{j} = Add($t3{j} 1)
+ goto :while2_top
+while2_end:
+ $t1{i} = Sub($t1{i} 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func BBS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 0
+while3_top:
+ $t2{t.0} = [$t0{this}+4]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while3_end
+ $t2{t.2} = [$t0{this}]
+ if $t2{t.2} goto :null8
+ Error("null pointer")
+null8:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ ret
+
+func BBS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+4] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}] = $t0{t.0}
+ $t0{t.1} = [$s0{this}]
+ if $t0{t.1} goto :null9
+ Error("null pointer")
+null9:
+ $t1{t.2} = [$t0{t.1}]
+ $t1{t.2} = Lt(0 $t1{t.2})
+ if $t1{t.2} goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t1{t.2} = MulS(0 4)
+ $t1{t.2} = Add($t1{t.2} $t0{t.1})
+ [$t1{t.2}+4] = 20
+ $t1{t.3} = [$s0{this}]
+ if $t1{t.3} goto :null10
+ Error("null pointer")
+null10:
+ $t0{t.4} = [$t1{t.3}]
+ $t0{t.4} = Lt(1 $t0{t.4})
+ if $t0{t.4} goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t0{t.4} = MulS(1 4)
+ $t0{t.4} = Add($t0{t.4} $t1{t.3})
+ [$t0{t.4}+4] = 7
+ $t0{t.5} = [$s0{this}]
+ if $t0{t.5} goto :null11
+ Error("null pointer")
+null11:
+ $t1{t.6} = [$t0{t.5}]
+ $t1{t.6} = Lt(2 $t1{t.6})
+ if $t1{t.6} goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t1{t.6} = MulS(2 4)
+ $t1{t.6} = Add($t1{t.6} $t0{t.5})
+ [$t1{t.6}+4] = 12
+ $t1{t.7} = [$s0{this}]
+ if $t1{t.7} goto :null12
+ Error("null pointer")
+null12:
+ $t0{t.8} = [$t1{t.7}]
+ $t0{t.8} = Lt(3 $t0{t.8})
+ if $t0{t.8} goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t0{t.8} = MulS(3 4)
+ $t0{t.8} = Add($t0{t.8} $t1{t.7})
+ [$t0{t.8}+4] = 18
+ $t0{t.9} = [$s0{this}]
+ if $t0{t.9} goto :null13
+ Error("null pointer")
+null13:
+ $t1{t.10} = [$t0{t.9}]
+ $t1{t.10} = Lt(4 $t1{t.10})
+ if $t1{t.10} goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t1{t.10} = MulS(4 4)
+ $t1{t.10} = Add($t1{t.10} $t0{t.9})
+ [$t1{t.10}+4] = 2
+ $t1{t.11} = [$s0{this}]
+ if $t1{t.11} goto :null14
+ Error("null pointer")
+null14:
+ $t0{t.12} = [$t1{t.11}]
+ $t0{t.12} = Lt(5 $t0{t.12})
+ if $t0{t.12} goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t0{t.12} = MulS(5 4)
+ $t0{t.12} = Add($t0{t.12} $t1{t.11})
+ [$t0{t.12}+4] = 11
+ $t0{t.13} = [$s0{this}]
+ if $t0{t.13} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.14} = [$t0{t.13}]
+ $t1{t.14} = Lt(6 $t1{t.14})
+ if $t1{t.14} goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1{t.14} = MulS(6 4)
+ $t1{t.14} = Add($t1{t.14} $t0{t.13})
+ [$t1{t.14}+4] = 6
+ $t1{t.15} = [$s0{this}]
+ if $t1{t.15} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.16} = [$t1{t.15}]
+ $t0{t.16} = Lt(7 $t0{t.16})
+ if $t0{t.16} goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0{t.16} = MulS(7 4)
+ $t0{t.16} = Add($t0{t.16} $t1{t.15})
+ [$t0{t.16}+4] = 9
+ $t0{t.17} = [$s0{this}]
+ if $t0{t.17} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.18} = [$t0{t.17}]
+ $t1{t.18} = Lt(8 $t1{t.18})
+ if $t1{t.18} goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1{t.18} = MulS(8 4)
+ $t1{t.18} = Add($t1{t.18} $t0{t.17})
+ [$t1{t.18}+4] = 19
+ $t1{t.19} = [$s0{this}]
+ if $t1{t.19} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.20} = [$t1{t.19}]
+ $t0{t.20} = Lt(9 $t0{t.20})
+ if $t0{t.20} goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0{t.20} = MulS(9 4)
+ $t0{t.20} = Add($t0{t.20} $t1{t.19})
+ [$t0{t.20}+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/BubbleSort.opt.regalloc b/vaporize/tests/BubbleSort.opt.regalloc
new file mode 100644
index 0000000..5696e19
--- /dev/null
+++ b/vaporize/tests/BubbleSort.opt.regalloc
@@ -0,0 +1,230 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 7 10
+ t.1: 11
+Linear Range:
+ t.0: 6-10
+ t.1: 10-11
+Allocation:
+ t.0: t0
+ t.1: t0
+
+func BBS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 15-19
+ sz: 15
+ aux01:
+Linear Range:
+ this: 14-19 (cross call)
+ sz: 14-15
+Allocation:
+ this: s0
+ sz: t0
+
+func BBS.Sort
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 23-36 39-41 44-48 51-53 56-63 66-68 71-75 78-80 83-86 89-91 94-99 102-104 107-118
+ t.0: 24
+ i: 25-36 39-41 44-48 51-53 56-63 66-68 71-75 78-80 83-86 89-91 94-99 102-104 107-118
+ aux02: 27-36 39-41 44-48 51-53 56-63 66-68 71-75 78-80 83-86 89-91 94-99 102-104 107-118
+ t.1: 28
+ j: 31-36 39-41 44-48 51-53 56-63 66-68 71-75 78-80 83-86 89-91 94-99 102-104 107-115
+ t.2: 32
+ t.3: 33
+ aux07: 35-36 39-41 44
+ t.4: 36 39-41 44-45
+ t.5: 40-41 45-46
+ aux04: 47-48 51-53 56-59
+ t.6: 48 51-53 56-57
+ t.7: 52-53 57-58
+ aux05: 59
+ t.8: 60
+ aux06: 62-63 66-68 71-75 78-80 83
+ t.9: 63 66-68 71-72
+ t.10: 67-68 72-73
+ t: 74-75 78-80 83-86 89-91 94-99 102-104 107-109
+ t.11: 75 78-80 83-84
+ t.12: 79-80 84-86 89-91 94-97
+ t.13: 86 89-91 94-95
+ t.14: 90-91 95-96
+ t.15: 97
+ t.16: 99 102-104 107-108
+ t.17: 103-104 108-109
+ nt:
+Linear Range:
+ this: 22-118
+ t.0: 23-24
+ i: 24-118
+ aux02: 25-118
+ t.1: 27-28
+ j: 29-115
+ t.2: 31-32
+ t.3: 32-33
+ aux07: 34-44
+ t.4: 35-45
+ t.5: 39-46
+ aux04: 46-59
+ t.6: 47-57
+ t.7: 51-58
+ aux05: 58-59
+ t.8: 59-60
+ aux06: 61-83
+ t.9: 62-72
+ t.10: 66-73
+ t: 73-109
+ t.11: 74-84
+ t.12: 78-97
+ t.13: 85-95
+ t.14: 89-96
+ t.15: 96-97
+ t.16: 98-108
+ t.17: 102-109
+Allocation:
+ this: t0
+ t.0: t1
+ i: t1
+ aux02: t2
+ t.1: t3
+ j: t3
+ t.2: t4
+ t.3: t4
+ aux07: t4
+ t.4: t5
+ t.5: t6
+ aux04: t6
+ t.6: t5
+ t.7: t4
+ aux05: t4
+ t.8: t4
+ aux06: t4
+ t.9: t6
+ t.10: t5
+ t: t5
+ t.11: t6
+ t.12: t7
+ t.13: t6
+ t.14: t4
+ t.15: t4
+ t.16: t4
+ t.17: t7
+
+func BBS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 123-129 132-134 137-142
+ j: 125-129 132-134 137-142
+ t.0: 126
+ t.1: 127
+ t.2: 129 132-134 137-138
+ t.3: 133-134 138-139
+ t.4: 140
+Linear Range:
+ this: 122-142
+ j: 123-142
+ t.0: 125-126
+ t.1: 126-127
+ t.2: 128-138
+ t.3: 132-139
+ t.4: 139-140
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func BBS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 147-151 154-156 159-163 166-168 171-175 178-180 183-187 190-192 195-199 202-204 207-211 214-216 219-223 226-228 231-235 238-240 243-247 250-252 255-258
+ sz: 147-148
+ t.0: 149
+ t.1: 151 154-156 159-160
+ t.2: 155-156 160-161
+ t.3: 163 166-168 171-172
+ t.4: 167-168 172-173
+ t.5: 175 178-180 183-184
+ t.6: 179-180 184-185
+ t.7: 187 190-192 195-196
+ t.8: 191-192 196-197
+ t.9: 199 202-204 207-208
+ t.10: 203-204 208-209
+ t.11: 211 214-216 219-220
+ t.12: 215-216 220-221
+ t.13: 223 226-228 231-232
+ t.14: 227-228 232-233
+ t.15: 235 238-240 243-244
+ t.16: 239-240 244-245
+ t.17: 247 250-252 255-256
+ t.18: 251-252 256-257
+ t.19: 259 262-264 267-268
+ t.20: 263-264 268-269
+Linear Range:
+ this: 146-258 (cross call)
+ sz: 146-148
+ t.0: 148-149
+ t.1: 150-160
+ t.2: 154-161
+ t.3: 162-172
+ t.4: 166-173
+ t.5: 174-184
+ t.6: 178-185
+ t.7: 186-196
+ t.8: 190-197
+ t.9: 198-208
+ t.10: 202-209
+ t.11: 210-220
+ t.12: 214-221
+ t.13: 222-232
+ t.14: 226-233
+ t.15: 234-244
+ t.16: 238-245
+ t.17: 246-256
+ t.18: 250-257
+ t.19: 258-268
+ t.20: 262-269
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ t.1: t0
+ t.2: t1
+ t.3: t1
+ t.4: t0
+ t.5: t0
+ t.6: t1
+ t.7: t1
+ t.8: t0
+ t.9: t0
+ t.10: t1
+ t.11: t1
+ t.12: t0
+ t.13: t0
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+ t.18: t1
+ t.19: t1
+ t.20: t0
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 273-276
+ bytes: 274-275
+ v: 276-277
+Linear Range:
+ size: 272-276
+ bytes: 273-275
+ v: 275-277
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/BubbleSort.opt.vaporm b/vaporize/tests/BubbleSort.opt.vaporm
new file mode 100644
index 0000000..41c6ac4
--- /dev/null
+++ b/vaporize/tests/BubbleSort.opt.vaporm
@@ -0,0 +1,301 @@
+const empty_BBS
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(8)
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0
+ $a1 = 10
+ call :BBS.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func BBS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $a0 = $s0
+ $a1 = $t0
+ call :BBS.Init
+ $a0 = $s0
+ call :BBS.Print
+ PrintIntS(99999)
+ $a0 = $s0
+ call :BBS.Sort
+ $a0 = $s0
+ call :BBS.Print
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func BBS.Sort [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = [$t0+4]
+ $t1 = Sub($t1 1)
+ $t2 = Sub(0 1)
+while1_top:
+ $t3 = LtS($t2 $t1)
+ if0 $t3 goto :while1_end
+ $t3 = 1
+while2_top:
+ $t4 = Add($t1 1)
+ $t4 = LtS($t3 $t4)
+ if0 $t4 goto :while2_end
+ $t4 = Sub($t3 1)
+ $t5 = [$t0]
+ if $t5 goto :null2
+ Error("null pointer")
+null2:
+ $t6 = [$t5]
+ $t6 = Lt($t4 $t6)
+ if $t6 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t6 = MulS($t4 4)
+ $t6 = Add($t6 $t5)
+ $t6 = [$t6+4]
+ $t5 = [$t0]
+ if $t5 goto :null3
+ Error("null pointer")
+null3:
+ $t4 = [$t5]
+ $t4 = Lt($t3 $t4)
+ if $t4 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t4 = MulS($t3 4)
+ $t4 = Add($t4 $t5)
+ $t4 = [$t4+4]
+ $t4 = LtS($t4 $t6)
+ if0 $t4 goto :if1_else
+ $t4 = Sub($t3 1)
+ $t6 = [$t0]
+ if $t6 goto :null4
+ Error("null pointer")
+null4:
+ $t5 = [$t6]
+ $t5 = Lt($t4 $t5)
+ if $t5 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5 = MulS($t4 4)
+ $t5 = Add($t5 $t6)
+ $t5 = [$t5+4]
+ $t6 = [$t0]
+ if $t6 goto :null5
+ Error("null pointer")
+null5:
+ $t7 = [$t6]
+ $t7 = Lt($t4 $t7)
+ if $t7 goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7 = MulS($t4 4)
+ $t7 = Add($t7 $t6)
+ $t6 = [$t0]
+ if $t6 goto :null6
+ Error("null pointer")
+null6:
+ $t4 = [$t6]
+ $t4 = Lt($t3 $t4)
+ if $t4 goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t4 = MulS($t3 4)
+ $t4 = Add($t4 $t6)
+ $t4 = [$t4+4]
+ [$t7+4] = $t4
+ $t4 = [$t0]
+ if $t4 goto :null7
+ Error("null pointer")
+null7:
+ $t7 = [$t4]
+ $t7 = Lt($t3 $t7)
+ if $t7 goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t7 = MulS($t3 4)
+ $t7 = Add($t7 $t4)
+ [$t7+4] = $t5
+ goto :if1_end
+if1_else:
+if1_end:
+ $t3 = Add($t3 1)
+ goto :while2_top
+while2_end:
+ $t1 = Sub($t1 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func BBS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 0
+while3_top:
+ $t2 = [$t0+4]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while3_end
+ $t2 = [$t0]
+ if $t2 goto :null8
+ Error("null pointer")
+null8:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ ret
+
+func BBS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+4] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0] = $t0
+ $t0 = [$s0]
+ if $t0 goto :null9
+ Error("null pointer")
+null9:
+ $t1 = [$t0]
+ $t1 = Lt(0 $t1)
+ if $t1 goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t1 = MulS(0 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 20
+ $t1 = [$s0]
+ if $t1 goto :null10
+ Error("null pointer")
+null10:
+ $t0 = [$t1]
+ $t0 = Lt(1 $t0)
+ if $t0 goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t0 = MulS(1 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 7
+ $t0 = [$s0]
+ if $t0 goto :null11
+ Error("null pointer")
+null11:
+ $t1 = [$t0]
+ $t1 = Lt(2 $t1)
+ if $t1 goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t1 = MulS(2 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 12
+ $t1 = [$s0]
+ if $t1 goto :null12
+ Error("null pointer")
+null12:
+ $t0 = [$t1]
+ $t0 = Lt(3 $t0)
+ if $t0 goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t0 = MulS(3 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 18
+ $t0 = [$s0]
+ if $t0 goto :null13
+ Error("null pointer")
+null13:
+ $t1 = [$t0]
+ $t1 = Lt(4 $t1)
+ if $t1 goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t1 = MulS(4 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 2
+ $t1 = [$s0]
+ if $t1 goto :null14
+ Error("null pointer")
+null14:
+ $t0 = [$t1]
+ $t0 = Lt(5 $t0)
+ if $t0 goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t0 = MulS(5 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 11
+ $t0 = [$s0]
+ if $t0 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$t0]
+ $t1 = Lt(6 $t1)
+ if $t1 goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1 = MulS(6 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 6
+ $t1 = [$s0]
+ if $t1 goto :null16
+ Error("null pointer")
+null16:
+ $t0 = [$t1]
+ $t0 = Lt(7 $t0)
+ if $t0 goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0 = MulS(7 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 9
+ $t0 = [$s0]
+ if $t0 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$t0]
+ $t1 = Lt(8 $t1)
+ if $t1 goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1 = MulS(8 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 19
+ $t1 = [$s0]
+ if $t1 goto :null18
+ Error("null pointer")
+null18:
+ $t0 = [$t1]
+ $t0 = Lt(9 $t0)
+ if $t0 goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0 = MulS(9 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/BubbleSort.regalloc b/vaporize/tests/BubbleSort.regalloc
new file mode 100644
index 0000000..bd27d17
--- /dev/null
+++ b/vaporize/tests/BubbleSort.regalloc
@@ -0,0 +1,245 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 11-12 15-17
+ t.1: 16-17
+ t.2: 18
+Linear Range:
+ t.0: 10-17
+ t.1: 15-17
+ t.2: 17-18
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func BBS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 22-34
+ sz: 22-24
+ t.0: 23-24
+ aux01:
+ t.1: 26-27
+ t.2: 30-31
+ t.3: 33-34
+Linear Range:
+ this: 21-34 (cross call)
+ sz: 21-24
+ t.0: 22-24
+ t.1: 25-27
+ t.2: 29-31
+ t.3: 32-34
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t1
+ t.1: t1
+ t.2: t1
+ t.3: t1
+
+func BBS.Sort
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 38-51 54-56 59-63 66-68 71-78 81-83 86-90 93-95 98-101 104-106 109-114 117-119 122-133
+ t.0: 39
+ i: 40-51 54-56 59-63 66-68 71-78 81-83 86-90 93-95 98-101 104-106 109-114 117-119 122-133
+ aux02: 42-51 54-56 59-63 66-68 71-78 81-83 86-90 93-95 98-101 104-106 109-114 117-119 122-133
+ t.1: 43
+ j: 46-51 54-56 59-63 66-68 71-78 81-83 86-90 93-95 98-101 104-106 109-114 117-119 122-130
+ t.2: 47
+ t.3: 48
+ aux07: 50-51 54-56 59
+ t.4: 51 54-56 59-60
+ t.5: 55-56 60-61
+ aux04: 62-63 66-68 71-74
+ t.6: 63 66-68 71-72
+ t.7: 67-68 72-73
+ aux05: 74
+ t.8: 75
+ aux06: 77-78 81-83 86-90 93-95 98
+ t.9: 78 81-83 86-87
+ t.10: 82-83 87-88
+ t: 89-90 93-95 98-101 104-106 109-114 117-119 122-124
+ t.11: 90 93-95 98-99
+ t.12: 94-95 99-101 104-106 109-112
+ t.13: 101 104-106 109-110
+ t.14: 105-106 110-111
+ t.15: 112
+ t.16: 114 117-119 122-123
+ t.17: 118-119 123-124
+ nt:
+Linear Range:
+ this: 37-133
+ t.0: 38-39
+ i: 39-133
+ aux02: 40-133
+ t.1: 42-43
+ j: 44-130
+ t.2: 46-47
+ t.3: 47-48
+ aux07: 49-59
+ t.4: 50-60
+ t.5: 54-61
+ aux04: 61-74
+ t.6: 62-72
+ t.7: 66-73
+ aux05: 73-74
+ t.8: 74-75
+ aux06: 76-98
+ t.9: 77-87
+ t.10: 81-88
+ t: 88-124
+ t.11: 89-99
+ t.12: 93-112
+ t.13: 100-110
+ t.14: 104-111
+ t.15: 111-112
+ t.16: 113-123
+ t.17: 117-124
+Allocation:
+ this: t0
+ t.0: t1
+ i: t1
+ aux02: t2
+ t.1: t3
+ j: t3
+ t.2: t4
+ t.3: t4
+ aux07: t4
+ t.4: t5
+ t.5: t6
+ aux04: t6
+ t.6: t5
+ t.7: t4
+ aux05: t4
+ t.8: t4
+ aux06: t4
+ t.9: t6
+ t.10: t5
+ t: t5
+ t.11: t6
+ t.12: t7
+ t.13: t6
+ t.14: t4
+ t.15: t4
+ t.16: t4
+ t.17: t7
+
+func BBS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 138-144 147-149 152-157
+ j: 140-144 147-149 152-157
+ t.0: 141
+ t.1: 142
+ t.2: 144 147-149 152-153
+ t.3: 148-149 153-154
+ t.4: 155
+Linear Range:
+ this: 137-157
+ j: 138-157
+ t.0: 140-141
+ t.1: 141-142
+ t.2: 143-153
+ t.3: 147-154
+ t.4: 154-155
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func BBS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 162-166 169-171 174-178 181-183 186-190 193-195 198-202 205-207 210-214 217-219 222-226 229-231 234-238 241-243 246-250 253-255 258-262 265-267 270-273
+ sz: 162-163
+ t.0: 164
+ t.1: 166 169-171 174-175
+ t.2: 170-171 175-176
+ t.3: 178 181-183 186-187
+ t.4: 182-183 187-188
+ t.5: 190 193-195 198-199
+ t.6: 194-195 199-200
+ t.7: 202 205-207 210-211
+ t.8: 206-207 211-212
+ t.9: 214 217-219 222-223
+ t.10: 218-219 223-224
+ t.11: 226 229-231 234-235
+ t.12: 230-231 235-236
+ t.13: 238 241-243 246-247
+ t.14: 242-243 247-248
+ t.15: 250 253-255 258-259
+ t.16: 254-255 259-260
+ t.17: 262 265-267 270-271
+ t.18: 266-267 271-272
+ t.19: 274 277-279 282-283
+ t.20: 278-279 283-284
+Linear Range:
+ this: 161-273 (cross call)
+ sz: 161-163
+ t.0: 163-164
+ t.1: 165-175
+ t.2: 169-176
+ t.3: 177-187
+ t.4: 181-188
+ t.5: 189-199
+ t.6: 193-200
+ t.7: 201-211
+ t.8: 205-212
+ t.9: 213-223
+ t.10: 217-224
+ t.11: 225-235
+ t.12: 229-236
+ t.13: 237-247
+ t.14: 241-248
+ t.15: 249-259
+ t.16: 253-260
+ t.17: 261-271
+ t.18: 265-272
+ t.19: 273-283
+ t.20: 277-284
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ t.1: t0
+ t.2: t1
+ t.3: t1
+ t.4: t0
+ t.5: t0
+ t.6: t1
+ t.7: t1
+ t.8: t0
+ t.9: t0
+ t.10: t1
+ t.11: t1
+ t.12: t0
+ t.13: t0
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+ t.18: t1
+ t.19: t1
+ t.20: t0
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 288-291
+ bytes: 289-290
+ v: 291-292
+Linear Range:
+ size: 287-291
+ bytes: 288-290
+ v: 290-292
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/BubbleSort.vaporm b/vaporize/tests/BubbleSort.vaporm
new file mode 100644
index 0000000..f64e2b3
--- /dev/null
+++ b/vaporize/tests/BubbleSort.vaporm
@@ -0,0 +1,316 @@
+const vmt_BBS
+ :BBS.Start
+ :BBS.Sort
+ :BBS.Print
+ :BBS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(12)
+ [$t0] = :vmt_BBS
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ $a1 = 10
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func BBS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $t1 = [$s0]
+ $t1 = [$t1+12]
+ $a0 = $s0
+ $a1 = $t0
+ call $t1
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ call $t1
+ PrintIntS(99999)
+ $t1 = [$s0]
+ $t1 = [$t1+4]
+ $a0 = $s0
+ call $t1
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ call $t1
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func BBS.Sort [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = [$t0+8]
+ $t1 = Sub($t1 1)
+ $t2 = Sub(0 1)
+while1_top:
+ $t3 = LtS($t2 $t1)
+ if0 $t3 goto :while1_end
+ $t3 = 1
+while2_top:
+ $t4 = Add($t1 1)
+ $t4 = LtS($t3 $t4)
+ if0 $t4 goto :while2_end
+ $t4 = Sub($t3 1)
+ $t5 = [$t0+4]
+ if $t5 goto :null2
+ Error("null pointer")
+null2:
+ $t6 = [$t5]
+ $t6 = Lt($t4 $t6)
+ if $t6 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t6 = MulS($t4 4)
+ $t6 = Add($t6 $t5)
+ $t6 = [$t6+4]
+ $t5 = [$t0+4]
+ if $t5 goto :null3
+ Error("null pointer")
+null3:
+ $t4 = [$t5]
+ $t4 = Lt($t3 $t4)
+ if $t4 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t4 = MulS($t3 4)
+ $t4 = Add($t4 $t5)
+ $t4 = [$t4+4]
+ $t4 = LtS($t4 $t6)
+ if0 $t4 goto :if1_else
+ $t4 = Sub($t3 1)
+ $t6 = [$t0+4]
+ if $t6 goto :null4
+ Error("null pointer")
+null4:
+ $t5 = [$t6]
+ $t5 = Lt($t4 $t5)
+ if $t5 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5 = MulS($t4 4)
+ $t5 = Add($t5 $t6)
+ $t5 = [$t5+4]
+ $t6 = [$t0+4]
+ if $t6 goto :null5
+ Error("null pointer")
+null5:
+ $t7 = [$t6]
+ $t7 = Lt($t4 $t7)
+ if $t7 goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7 = MulS($t4 4)
+ $t7 = Add($t7 $t6)
+ $t6 = [$t0+4]
+ if $t6 goto :null6
+ Error("null pointer")
+null6:
+ $t4 = [$t6]
+ $t4 = Lt($t3 $t4)
+ if $t4 goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t4 = MulS($t3 4)
+ $t4 = Add($t4 $t6)
+ $t4 = [$t4+4]
+ [$t7+4] = $t4
+ $t4 = [$t0+4]
+ if $t4 goto :null7
+ Error("null pointer")
+null7:
+ $t7 = [$t4]
+ $t7 = Lt($t3 $t7)
+ if $t7 goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t7 = MulS($t3 4)
+ $t7 = Add($t7 $t4)
+ [$t7+4] = $t5
+ goto :if1_end
+if1_else:
+if1_end:
+ $t3 = Add($t3 1)
+ goto :while2_top
+while2_end:
+ $t1 = Sub($t1 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func BBS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 0
+while3_top:
+ $t2 = [$t0+8]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while3_end
+ $t2 = [$t0+4]
+ if $t2 goto :null8
+ Error("null pointer")
+null8:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ ret
+
+func BBS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+8] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0+4] = $t0
+ $t0 = [$s0+4]
+ if $t0 goto :null9
+ Error("null pointer")
+null9:
+ $t1 = [$t0]
+ $t1 = Lt(0 $t1)
+ if $t1 goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t1 = MulS(0 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 20
+ $t1 = [$s0+4]
+ if $t1 goto :null10
+ Error("null pointer")
+null10:
+ $t0 = [$t1]
+ $t0 = Lt(1 $t0)
+ if $t0 goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t0 = MulS(1 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 7
+ $t0 = [$s0+4]
+ if $t0 goto :null11
+ Error("null pointer")
+null11:
+ $t1 = [$t0]
+ $t1 = Lt(2 $t1)
+ if $t1 goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t1 = MulS(2 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 12
+ $t1 = [$s0+4]
+ if $t1 goto :null12
+ Error("null pointer")
+null12:
+ $t0 = [$t1]
+ $t0 = Lt(3 $t0)
+ if $t0 goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t0 = MulS(3 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 18
+ $t0 = [$s0+4]
+ if $t0 goto :null13
+ Error("null pointer")
+null13:
+ $t1 = [$t0]
+ $t1 = Lt(4 $t1)
+ if $t1 goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t1 = MulS(4 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 2
+ $t1 = [$s0+4]
+ if $t1 goto :null14
+ Error("null pointer")
+null14:
+ $t0 = [$t1]
+ $t0 = Lt(5 $t0)
+ if $t0 goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t0 = MulS(5 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 11
+ $t0 = [$s0+4]
+ if $t0 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$t0]
+ $t1 = Lt(6 $t1)
+ if $t1 goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1 = MulS(6 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 6
+ $t1 = [$s0+4]
+ if $t1 goto :null16
+ Error("null pointer")
+null16:
+ $t0 = [$t1]
+ $t0 = Lt(7 $t0)
+ if $t0 goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0 = MulS(7 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 9
+ $t0 = [$s0+4]
+ if $t0 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$t0]
+ $t1 = Lt(8 $t1)
+ if $t1 goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1 = MulS(8 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 19
+ $t1 = [$s0+4]
+ if $t1 goto :null18
+ Error("null pointer")
+null18:
+ $t0 = [$t1]
+ $t0 = Lt(9 $t0)
+ if $t0 goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0 = MulS(9 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/Factorial.names.vaporm b/vaporize/tests/Factorial.names.vaporm
new file mode 100644
index 0000000..7c2c2d7
--- /dev/null
+++ b/vaporize/tests/Factorial.names.vaporm
@@ -0,0 +1,40 @@
+const vmt_Fac
+ :Fac.ComputeFac
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(4)
+ [$t0{t.0}] = :vmt_Fac
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func Fac.ComputeFac [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{this} = $a0
+ $s0{num} = $a1
+ $t1{t.0} = LtS($s0{num} 1)
+ if0 $t1{t.0} goto :if1_else
+ $t1{num_aux} = 1
+ goto :if1_end
+if1_else:
+ $t2{t.1} = [$t0{this}]
+ $t2{t.1} = [$t2{t.1}]
+ $t3{t.2} = Sub($s0{num} 1)
+ $a0 = $t0{this}
+ $a1 = $t3{t.2}
+ call $t2{t.1}
+ $t3{t.3} = $v0
+ $t1{num_aux} = MulS($s0{num} $t3{t.3})
+if1_end:
+ $v0 = $t1{num_aux}
+ $s0 = local[0]
+ ret
+
diff --git a/vaporize/tests/Factorial.opt.names.vaporm b/vaporize/tests/Factorial.opt.names.vaporm
new file mode 100644
index 0000000..bbc6604
--- /dev/null
+++ b/vaporize/tests/Factorial.opt.names.vaporm
@@ -0,0 +1,30 @@
+const empty_Fac
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_Fac
+ $a1 = 10
+ call :Fac.ComputeFac
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func Fac.ComputeFac [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{this} = $a0
+ $s0{num} = $a1
+ $t1{t.0} = LtS($s0{num} 1)
+ if0 $t1{t.0} goto :if1_else
+ $t1{num_aux} = 1
+ goto :if1_end
+if1_else:
+ $t2{t.1} = Sub($s0{num} 1)
+ $a0 = $t0{this}
+ $a1 = $t2{t.1}
+ call :Fac.ComputeFac
+ $t2{t.2} = $v0
+ $t1{num_aux} = MulS($s0{num} $t2{t.2})
+if1_end:
+ $v0 = $t1{num_aux}
+ $s0 = local[0]
+ ret
+
diff --git a/vaporize/tests/Factorial.opt.regalloc b/vaporize/tests/Factorial.opt.regalloc
new file mode 100644
index 0000000..21e46f5
--- /dev/null
+++ b/vaporize/tests/Factorial.opt.regalloc
@@ -0,0 +1,33 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 7
+Linear Range:
+ t.0: 6-7
+Allocation:
+ t.0: t0
+
+func Fac.ComputeFac
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 11-12 16-17
+ num: 11-12 16-18
+ t.0: 12
+ num_aux: 14 20
+ t.1: 17
+ t.2: 18
+Linear Range:
+ this: 10-17
+ num: 10-18 (cross call)
+ t.0: 11-12
+ num_aux: 13-20
+ t.1: 16-17
+ t.2: 17-18
+Allocation:
+ this: t0
+ num: s0
+ t.0: t1
+ num_aux: t1
+ t.1: t2
+ t.2: t2
+
diff --git a/vaporize/tests/Factorial.opt.vaporm b/vaporize/tests/Factorial.opt.vaporm
new file mode 100644
index 0000000..fb5f8e6
--- /dev/null
+++ b/vaporize/tests/Factorial.opt.vaporm
@@ -0,0 +1,30 @@
+const empty_Fac
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_Fac
+ $a1 = 10
+ call :Fac.ComputeFac
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func Fac.ComputeFac [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = $a0
+ $s0 = $a1
+ $t1 = LtS($s0 1)
+ if0 $t1 goto :if1_else
+ $t1 = 1
+ goto :if1_end
+if1_else:
+ $t2 = Sub($s0 1)
+ $a0 = $t0
+ $a1 = $t2
+ call :Fac.ComputeFac
+ $t2 = $v0
+ $t1 = MulS($s0 $t2)
+if1_end:
+ $v0 = $t1
+ $s0 = local[0]
+ ret
+
diff --git a/vaporize/tests/Factorial.regalloc b/vaporize/tests/Factorial.regalloc
new file mode 100644
index 0000000..e07e8d1
--- /dev/null
+++ b/vaporize/tests/Factorial.regalloc
@@ -0,0 +1,42 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 8-9 12-14
+ t.1: 13-14
+ t.2: 15
+Linear Range:
+ t.0: 7-14
+ t.1: 12-14
+ t.2: 14-15
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func Fac.ComputeFac
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 19-20 24-27
+ num: 19-20 24-28
+ t.0: 20
+ num_aux: 22 30
+ t.1: 25-27
+ t.2: 27
+ t.3: 28
+Linear Range:
+ this: 18-27
+ num: 18-28 (cross call)
+ t.0: 19-20
+ num_aux: 21-30
+ t.1: 24-27
+ t.2: 26-27
+ t.3: 27-28
+Allocation:
+ this: t0
+ num: s0
+ t.0: t1
+ num_aux: t1
+ t.1: t2
+ t.2: t3
+ t.3: t3
+
diff --git a/vaporize/tests/Factorial.vaporm b/vaporize/tests/Factorial.vaporm
new file mode 100644
index 0000000..a7e981c
--- /dev/null
+++ b/vaporize/tests/Factorial.vaporm
@@ -0,0 +1,40 @@
+const vmt_Fac
+ :Fac.ComputeFac
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(4)
+ [$t0] = :vmt_Fac
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ $a1 = 10
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func Fac.ComputeFac [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = $a0
+ $s0 = $a1
+ $t1 = LtS($s0 1)
+ if0 $t1 goto :if1_else
+ $t1 = 1
+ goto :if1_end
+if1_else:
+ $t2 = [$t0]
+ $t2 = [$t2]
+ $t3 = Sub($s0 1)
+ $a0 = $t0
+ $a1 = $t3
+ call $t2
+ $t3 = $v0
+ $t1 = MulS($s0 $t3)
+if1_end:
+ $v0 = $t1
+ $s0 = local[0]
+ ret
+
diff --git a/vaporize/tests/LinearSearch.names.vaporm b/vaporize/tests/LinearSearch.names.vaporm
new file mode 100644
index 0000000..7dbe0c8
--- /dev/null
+++ b/vaporize/tests/LinearSearch.names.vaporm
@@ -0,0 +1,182 @@
+const vmt_LS
+ :LS.Start
+ :LS.Print
+ :LS.Search
+ :LS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(12)
+ [$t0{t.0}] = :vmt_LS
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func LS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $t1{t.0} = [$s0{this}]
+ $t1{t.0} = [$t1{t.0}+12]
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call $t1{t.0}
+ $t1{t.1} = [$s0{this}]
+ $t1{t.1} = [$t1{t.1}+4]
+ $a0 = $s0{this}
+ call $t1{t.1}
+ PrintIntS(9999)
+ $t1{t.2} = [$s0{this}]
+ $t1{t.2} = [$t1{t.2}+8]
+ $a0 = $s0{this}
+ $a1 = 8
+ call $t1{t.2}
+ $t1{t.3} = $v0
+ PrintIntS($t1{t.3})
+ $t1{t.4} = [$s0{this}]
+ $t1{t.4} = [$t1{t.4}+8]
+ $a0 = $s0{this}
+ $a1 = 12
+ call $t1{t.4}
+ $t1{t.5} = $v0
+ PrintIntS($t1{t.5})
+ $t1{t.6} = [$s0{this}]
+ $t1{t.6} = [$t1{t.6}+8]
+ $a0 = $s0{this}
+ $a1 = 17
+ call $t1{t.6}
+ $t1{t.7} = $v0
+ PrintIntS($t1{t.7})
+ $t1{t.8} = [$s0{this}]
+ $t1{t.8} = [$t1{t.8}+8]
+ $a0 = $s0{this}
+ $a1 = 50
+ call $t1{t.8}
+ $t1{t.9} = $v0
+ PrintIntS($t1{t.9})
+ $v0 = 55
+ $s0 = local[0]
+ ret
+
+func LS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 1
+while1_top:
+ $t2{t.0} = [$t0{this}+8]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while1_end
+ $t2{t.2} = [$t0{this}+4]
+ if $t2{t.2} goto :null2
+ Error("null pointer")
+null2:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func LS.Search [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{num} = $a1
+ $t2{j} = 1
+ $t3{ifound} = 0
+while2_top:
+ $t4{t.0} = [$t0{this}+8]
+ $t4{t.1} = LtS($t2{j} $t4{t.0})
+ if0 $t4{t.1} goto :while2_end
+ $t4{t.2} = [$t0{this}+4]
+ if $t4{t.2} goto :null3
+ Error("null pointer")
+null3:
+ $t5{t.3} = [$t4{t.2}]
+ $t5{t.3} = Lt($t2{j} $t5{t.3})
+ if $t5{t.3} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t5{t.3} = MulS($t2{j} 4)
+ $t5{t.3} = Add($t5{t.3} $t4{t.2})
+ $t5{aux01} = [$t5{t.3}+4]
+ $t4{aux02} = Add($t1{num} 1)
+ $t6{t.4} = LtS($t5{aux01} $t1{num})
+ if0 $t6{t.4} goto :if1_else
+ goto :if1_end
+if1_else:
+ $t4{t.5} = LtS($t5{aux01} $t4{aux02})
+ $t4{t.6} = Sub(1 $t4{t.5})
+ if0 $t4{t.6} goto :if2_else
+ goto :if2_end
+if2_else:
+ $t3{ifound} = 1
+ $t2{j} = [$t0{this}+8]
+if2_end:
+if1_end:
+ $t2{j} = Add($t2{j} 1)
+ goto :while2_top
+while2_end:
+ $v0 = $t3{ifound}
+ ret
+
+func LS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+8] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}+4] = $t0{t.0}
+ $t0{j} = 1
+ $t1{t.1} = [$s0{this}+8]
+ $t1{k} = Add($t1{t.1} 1)
+while3_top:
+ $t2{t.2} = [$s0{this}+8]
+ $t2{t.3} = LtS($t0{j} $t2{t.2})
+ if0 $t2{t.3} goto :while3_end
+ $t2{aux01} = MulS(2 $t0{j})
+ $t3{aux02} = Sub($t1{k} 3)
+ $t4{t.4} = [$s0{this}+4]
+ if $t4{t.4} goto :null4
+ Error("null pointer")
+null4:
+ $t5{t.5} = [$t4{t.4}]
+ $t5{t.5} = Lt($t0{j} $t5{t.5})
+ if $t5{t.5} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5{t.5} = MulS($t0{j} 4)
+ $t5{t.5} = Add($t5{t.5} $t4{t.4})
+ $t3{t.6} = Add($t2{aux01} $t3{aux02})
+ [$t5{t.5}+4] = $t3{t.6}
+ $t0{j} = Add($t0{j} 1)
+ $t1{k} = Sub($t1{k} 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/LinearSearch.opt.names.vaporm b/vaporize/tests/LinearSearch.opt.names.vaporm
new file mode 100644
index 0000000..de6b96a
--- /dev/null
+++ b/vaporize/tests/LinearSearch.opt.names.vaporm
@@ -0,0 +1,162 @@
+const empty_LS
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(8)
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call :LS.Start
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ ret
+
+func LS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call :LS.Init
+ $a0 = $s0{this}
+ call :LS.Print
+ PrintIntS(9999)
+ $a0 = $s0{this}
+ $a1 = 8
+ call :LS.Search
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ $a0 = $s0{this}
+ $a1 = 12
+ call :LS.Search
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ $a0 = $s0{this}
+ $a1 = 17
+ call :LS.Search
+ $t0{t.2} = $v0
+ PrintIntS($t0{t.2})
+ $a0 = $s0{this}
+ $a1 = 50
+ call :LS.Search
+ $t0{t.3} = $v0
+ PrintIntS($t0{t.3})
+ $v0 = 55
+ $s0 = local[0]
+ ret
+
+func LS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 1
+while1_top:
+ $t2{t.0} = [$t0{this}+4]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while1_end
+ $t2{t.2} = [$t0{this}]
+ if $t2{t.2} goto :null2
+ Error("null pointer")
+null2:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func LS.Search [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{num} = $a1
+ $t2{j} = 1
+ $t3{ifound} = 0
+while2_top:
+ $t4{t.0} = [$t0{this}+4]
+ $t4{t.1} = LtS($t2{j} $t4{t.0})
+ if0 $t4{t.1} goto :while2_end
+ $t4{t.2} = [$t0{this}]
+ if $t4{t.2} goto :null3
+ Error("null pointer")
+null3:
+ $t5{t.3} = [$t4{t.2}]
+ $t5{t.3} = Lt($t2{j} $t5{t.3})
+ if $t5{t.3} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t5{t.3} = MulS($t2{j} 4)
+ $t5{t.3} = Add($t5{t.3} $t4{t.2})
+ $t5{aux01} = [$t5{t.3}+4]
+ $t4{aux02} = Add($t1{num} 1)
+ $t6{t.4} = LtS($t5{aux01} $t1{num})
+ if0 $t6{t.4} goto :if1_else
+ goto :if1_end
+if1_else:
+ $t4{t.5} = LtS($t5{aux01} $t4{aux02})
+ if $t4{t.5} goto :if2_else
+ goto :if2_end
+if2_else:
+ $t3{ifound} = 1
+ $t2{j} = [$t0{this}+4]
+if2_end:
+if1_end:
+ $t2{j} = Add($t2{j} 1)
+ goto :while2_top
+while2_end:
+ $v0 = $t3{ifound}
+ ret
+
+func LS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+4] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}] = $t0{t.0}
+ $t0{j} = 1
+ $t1{t.1} = [$s0{this}+4]
+ $t1{k} = Add($t1{t.1} 1)
+while3_top:
+ $t2{t.2} = [$s0{this}+4]
+ $t2{t.3} = LtS($t0{j} $t2{t.2})
+ if0 $t2{t.3} goto :while3_end
+ $t2{aux01} = MulS(2 $t0{j})
+ $t3{aux02} = Sub($t1{k} 3)
+ $t4{t.4} = [$s0{this}]
+ if $t4{t.4} goto :null4
+ Error("null pointer")
+null4:
+ $t5{t.5} = [$t4{t.4}]
+ $t5{t.5} = Lt($t0{j} $t5{t.5})
+ if $t5{t.5} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5{t.5} = MulS($t0{j} 4)
+ $t5{t.5} = Add($t5{t.5} $t4{t.4})
+ $t3{t.6} = Add($t2{aux01} $t3{aux02})
+ [$t5{t.5}+4] = $t3{t.6}
+ $t0{j} = Add($t0{j} 1)
+ $t1{k} = Sub($t1{k} 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/LinearSearch.opt.regalloc b/vaporize/tests/LinearSearch.opt.regalloc
new file mode 100644
index 0000000..abfdfeb
--- /dev/null
+++ b/vaporize/tests/LinearSearch.opt.regalloc
@@ -0,0 +1,169 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 7 10
+ t.1: 11
+Linear Range:
+ t.0: 6-10
+ t.1: 10-11
+Allocation:
+ t.0: t0
+ t.1: t0
+
+func LS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 15-24
+ sz: 15
+ aux01:
+ aux02:
+ t.0: 19
+ t.1: 21
+ t.2: 23
+ t.3: 25
+Linear Range:
+ this: 14-24 (cross call)
+ sz: 14-15
+ t.0: 18-19
+ t.1: 20-21
+ t.2: 22-23
+ t.3: 24-25
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+
+func LS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 29-35 38-40 43-48
+ j: 31-35 38-40 43-48
+ t.0: 32
+ t.1: 33
+ t.2: 35 38-40 43-44
+ t.3: 39-40 44-45
+ t.4: 46
+Linear Range:
+ this: 28-48
+ j: 29-48
+ t.0: 31-32
+ t.1: 32-33
+ t.2: 34-44
+ t.3: 38-45
+ t.4: 45-46
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func LS.Search
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 53-61 64-66 69-89
+ num: 53-61 64-66 69-89
+ j: 54-61 64-66 69-81 88-89
+ ls01:
+ ifound: 57-61 64-66 69-81 85-91
+ t.0: 58
+ t.1: 59
+ t.2: 61 64-66 69-70
+ t.3: 65-66 70-71
+ aux01: 72-74 78
+ aux02: 73-74 78
+ t.4: 74
+ nt:
+ t.5: 79
+Linear Range:
+ this: 52-89
+ num: 52-89
+ j: 53-89
+ ifound: 55-91
+ t.0: 57-58
+ t.1: 58-59
+ t.2: 60-70
+ t.3: 64-71
+ aux01: 71-78
+ aux02: 72-78
+ t.4: 73-74
+ t.5: 78-79
+Allocation:
+ this: t0
+ num: t1
+ j: t2
+ ifound: t3
+ t.0: t4
+ t.1: t4
+ t.2: t4
+ t.3: t5
+ aux01: t5
+ aux02: t4
+ t.4: t6
+ t.5: t4
+
+func LS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 94-107 110-112 115-121
+ sz: 94-95
+ t.0: 96
+ j: 98-107 110-112 115-121
+ t.1: 99
+ k: 101-107 110-112 115-121
+ t.2: 102
+ t.3: 103
+ aux01: 105-107 110-112 115-117
+ aux02: 106-107 110-112 115-117
+ t.4: 107 110-112 115-116
+ t.5: 111-112 116-118
+ t.6: 118
+Linear Range:
+ this: 93-121 (cross call)
+ sz: 93-95
+ t.0: 95-96
+ j: 97-121
+ t.1: 98-99
+ k: 99-121
+ t.2: 101-102
+ t.3: 102-103
+ aux01: 104-117
+ aux02: 105-117
+ t.4: 106-116
+ t.5: 110-118
+ t.6: 117-118
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ j: t0
+ t.1: t1
+ k: t1
+ t.2: t2
+ t.3: t2
+ aux01: t2
+ aux02: t3
+ t.4: t4
+ t.5: t5
+ t.6: t3
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 126-129
+ bytes: 127-128
+ v: 129-130
+Linear Range:
+ size: 125-129
+ bytes: 126-128
+ v: 128-130
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/LinearSearch.opt.vaporm b/vaporize/tests/LinearSearch.opt.vaporm
new file mode 100644
index 0000000..4fa8c5c
--- /dev/null
+++ b/vaporize/tests/LinearSearch.opt.vaporm
@@ -0,0 +1,162 @@
+const empty_LS
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(8)
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0
+ $a1 = 10
+ call :LS.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func LS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $a0 = $s0
+ $a1 = $t0
+ call :LS.Init
+ $a0 = $s0
+ call :LS.Print
+ PrintIntS(9999)
+ $a0 = $s0
+ $a1 = 8
+ call :LS.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $a0 = $s0
+ $a1 = 12
+ call :LS.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $a0 = $s0
+ $a1 = 17
+ call :LS.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $a0 = $s0
+ $a1 = 50
+ call :LS.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $v0 = 55
+ $s0 = local[0]
+ ret
+
+func LS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 1
+while1_top:
+ $t2 = [$t0+4]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while1_end
+ $t2 = [$t0]
+ if $t2 goto :null2
+ Error("null pointer")
+null2:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func LS.Search [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = 1
+ $t3 = 0
+while2_top:
+ $t4 = [$t0+4]
+ $t4 = LtS($t2 $t4)
+ if0 $t4 goto :while2_end
+ $t4 = [$t0]
+ if $t4 goto :null3
+ Error("null pointer")
+null3:
+ $t5 = [$t4]
+ $t5 = Lt($t2 $t5)
+ if $t5 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t5 = MulS($t2 4)
+ $t5 = Add($t5 $t4)
+ $t5 = [$t5+4]
+ $t4 = Add($t1 1)
+ $t6 = LtS($t5 $t1)
+ if0 $t6 goto :if1_else
+ goto :if1_end
+if1_else:
+ $t4 = LtS($t5 $t4)
+ if $t4 goto :if2_else
+ goto :if2_end
+if2_else:
+ $t3 = 1
+ $t2 = [$t0+4]
+if2_end:
+if1_end:
+ $t2 = Add($t2 1)
+ goto :while2_top
+while2_end:
+ $v0 = $t3
+ ret
+
+func LS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+4] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0] = $t0
+ $t0 = 1
+ $t1 = [$s0+4]
+ $t1 = Add($t1 1)
+while3_top:
+ $t2 = [$s0+4]
+ $t2 = LtS($t0 $t2)
+ if0 $t2 goto :while3_end
+ $t2 = MulS(2 $t0)
+ $t3 = Sub($t1 3)
+ $t4 = [$s0]
+ if $t4 goto :null4
+ Error("null pointer")
+null4:
+ $t5 = [$t4]
+ $t5 = Lt($t0 $t5)
+ if $t5 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5 = MulS($t0 4)
+ $t5 = Add($t5 $t4)
+ $t3 = Add($t2 $t3)
+ [$t5+4] = $t3
+ $t0 = Add($t0 1)
+ $t1 = Sub($t1 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/LinearSearch.regalloc b/vaporize/tests/LinearSearch.regalloc
new file mode 100644
index 0000000..817df4f
--- /dev/null
+++ b/vaporize/tests/LinearSearch.regalloc
@@ -0,0 +1,193 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 11-12 15-17
+ t.1: 16-17
+ t.2: 18
+Linear Range:
+ t.0: 10-17
+ t.1: 15-17
+ t.2: 17-18
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func LS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 22-43
+ sz: 22-24
+ t.0: 23-24
+ aux01:
+ t.1: 26-27
+ aux02:
+ t.2: 30-31
+ t.3: 32
+ t.4: 34-35
+ t.5: 36
+ t.6: 38-39
+ t.7: 40
+ t.8: 42-43
+ t.9: 44
+Linear Range:
+ this: 21-43 (cross call)
+ sz: 21-24
+ t.0: 22-24
+ t.1: 25-27
+ t.2: 29-31
+ t.3: 31-32
+ t.4: 33-35
+ t.5: 35-36
+ t.6: 37-39
+ t.7: 39-40
+ t.8: 41-43
+ t.9: 43-44
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t1
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t1
+
+func LS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 48-54 57-59 62-67
+ j: 50-54 57-59 62-67
+ t.0: 51
+ t.1: 52
+ t.2: 54 57-59 62-63
+ t.3: 58-59 63-64
+ t.4: 65
+Linear Range:
+ this: 47-67
+ j: 48-67
+ t.0: 50-51
+ t.1: 51-52
+ t.2: 53-63
+ t.3: 57-64
+ t.4: 64-65
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func LS.Search
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 72-80 83-85 88-109
+ num: 72-80 83-85 88-109
+ j: 73-80 83-85 88-101 108-109
+ ls01:
+ ifound: 76-80 83-85 88-101 105-111
+ t.0: 77
+ t.1: 78
+ t.2: 80 83-85 88-89
+ t.3: 84-85 89-90
+ aux01: 91-93 97
+ aux02: 92-93 97
+ t.4: 93
+ nt:
+ t.5: 98
+ t.6: 99
+Linear Range:
+ this: 71-109
+ num: 71-109
+ j: 72-109
+ ifound: 74-111
+ t.0: 76-77
+ t.1: 77-78
+ t.2: 79-89
+ t.3: 83-90
+ aux01: 90-97
+ aux02: 91-97
+ t.4: 92-93
+ t.5: 97-98
+ t.6: 98-99
+Allocation:
+ this: t0
+ num: t1
+ j: t2
+ ifound: t3
+ t.0: t4
+ t.1: t4
+ t.2: t4
+ t.3: t5
+ aux01: t5
+ aux02: t4
+ t.4: t6
+ t.5: t4
+ t.6: t4
+
+func LS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 114-127 130-132 135-141
+ sz: 114-115
+ t.0: 116
+ j: 118-127 130-132 135-141
+ t.1: 119
+ k: 121-127 130-132 135-141
+ t.2: 122
+ t.3: 123
+ aux01: 125-127 130-132 135-137
+ aux02: 126-127 130-132 135-137
+ t.4: 127 130-132 135-136
+ t.5: 131-132 136-138
+ t.6: 138
+Linear Range:
+ this: 113-141 (cross call)
+ sz: 113-115
+ t.0: 115-116
+ j: 117-141
+ t.1: 118-119
+ k: 119-141
+ t.2: 121-122
+ t.3: 122-123
+ aux01: 124-137
+ aux02: 125-137
+ t.4: 126-136
+ t.5: 130-138
+ t.6: 137-138
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ j: t0
+ t.1: t1
+ k: t1
+ t.2: t2
+ t.3: t2
+ aux01: t2
+ aux02: t3
+ t.4: t4
+ t.5: t5
+ t.6: t3
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 146-149
+ bytes: 147-148
+ v: 149-150
+Linear Range:
+ size: 145-149
+ bytes: 146-148
+ v: 148-150
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/LinearSearch.vaporm b/vaporize/tests/LinearSearch.vaporm
new file mode 100644
index 0000000..094cfe1
--- /dev/null
+++ b/vaporize/tests/LinearSearch.vaporm
@@ -0,0 +1,182 @@
+const vmt_LS
+ :LS.Start
+ :LS.Print
+ :LS.Search
+ :LS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(12)
+ [$t0] = :vmt_LS
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ $a1 = 10
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func LS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $t1 = [$s0]
+ $t1 = [$t1+12]
+ $a0 = $s0
+ $a1 = $t0
+ call $t1
+ $t1 = [$s0]
+ $t1 = [$t1+4]
+ $a0 = $s0
+ call $t1
+ PrintIntS(9999)
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ $a1 = 8
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ $a1 = 12
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ $a1 = 17
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ $a1 = 50
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ $v0 = 55
+ $s0 = local[0]
+ ret
+
+func LS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 1
+while1_top:
+ $t2 = [$t0+8]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while1_end
+ $t2 = [$t0+4]
+ if $t2 goto :null2
+ Error("null pointer")
+null2:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while1_top
+while1_end:
+ $v0 = 0
+ ret
+
+func LS.Search [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = 1
+ $t3 = 0
+while2_top:
+ $t4 = [$t0+8]
+ $t4 = LtS($t2 $t4)
+ if0 $t4 goto :while2_end
+ $t4 = [$t0+4]
+ if $t4 goto :null3
+ Error("null pointer")
+null3:
+ $t5 = [$t4]
+ $t5 = Lt($t2 $t5)
+ if $t5 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t5 = MulS($t2 4)
+ $t5 = Add($t5 $t4)
+ $t5 = [$t5+4]
+ $t4 = Add($t1 1)
+ $t6 = LtS($t5 $t1)
+ if0 $t6 goto :if1_else
+ goto :if1_end
+if1_else:
+ $t4 = LtS($t5 $t4)
+ $t4 = Sub(1 $t4)
+ if0 $t4 goto :if2_else
+ goto :if2_end
+if2_else:
+ $t3 = 1
+ $t2 = [$t0+8]
+if2_end:
+if1_end:
+ $t2 = Add($t2 1)
+ goto :while2_top
+while2_end:
+ $v0 = $t3
+ ret
+
+func LS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+8] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0+4] = $t0
+ $t0 = 1
+ $t1 = [$s0+8]
+ $t1 = Add($t1 1)
+while3_top:
+ $t2 = [$s0+8]
+ $t2 = LtS($t0 $t2)
+ if0 $t2 goto :while3_end
+ $t2 = MulS(2 $t0)
+ $t3 = Sub($t1 3)
+ $t4 = [$s0+4]
+ if $t4 goto :null4
+ Error("null pointer")
+null4:
+ $t5 = [$t4]
+ $t5 = Lt($t0 $t5)
+ if $t5 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t5 = MulS($t0 4)
+ $t5 = Add($t5 $t4)
+ $t3 = Add($t2 $t3)
+ [$t5+4] = $t3
+ $t0 = Add($t0 1)
+ $t1 = Sub($t1 1)
+ goto :while3_top
+while3_end:
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/LinkedList.names.vaporm b/vaporize/tests/LinkedList.names.vaporm
new file mode 100644
index 0000000..a04d039
--- /dev/null
+++ b/vaporize/tests/LinkedList.names.vaporm
@@ -0,0 +1,698 @@
+const vmt_Element
+ :Element.Init
+ :Element.GetAge
+ :Element.GetSalary
+ :Element.GetMarried
+ :Element.Equal
+ :Element.Compare
+
+const vmt_List
+ :List.Init
+ :List.InitNew
+ :List.Insert
+ :List.SetNext
+ :List.Delete
+ :List.Search
+ :List.GetEnd
+ :List.GetElem
+ :List.GetNext
+ :List.Print
+
+const vmt_LL
+ :LL.Start
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(4)
+ [$t0{t.0}] = :vmt_LL
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func Element.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_Age} = $a1
+ $t2{v_Salary} = $a2
+ $t3{v_Married} = $a3
+ [$t0{this}+4] = $t1{v_Age}
+ [$t0{this}+8] = $t2{v_Salary}
+ [$t0{this}+12] = $t3{v_Married}
+ $v0 = 1
+ ret
+
+func Element.GetAge [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.GetSalary [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.GetMarried [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.Equal [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{other} = $a1
+ $s2{ret_val} = 1
+ if $s1{other} goto :null2
+ Error("null pointer")
+null2:
+ $t0{t.0} = [$s1{other}]
+ $t0{t.0} = [$t0{t.0}+4]
+ $a0 = $s1{other}
+ call $t0{t.0}
+ $t0{aux01} = $v0
+ $t1{t.1} = [$s0{this}]
+ $t1{t.1} = [$t1{t.1}+20]
+ $t2{t.2} = [$s0{this}+4]
+ $a0 = $s0{this}
+ $a1 = $t0{aux01}
+ $a2 = $t2{t.2}
+ call $t1{t.1}
+ $t2{t.3} = $v0
+ $t2{t.4} = Sub(1 $t2{t.3})
+ if0 $t2{t.4} goto :if1_else
+ $s2{ret_val} = 0
+ goto :if1_end
+if1_else:
+ if $s1{other} goto :null3
+ Error("null pointer")
+null3:
+ $t2{t.5} = [$s1{other}]
+ $t2{t.5} = [$t2{t.5}+8]
+ $a0 = $s1{other}
+ call $t2{t.5}
+ $t2{aux02} = $v0
+ $t1{t.6} = [$s0{this}]
+ $t1{t.6} = [$t1{t.6}+20]
+ $t0{t.7} = [$s0{this}+8]
+ $a0 = $s0{this}
+ $a1 = $t2{aux02}
+ $a2 = $t0{t.7}
+ call $t1{t.6}
+ $t0{t.8} = $v0
+ $t0{t.9} = Sub(1 $t0{t.8})
+ if0 $t0{t.9} goto :if2_else
+ $s2{ret_val} = 0
+ goto :if2_end
+if2_else:
+ $t0{t.10} = [$s0{this}+12]
+ if0 $t0{t.10} goto :if3_else
+ if $s1{other} goto :null4
+ Error("null pointer")
+null4:
+ $t0{t.11} = [$s1{other}]
+ $t0{t.11} = [$t0{t.11}+12]
+ $a0 = $s1{other}
+ call $t0{t.11}
+ $t0{t.12} = $v0
+ $t0{t.13} = Sub(1 $t0{t.12})
+ if0 $t0{t.13} goto :if4_else
+ $s2{ret_val} = 0
+ goto :if4_end
+if4_else:
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s1{other} goto :null5
+ Error("null pointer")
+null5:
+ $t0{t.14} = [$s1{other}]
+ $t0{t.14} = [$t0{t.14}+12]
+ $a0 = $s1{other}
+ call $t0{t.14}
+ $t0{t.15} = $v0
+ if0 $t0{t.15} goto :if5_else
+ $s2{ret_val} = 0
+ goto :if5_end
+if5_else:
+if5_end:
+if3_end:
+if2_end:
+if1_end:
+ $v0 = $s2{ret_val}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Element.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{aux02} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if6_else
+ $t1{retval} = 0
+ goto :if6_end
+if6_else:
+ $t2{t.1} = LtS($t0{num1} $t2{aux02})
+ $t2{t.2} = Sub(1 $t2{t.1})
+ if0 $t2{t.2} goto :if7_else
+ $t1{retval} = 0
+ goto :if7_end
+if7_else:
+ $t1{retval} = 1
+if7_end:
+if6_end:
+ $v0 = $t1{retval}
+ ret
+
+func List.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ [$t0{this}+12] = 1
+ $v0 = 1
+ ret
+
+func List.InitNew [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_elem} = $a1
+ $t2{v_next} = $a2
+ $t3{v_end} = $a3
+ [$t0{this}+12] = $t3{v_end}
+ [$t0{this}+4] = $t1{v_elem}
+ [$t0{this}+8] = $t2{v_next}
+ $v0 = 1
+ ret
+
+func List.Insert [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{this} = $a0
+ $t1{new_elem} = $a1
+ $t0{aux03} = $t0{this}
+ $t2{t.0} = HeapAllocZ(16)
+ [$t2{t.0}] = :vmt_List
+ $s0{aux02} = $t2{t.0}
+ if $s0{aux02} goto :null6
+ Error("null pointer")
+null6:
+ $t2{t.1} = [$s0{aux02}]
+ $t2{t.1} = [$t2{t.1}+4]
+ $a0 = $s0{aux02}
+ $a1 = $t1{new_elem}
+ $a2 = $t0{aux03}
+ $a3 = 0
+ call $t2{t.1}
+ $v0 = $s0{aux02}
+ $s0 = local[0]
+ ret
+
+func List.SetNext [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_next} = $a1
+ [$t0{this}+8] = $t1{v_next}
+ $v0 = 1
+ ret
+
+func List.Delete [in 0, out 0, local 9]
+ local[1] = $s0
+ local[2] = $s1
+ local[3] = $s2
+ local[4] = $s3
+ local[5] = $s4
+ local[6] = $s5
+ local[7] = $s6
+ local[8] = $s7
+ $t0{this} = $a0
+ $s0{e} = $a1
+ $s1{my_head} = $t0{this}
+ $s2{ret_val} = 0
+ $s3{aux04} = Sub(0 1)
+ $s4{aux01} = $t0{this}
+ $s5{prev} = $t0{this}
+ $s6{var_end} = [$t0{this}+12]
+ $s7{var_elem} = [$t0{this}+4]
+while1_top:
+ $t0{t.1} = Sub(1 $s6{var_end})
+ if0 $t0{t.1} goto :ss1_else
+ $t0{t.0} = Sub(1 $s2{ret_val})
+ goto :ss1_end
+ss1_else:
+ $t0{t.0} = 0
+ss1_end:
+ if0 $t0{t.0} goto :while1_end
+ if $s0{e} goto :null7
+ Error("null pointer")
+null7:
+ $t0{t.2} = [$s0{e}]
+ $t0{t.2} = [$t0{t.2}+16]
+ $a0 = $s0{e}
+ $a1 = $s7{var_elem}
+ call $t0{t.2}
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if8_else
+ $s2{ret_val} = 1
+ $t0{t.4} = LtS($s3{aux04} 0)
+ if0 $t0{t.4} goto :if9_else
+ if $s4{aux01} goto :null8
+ Error("null pointer")
+null8:
+ $t0{t.5} = [$s4{aux01}]
+ $t0{t.5} = [$t0{t.5}+32]
+ $a0 = $s4{aux01}
+ call $t0{t.5}
+ $s1{my_head} = $v0
+ goto :if9_end
+if9_else:
+ $t0{t.6} = Sub(0 555)
+ PrintIntS($t0{t.6})
+ if $s5{prev} goto :null9
+ Error("null pointer")
+null9:
+ $v0 = [$s5{prev}]
+ local[0]{t.7} = $v0
+ $v0 = local[0]{t.7}
+ $v0 = [$v0+12]
+ local[0]{t.7} = $v0
+ if $s4{aux01} goto :null10
+ Error("null pointer")
+null10:
+ $t0{t.8} = [$s4{aux01}]
+ $t0{t.8} = [$t0{t.8}+32]
+ $a0 = $s4{aux01}
+ call $t0{t.8}
+ $t0{t.9} = $v0
+ $a0 = $s5{prev}
+ $a1 = $t0{t.9}
+ $v0 = local[0]{t.7}
+ call $v0
+ $t0{t.10} = Sub(0 555)
+ PrintIntS($t0{t.10})
+if9_end:
+ goto :if8_end
+if8_else:
+if8_end:
+ $t0{t.11} = Sub(1 $s2{ret_val})
+ if0 $t0{t.11} goto :if10_else
+ $s5{prev} = $s4{aux01}
+ if $s4{aux01} goto :null11
+ Error("null pointer")
+null11:
+ $t0{t.12} = [$s4{aux01}]
+ $t0{t.12} = [$t0{t.12}+32]
+ $a0 = $s4{aux01}
+ call $t0{t.12}
+ $s4{aux01} = $v0
+ if $s4{aux01} goto :null12
+ Error("null pointer")
+null12:
+ $t0{t.13} = [$s4{aux01}]
+ $t0{t.13} = [$t0{t.13}+24]
+ $a0 = $s4{aux01}
+ call $t0{t.13}
+ $s6{var_end} = $v0
+ if $s4{aux01} goto :null13
+ Error("null pointer")
+null13:
+ $t0{t.14} = [$s4{aux01}]
+ $t0{t.14} = [$t0{t.14}+28]
+ $a0 = $s4{aux01}
+ call $t0{t.14}
+ $s7{var_elem} = $v0
+ $s3{aux04} = 1
+ goto :if10_end
+if10_else:
+if10_end:
+ goto :while1_top
+while1_end:
+ $v0 = $s1{my_head}
+ $s0 = local[1]
+ $s1 = local[2]
+ $s2 = local[3]
+ $s3 = local[4]
+ $s4 = local[5]
+ $s5 = local[6]
+ $s6 = local[7]
+ $s7 = local[8]
+ ret
+
+func List.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{e} = $a1
+ $s1{int_ret_val} = 0
+ $s2{aux01} = $t0{this}
+ $s3{var_end} = [$t0{this}+12]
+ $t0{var_elem} = [$t0{this}+4]
+while2_top:
+ $t1{t.0} = Sub(1 $s3{var_end})
+ if0 $t1{t.0} goto :while2_end
+ if $s0{e} goto :null14
+ Error("null pointer")
+null14:
+ $t1{t.1} = [$s0{e}]
+ $t1{t.1} = [$t1{t.1}+16]
+ $a0 = $s0{e}
+ $a1 = $t0{var_elem}
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ if0 $t1{t.2} goto :if11_else
+ $s1{int_ret_val} = 1
+ goto :if11_end
+if11_else:
+if11_end:
+ if $s2{aux01} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.3} = [$s2{aux01}]
+ $t1{t.3} = [$t1{t.3}+32]
+ $a0 = $s2{aux01}
+ call $t1{t.3}
+ $s2{aux01} = $v0
+ if $s2{aux01} goto :null16
+ Error("null pointer")
+null16:
+ $t1{t.4} = [$s2{aux01}]
+ $t1{t.4} = [$t1{t.4}+24]
+ $a0 = $s2{aux01}
+ call $t1{t.4}
+ $s3{var_end} = $v0
+ if $s2{aux01} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.5} = [$s2{aux01}]
+ $t1{t.5} = [$t1{t.5}+28]
+ $a0 = $s2{aux01}
+ call $t1{t.5}
+ $t0{var_elem} = $v0
+ goto :while2_top
+while2_end:
+ $v0 = $s1{int_ret_val}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func List.GetEnd [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func List.GetElem [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func List.GetNext [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func List.Print [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $t0{this} = $a0
+ $s0{aux01} = $t0{this}
+ $s1{var_end} = [$t0{this}+12]
+ $t0{var_elem} = [$t0{this}+4]
+while3_top:
+ $t1{t.0} = Sub(1 $s1{var_end})
+ if0 $t1{t.0} goto :while3_end
+ if $t0{var_elem} goto :null18
+ Error("null pointer")
+null18:
+ $t1{t.1} = [$t0{var_elem}]
+ $t1{t.1} = [$t1{t.1}+4]
+ $a0 = $t0{var_elem}
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ if $s0{aux01} goto :null19
+ Error("null pointer")
+null19:
+ $t1{t.3} = [$s0{aux01}]
+ $t1{t.3} = [$t1{t.3}+32]
+ $a0 = $s0{aux01}
+ call $t1{t.3}
+ $s0{aux01} = $v0
+ if $s0{aux01} goto :null20
+ Error("null pointer")
+null20:
+ $t1{t.4} = [$s0{aux01}]
+ $t1{t.4} = [$t1{t.4}+24]
+ $a0 = $s0{aux01}
+ call $t1{t.4}
+ $s1{var_end} = $v0
+ if $s0{aux01} goto :null21
+ Error("null pointer")
+null21:
+ $t1{t.5} = [$s0{aux01}]
+ $t1{t.5} = [$t1{t.5}+28]
+ $a0 = $s0{aux01}
+ call $t1{t.5}
+ $t0{var_elem} = $v0
+ goto :while3_top
+while3_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func LL.Start [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{t.0} = HeapAllocZ(16)
+ [$t0{t.0}] = :vmt_List
+ $s0{last_elem} = $t0{t.0}
+ if $s0{last_elem} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.1} = [$s0{last_elem}]
+ $t0{t.1} = [$t0{t.1}]
+ $a0 = $s0{last_elem}
+ call $t0{t.1}
+ $s0{head} = $s0{last_elem}
+ if $s0{head} goto :null23
+ Error("null pointer")
+null23:
+ $t0{t.2} = [$s0{head}]
+ $t0{t.2} = [$t0{t.2}]
+ $a0 = $s0{head}
+ call $t0{t.2}
+ if $s0{head} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.3} = [$s0{head}]
+ $t0{t.3} = [$t0{t.3}+36]
+ $a0 = $s0{head}
+ call $t0{t.3}
+ $t0{t.4} = HeapAllocZ(16)
+ [$t0{t.4}] = :vmt_Element
+ $s1{el01} = $t0{t.4}
+ if $s1{el01} goto :null25
+ Error("null pointer")
+null25:
+ $t0{t.5} = [$s1{el01}]
+ $t0{t.5} = [$t0{t.5}]
+ $a0 = $s1{el01}
+ $a1 = 25
+ $a2 = 37000
+ $a3 = 0
+ call $t0{t.5}
+ if $s0{head} goto :null26
+ Error("null pointer")
+null26:
+ $t0{t.6} = [$s0{head}]
+ $t0{t.6} = [$t0{t.6}+8]
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call $t0{t.6}
+ $s0{head} = $v0
+ if $s0{head} goto :null27
+ Error("null pointer")
+null27:
+ $t0{t.7} = [$s0{head}]
+ $t0{t.7} = [$t0{t.7}+36]
+ $a0 = $s0{head}
+ call $t0{t.7}
+ PrintIntS(10000000)
+ $t0{t.8} = HeapAllocZ(16)
+ [$t0{t.8}] = :vmt_Element
+ $s1{el01} = $t0{t.8}
+ if $s1{el01} goto :null28
+ Error("null pointer")
+null28:
+ $t0{t.9} = [$s1{el01}]
+ $t0{t.9} = [$t0{t.9}]
+ $a0 = $s1{el01}
+ $a1 = 39
+ $a2 = 42000
+ $a3 = 1
+ call $t0{t.9}
+ $s2{el02} = $s1{el01}
+ if $s0{head} goto :null29
+ Error("null pointer")
+null29:
+ $t0{t.10} = [$s0{head}]
+ $t0{t.10} = [$t0{t.10}+8]
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call $t0{t.10}
+ $s0{head} = $v0
+ if $s0{head} goto :null30
+ Error("null pointer")
+null30:
+ $t0{t.11} = [$s0{head}]
+ $t0{t.11} = [$t0{t.11}+36]
+ $a0 = $s0{head}
+ call $t0{t.11}
+ PrintIntS(10000000)
+ $t0{t.12} = HeapAllocZ(16)
+ [$t0{t.12}] = :vmt_Element
+ $s1{el01} = $t0{t.12}
+ if $s1{el01} goto :null31
+ Error("null pointer")
+null31:
+ $t0{t.13} = [$s1{el01}]
+ $t0{t.13} = [$t0{t.13}]
+ $a0 = $s1{el01}
+ $a1 = 22
+ $a2 = 34000
+ $a3 = 0
+ call $t0{t.13}
+ if $s0{head} goto :null32
+ Error("null pointer")
+null32:
+ $t0{t.14} = [$s0{head}]
+ $t0{t.14} = [$t0{t.14}+8]
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call $t0{t.14}
+ $s0{head} = $v0
+ if $s0{head} goto :null33
+ Error("null pointer")
+null33:
+ $t0{t.15} = [$s0{head}]
+ $t0{t.15} = [$t0{t.15}+36]
+ $a0 = $s0{head}
+ call $t0{t.15}
+ $t0{t.16} = HeapAllocZ(16)
+ [$t0{t.16}] = :vmt_Element
+ $s3{el03} = $t0{t.16}
+ if $s3{el03} goto :null34
+ Error("null pointer")
+null34:
+ $t0{t.17} = [$s3{el03}]
+ $t0{t.17} = [$t0{t.17}]
+ $a0 = $s3{el03}
+ $a1 = 27
+ $a2 = 34000
+ $a3 = 0
+ call $t0{t.17}
+ if $s0{head} goto :null35
+ Error("null pointer")
+null35:
+ $t0{t.18} = [$s0{head}]
+ $t0{t.18} = [$t0{t.18}+20]
+ $a0 = $s0{head}
+ $a1 = $s2{el02}
+ call $t0{t.18}
+ $t0{t.19} = $v0
+ PrintIntS($t0{t.19})
+ if $s0{head} goto :null36
+ Error("null pointer")
+null36:
+ $t0{t.20} = [$s0{head}]
+ $t0{t.20} = [$t0{t.20}+20]
+ $a0 = $s0{head}
+ $a1 = $s3{el03}
+ call $t0{t.20}
+ $t0{t.21} = $v0
+ PrintIntS($t0{t.21})
+ PrintIntS(10000000)
+ $t0{t.22} = HeapAllocZ(16)
+ [$t0{t.22}] = :vmt_Element
+ $s1{el01} = $t0{t.22}
+ if $s1{el01} goto :null37
+ Error("null pointer")
+null37:
+ $t0{t.23} = [$s1{el01}]
+ $t0{t.23} = [$t0{t.23}]
+ $a0 = $s1{el01}
+ $a1 = 28
+ $a2 = 35000
+ $a3 = 0
+ call $t0{t.23}
+ if $s0{head} goto :null38
+ Error("null pointer")
+null38:
+ $t0{t.24} = [$s0{head}]
+ $t0{t.24} = [$t0{t.24}+8]
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call $t0{t.24}
+ $s0{head} = $v0
+ if $s0{head} goto :null39
+ Error("null pointer")
+null39:
+ $t0{t.25} = [$s0{head}]
+ $t0{t.25} = [$t0{t.25}+36]
+ $a0 = $s0{head}
+ call $t0{t.25}
+ PrintIntS(2220000)
+ if $s0{head} goto :null40
+ Error("null pointer")
+null40:
+ $t0{t.26} = [$s0{head}]
+ $t0{t.26} = [$t0{t.26}+16]
+ $a0 = $s0{head}
+ $a1 = $s2{el02}
+ call $t0{t.26}
+ $s0{head} = $v0
+ if $s0{head} goto :null41
+ Error("null pointer")
+null41:
+ $t0{t.27} = [$s0{head}]
+ $t0{t.27} = [$t0{t.27}+36]
+ $a0 = $s0{head}
+ call $t0{t.27}
+ PrintIntS(33300000)
+ if $s0{head} goto :null42
+ Error("null pointer")
+null42:
+ $t0{t.28} = [$s0{head}]
+ $t0{t.28} = [$t0{t.28}+16]
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call $t0{t.28}
+ $s0{head} = $v0
+ if $s0{head} goto :null43
+ Error("null pointer")
+null43:
+ $t0{t.29} = [$s0{head}]
+ $t0{t.29} = [$t0{t.29}+36]
+ $a0 = $s0{head}
+ call $t0{t.29}
+ PrintIntS(44440000)
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
diff --git a/vaporize/tests/LinkedList.opt.names.vaporm b/vaporize/tests/LinkedList.opt.names.vaporm
new file mode 100644
index 0000000..e0b60f8
--- /dev/null
+++ b/vaporize/tests/LinkedList.opt.names.vaporm
@@ -0,0 +1,562 @@
+const empty_Element
+
+const empty_List
+
+const empty_LL
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_LL
+ call :LL.Start
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func Element.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_Age} = $a1
+ $t2{v_Salary} = $a2
+ $t3{v_Married} = $a3
+ [$t0{this}] = $t1{v_Age}
+ [$t0{this}+4] = $t2{v_Salary}
+ [$t0{this}+8] = $t3{v_Married}
+ $v0 = 1
+ ret
+
+func Element.GetAge [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.GetSalary [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.GetMarried [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Element.Equal [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{other} = $a1
+ $s2{ret_val} = 1
+ if $s1{other} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s1{other}
+ call :Element.GetAge
+ $t0{aux01} = $v0
+ $t1{t.0} = [$s0{this}]
+ $a0 = $s0{this}
+ $a1 = $t0{aux01}
+ $a2 = $t1{t.0}
+ call :Element.Compare
+ $t1{t.1} = $v0
+ if $t1{t.1} goto :if1_else
+ $s2{ret_val} = 0
+ goto :if1_end
+if1_else:
+ if $s1{other} goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s1{other}
+ call :Element.GetSalary
+ $t1{aux02} = $v0
+ $t0{t.2} = [$s0{this}+4]
+ $a0 = $s0{this}
+ $a1 = $t1{aux02}
+ $a2 = $t0{t.2}
+ call :Element.Compare
+ $t0{t.3} = $v0
+ if $t0{t.3} goto :if2_else
+ $s2{ret_val} = 0
+ goto :if2_end
+if2_else:
+ $t0{t.4} = [$s0{this}+8]
+ if0 $t0{t.4} goto :if3_else
+ if $s1{other} goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s1{other}
+ call :Element.GetMarried
+ $t0{t.5} = $v0
+ if $t0{t.5} goto :if4_else
+ $s2{ret_val} = 0
+ goto :if4_end
+if4_else:
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s1{other} goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s1{other}
+ call :Element.GetMarried
+ $t0{t.6} = $v0
+ if0 $t0{t.6} goto :if5_else
+ $s2{ret_val} = 0
+ goto :if5_end
+if5_else:
+if5_end:
+if3_end:
+if2_end:
+if1_end:
+ $v0 = $s2{ret_val}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Element.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{aux02} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if6_else
+ $t1{retval} = 0
+ goto :if6_end
+if6_else:
+ $t2{t.1} = LtS($t0{num1} $t2{aux02})
+ if $t2{t.1} goto :if7_else
+ $t1{retval} = 0
+ goto :if7_end
+if7_else:
+ $t1{retval} = 1
+if7_end:
+if6_end:
+ $v0 = $t1{retval}
+ ret
+
+func List.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ [$t0{this}+8] = 1
+ $v0 = 1
+ ret
+
+func List.InitNew [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_elem} = $a1
+ $t2{v_next} = $a2
+ $t3{v_end} = $a3
+ [$t0{this}+8] = $t3{v_end}
+ [$t0{this}] = $t1{v_elem}
+ [$t0{this}+4] = $t2{v_next}
+ $v0 = 1
+ ret
+
+func List.Insert [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{this} = $a0
+ $t1{new_elem} = $a1
+ $t0{aux03} = $t0{this}
+ $s0{aux02} = HeapAllocZ(12)
+ if $s0{aux02} goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0{aux02}
+ $a1 = $t1{new_elem}
+ $a2 = $t0{aux03}
+ $a3 = 0
+ call :List.InitNew
+ $v0 = $s0{aux02}
+ $s0 = local[0]
+ ret
+
+func List.SetNext [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_next} = $a1
+ [$t0{this}+4] = $t1{v_next}
+ $v0 = 1
+ ret
+
+func List.Delete [in 0, out 0, local 8]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $t0{this} = $a0
+ $s0{e} = $a1
+ $s1{my_head} = $t0{this}
+ $s2{ret_val} = 0
+ $s3{aux04} = Sub(0 1)
+ $s4{aux01} = $t0{this}
+ $s5{prev} = $t0{this}
+ $s6{var_end} = [$t0{this}+8]
+ $s7{var_elem} = [$t0{this}]
+while1_top:
+ if $s6{var_end} goto :ss1_else
+ $t0{t.0} = Sub(1 $s2{ret_val})
+ goto :ss1_end
+ss1_else:
+ $t0{t.0} = 0
+ss1_end:
+ if0 $t0{t.0} goto :while1_end
+ if $s0{e} goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0{e}
+ $a1 = $s7{var_elem}
+ call :Element.Equal
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if8_else
+ $s2{ret_val} = 1
+ $t0{t.2} = LtS($s3{aux04} 0)
+ if0 $t0{t.2} goto :if9_else
+ if $s4{aux01} goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s4{aux01}
+ call :List.GetNext
+ $s1{my_head} = $v0
+ goto :if9_end
+if9_else:
+ $t0{t.3} = Sub(0 555)
+ PrintIntS($t0{t.3})
+ if $s5{prev} goto :null8
+ Error("null pointer")
+null8:
+ if $s4{aux01} goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s4{aux01}
+ call :List.GetNext
+ $t0{t.4} = $v0
+ $a0 = $s5{prev}
+ $a1 = $t0{t.4}
+ call :List.SetNext
+ $t0{t.5} = Sub(0 555)
+ PrintIntS($t0{t.5})
+if9_end:
+ goto :if8_end
+if8_else:
+if8_end:
+ if $s2{ret_val} goto :if10_else
+ $s5{prev} = $s4{aux01}
+ if $s4{aux01} goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s4{aux01}
+ call :List.GetNext
+ $s4{aux01} = $v0
+ if $s4{aux01} goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s4{aux01}
+ call :List.GetEnd
+ $s6{var_end} = $v0
+ if $s4{aux01} goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s4{aux01}
+ call :List.GetElem
+ $s7{var_elem} = $v0
+ $s3{aux04} = 1
+ goto :if10_end
+if10_else:
+if10_end:
+ goto :while1_top
+while1_end:
+ $v0 = $s1{my_head}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+
+func List.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{e} = $a1
+ $s1{int_ret_val} = 0
+ $s2{aux01} = $t0{this}
+ $s3{var_end} = [$t0{this}+8]
+ $t0{var_elem} = [$t0{this}]
+while2_top:
+ $t1{t.0} = Sub(1 $s3{var_end})
+ if0 $t1{t.0} goto :while2_end
+ if $s0{e} goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0{e}
+ $a1 = $t0{var_elem}
+ call :Element.Equal
+ $t1{t.1} = $v0
+ if0 $t1{t.1} goto :if11_else
+ $s1{int_ret_val} = 1
+ goto :if11_end
+if11_else:
+if11_end:
+ if $s2{aux01} goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s2{aux01}
+ call :List.GetNext
+ $s2{aux01} = $v0
+ if $s2{aux01} goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s2{aux01}
+ call :List.GetEnd
+ $s3{var_end} = $v0
+ if $s2{aux01} goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s2{aux01}
+ call :List.GetElem
+ $t0{var_elem} = $v0
+ goto :while2_top
+while2_end:
+ $v0 = $s1{int_ret_val}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func List.GetEnd [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func List.GetElem [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}]
+ $v0 = $t0{t.0}
+ ret
+
+func List.GetNext [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func List.Print [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $t0{this} = $a0
+ $s0{aux01} = $t0{this}
+ $s1{var_end} = [$t0{this}+8]
+ $t0{var_elem} = [$t0{this}]
+while3_top:
+ $t1{t.0} = Sub(1 $s1{var_end})
+ if0 $t1{t.0} goto :while3_end
+ if $t0{var_elem} goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $t0{var_elem}
+ call :Element.GetAge
+ $t1{t.1} = $v0
+ PrintIntS($t1{t.1})
+ if $s0{aux01} goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0{aux01}
+ call :List.GetNext
+ $s0{aux01} = $v0
+ if $s0{aux01} goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0{aux01}
+ call :List.GetEnd
+ $s1{var_end} = $v0
+ if $s0{aux01} goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s0{aux01}
+ call :List.GetElem
+ $t0{var_elem} = $v0
+ goto :while3_top
+while3_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func LL.Start [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{last_elem} = HeapAllocZ(12)
+ if $s0{last_elem} goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0{last_elem}
+ call :List.Init
+ $s0{head} = $s0{last_elem}
+ if $s0{head} goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0{head}
+ call :List.Init
+ if $s0{head} goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0{head}
+ call :List.Print
+ $s1{el01} = HeapAllocZ(12)
+ if $s1{el01} goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s1{el01}
+ $a1 = 25
+ $a2 = 37000
+ $a3 = 0
+ call :Element.Init
+ if $s0{head} goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call :List.Insert
+ $s0{head} = $v0
+ if $s0{head} goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0{head}
+ call :List.Print
+ PrintIntS(10000000)
+ $s1{el01} = HeapAllocZ(12)
+ if $s1{el01} goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s1{el01}
+ $a1 = 39
+ $a2 = 42000
+ $a3 = 1
+ call :Element.Init
+ $s2{el02} = $s1{el01}
+ if $s0{head} goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call :List.Insert
+ $s0{head} = $v0
+ if $s0{head} goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0{head}
+ call :List.Print
+ PrintIntS(10000000)
+ $s1{el01} = HeapAllocZ(12)
+ if $s1{el01} goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s1{el01}
+ $a1 = 22
+ $a2 = 34000
+ $a3 = 0
+ call :Element.Init
+ if $s0{head} goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call :List.Insert
+ $s0{head} = $v0
+ if $s0{head} goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s0{head}
+ call :List.Print
+ $s3{el03} = HeapAllocZ(12)
+ if $s3{el03} goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s3{el03}
+ $a1 = 27
+ $a2 = 34000
+ $a3 = 0
+ call :Element.Init
+ if $s0{head} goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s0{head}
+ $a1 = $s2{el02}
+ call :List.Search
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ if $s0{head} goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s0{head}
+ $a1 = $s3{el03}
+ call :List.Search
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ PrintIntS(10000000)
+ $s1{el01} = HeapAllocZ(12)
+ if $s1{el01} goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s1{el01}
+ $a1 = 28
+ $a2 = 35000
+ $a3 = 0
+ call :Element.Init
+ if $s0{head} goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call :List.Insert
+ $s0{head} = $v0
+ if $s0{head} goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s0{head}
+ call :List.Print
+ PrintIntS(2220000)
+ if $s0{head} goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s0{head}
+ $a1 = $s2{el02}
+ call :List.Delete
+ $s0{head} = $v0
+ if $s0{head} goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s0{head}
+ call :List.Print
+ PrintIntS(33300000)
+ if $s0{head} goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $s0{head}
+ $a1 = $s1{el01}
+ call :List.Delete
+ $s0{head} = $v0
+ if $s0{head} goto :null42
+ Error("null pointer")
+null42:
+ $a0 = $s0{head}
+ call :List.Print
+ PrintIntS(44440000)
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
diff --git a/vaporize/tests/LinkedList.opt.regalloc b/vaporize/tests/LinkedList.opt.regalloc
new file mode 100644
index 0000000..30991e8
--- /dev/null
+++ b/vaporize/tests/LinkedList.opt.regalloc
@@ -0,0 +1,362 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 11
+Linear Range:
+ t.0: 10-11
+Allocation:
+ t.0: t0
+
+func Element.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 15-17
+ v_Age: 15
+ v_Salary: 15-16
+ v_Married: 15-17
+Linear Range:
+ this: 14-17
+ v_Age: 14-15
+ v_Salary: 14-16
+ v_Married: 14-17
+Allocation:
+ this: t0
+ v_Age: t1
+ v_Salary: t2
+ v_Married: t3
+
+func Element.GetAge
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 21
+ t.0: 22
+Linear Range:
+ this: 20-21
+ t.0: 21-22
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.GetSalary
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 25
+ t.0: 26
+Linear Range:
+ this: 24-25
+ t.0: 25-26
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.GetMarried
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 29
+ t.0: 30
+Linear Range:
+ this: 28-29
+ t.0: 29-30
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.Equal
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 33-34 37-40 44 47-50 54
+ other: 33-34 37-40 44 47-50 54-56 59 68 71
+ ret_val: 34 37-40 42-44 47-50 52-56 59-60 62-68 71-72 74-81
+ aux01: 38-39
+ t.0: 39
+ t.1: 40
+ aux02: 48-49
+ t.2: 49
+ t.3: 50
+ t.4: 55
+ t.5: 60
+ nt:
+ t.6: 72
+Linear Range:
+ this: 32-54 (cross call)
+ other: 32-71 (cross call)
+ ret_val: 33-81 (cross call)
+ aux01: 37-39
+ t.0: 38-39
+ t.1: 39-40
+ aux02: 47-49
+ t.2: 48-49
+ t.3: 49-50
+ t.4: 54-55
+ t.5: 59-60
+ t.6: 71-72
+Allocation:
+ this: s0
+ other: s1
+ ret_val: s2
+ aux01: t0
+ t.0: t1
+ t.1: t1
+ aux02: t1
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+
+func Element.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 84-87 91
+ num2: 84-86
+ retval: 89 94 99
+ aux02: 86-87 91
+ t.0: 87
+ t.1: 92
+Linear Range:
+ num1: 83-91
+ num2: 83-86
+ retval: 88-99
+ aux02: 85-91
+ t.0: 86-87
+ t.1: 91-92
+Allocation:
+ num1: t0
+ num2: t1
+ retval: t1
+ aux02: t2
+ t.0: t1
+ t.1: t2
+
+func List.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 102
+Linear Range:
+ this: 101-102
+Allocation:
+ this: t0
+
+func List.InitNew
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 106-108
+ v_elem: 106-107
+ v_next: 106-108
+ v_end: 106
+Linear Range:
+ this: 105-108
+ v_elem: 105-107
+ v_next: 105-108
+ v_end: 105-106
+Allocation:
+ this: t0
+ v_elem: t1
+ v_next: t2
+ v_end: t3
+
+func List.Insert
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 112
+ new_elem: 112-114 117
+ aux03: 113-114 117
+ aux02: 114 117-118
+ ret_val:
+Linear Range:
+ this: 111-112
+ new_elem: 111-117
+ aux03: 112-117
+ aux02: 113-118 (cross call)
+Allocation:
+ this: t0
+ new_elem: t1
+ aux03: t0
+ aux02: s0
+
+func List.SetNext
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 121
+ v_next: 121
+Linear Range:
+ this: 120-121
+ v_next: 120-121
+Allocation:
+ this: t0
+ v_next: t1
+
+func List.Delete
+ in 0, out 0, callee-saves 8, spills 0
+Live In:
+ this: 125-131
+ e: 125-140 143-148 151-156 159 162-173 176-177 180-181 184-190
+ my_head: 126-140 143-147 152-156 159 162-173 176-177 180-181 184-192
+ ret_val: 127-140 143-144 146-148 151-156 159 162-173 176-177 180-181 184-190
+ aux04: 128-140 143-148 151-156 159 162-171 186-190
+ aux01: 129-140 143-148 151-156 159 162-173 176-177 180-181 184-190
+ prev: 130-140 143-148 151-156 159 162-171 173 176-177 180-181 184-190
+ var_end: 131-140 143-148 151-156 159 162-171 181 184-190
+ var_elem: 133-140 143-148 151-156 159 162-171 185-190
+ t.0: 135 139
+ t.1: 144
+ t.2: 147
+ t.3: 155
+ t.4: 163
+ aux05:
+ t.5: 165
+ nt:
+Linear Range:
+ this: 124-131
+ e: 124-190 (cross call)
+ my_head: 125-192 (cross call)
+ ret_val: 126-190 (cross call)
+ aux04: 127-190 (cross call)
+ aux01: 128-190 (cross call)
+ prev: 129-190 (cross call)
+ var_end: 130-190 (cross call)
+ var_elem: 131-190 (cross call)
+ t.0: 134-139
+ t.1: 143-144
+ t.2: 146-147
+ t.3: 154-155
+ t.4: 162-163
+ t.5: 164-165
+Allocation:
+ this: t0
+ e: s0
+ my_head: s1
+ ret_val: s2
+ aux04: s3
+ aux01: s4
+ prev: s5
+ var_end: s6
+ var_elem: s7
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func List.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 195-198
+ e: 195-202 205-212 215-216 219-220 223-224
+ int_ret_val: 196-202 205-206 208-212 215-216 219-220 223-226
+ aux01: 197-202 205-212 215-216 219-220 223-224
+ var_end: 198-200 220 223-224
+ var_elem: 200-202 205 224
+ t.0: 201
+ t.1: 206
+ nt:
+Linear Range:
+ this: 194-198
+ e: 194-224 (cross call)
+ int_ret_val: 195-226 (cross call)
+ aux01: 196-224 (cross call)
+ var_end: 197-224 (cross call)
+ var_elem: 198-224
+ t.0: 200-201
+ t.1: 205-206
+Allocation:
+ this: t0
+ e: s0
+ int_ret_val: s1
+ aux01: s2
+ var_end: s3
+ var_elem: t0
+ t.0: t1
+ t.1: t1
+
+func List.GetEnd
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 229
+ t.0: 230
+Linear Range:
+ this: 228-229
+ t.0: 229-230
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.GetElem
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 233
+ t.0: 234
+Linear Range:
+ this: 232-233
+ t.0: 233-234
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.GetNext
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 237
+ t.0: 238
+Linear Range:
+ this: 236-237
+ t.0: 237-238
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.Print
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 241-243
+ aux01: 242-247 250-252 255-256 259-260 263-264
+ var_end: 243-245 260 263-264
+ var_elem: 245-247 250 264
+ t.0: 246
+ t.1: 251
+Linear Range:
+ this: 240-243
+ aux01: 241-264 (cross call)
+ var_end: 242-264 (cross call)
+ var_elem: 243-264
+ t.0: 245-246
+ t.1: 250-251
+Allocation:
+ this: t0
+ aux01: s0
+ var_end: s1
+ var_elem: t0
+ t.0: t1
+ t.1: t1
+
+func LL.Start
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this:
+ last_elem: 270 273-274
+ aux01:
+ head: 275 278-279 282-284 287-288 291-292 295-298 301-303 306-307 310-313 316-317 320-321 324-326 329-330 333-335 338-342 345-346 349-350 353-355 358-359 362-364 367-368 371
+ el01: 284 287-288 291 298 301-303 306 313 316-317 320 342 345-346 349-350 353-355 358-359 362-364 367
+ el02: 303 306-307 310-313 316-317 320-321 324-326 329-330 333-335 338-342 345-346 349-350 353-355 358
+ el03: 326 329-330 333-335 338
+ t.0: 334
+ t.1: 339
+Linear Range:
+ last_elem: 269-274 (cross call)
+ head: 274-371 (cross call)
+ el01: 283-367 (cross call)
+ el02: 302-358 (cross call)
+ el03: 325-338 (cross call)
+ t.0: 333-334
+ t.1: 338-339
+Allocation:
+ last_elem: s0
+ head: s0
+ el01: s1
+ el02: s2
+ el03: s3
+ t.0: t0
+ t.1: t0
+
diff --git a/vaporize/tests/LinkedList.opt.vaporm b/vaporize/tests/LinkedList.opt.vaporm
new file mode 100644
index 0000000..b9bef66
--- /dev/null
+++ b/vaporize/tests/LinkedList.opt.vaporm
@@ -0,0 +1,562 @@
+const empty_Element
+
+const empty_List
+
+const empty_LL
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_LL
+ call :LL.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func Element.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ [$t0] = $t1
+ [$t0+4] = $t2
+ [$t0+8] = $t3
+ $v0 = 1
+ ret
+
+func Element.GetAge [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0]
+ $v0 = $t0
+ ret
+
+func Element.GetSalary [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Element.GetMarried [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Element.Equal [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = 1
+ if $s1 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s1
+ call :Element.GetAge
+ $t0 = $v0
+ $t1 = [$s0]
+ $a0 = $s0
+ $a1 = $t0
+ $a2 = $t1
+ call :Element.Compare
+ $t1 = $v0
+ if $t1 goto :if1_else
+ $s2 = 0
+ goto :if1_end
+if1_else:
+ if $s1 goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s1
+ call :Element.GetSalary
+ $t1 = $v0
+ $t0 = [$s0+4]
+ $a0 = $s0
+ $a1 = $t1
+ $a2 = $t0
+ call :Element.Compare
+ $t0 = $v0
+ if $t0 goto :if2_else
+ $s2 = 0
+ goto :if2_end
+if2_else:
+ $t0 = [$s0+8]
+ if0 $t0 goto :if3_else
+ if $s1 goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s1
+ call :Element.GetMarried
+ $t0 = $v0
+ if $t0 goto :if4_else
+ $s2 = 0
+ goto :if4_end
+if4_else:
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s1 goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s1
+ call :Element.GetMarried
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ $s2 = 0
+ goto :if5_end
+if5_else:
+if5_end:
+if3_end:
+if2_end:
+if1_end:
+ $v0 = $s2
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Element.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if6_else
+ $t1 = 0
+ goto :if6_end
+if6_else:
+ $t2 = LtS($t0 $t2)
+ if $t2 goto :if7_else
+ $t1 = 0
+ goto :if7_end
+if7_else:
+ $t1 = 1
+if7_end:
+if6_end:
+ $v0 = $t1
+ ret
+
+func List.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ [$t0+8] = 1
+ $v0 = 1
+ ret
+
+func List.InitNew [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ [$t0+8] = $t3
+ [$t0] = $t1
+ [$t0+4] = $t2
+ $v0 = 1
+ ret
+
+func List.Insert [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = $a0
+ $t1 = $a1
+ $t0 = $t0
+ $s0 = HeapAllocZ(12)
+ if $s0 goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0
+ $a1 = $t1
+ $a2 = $t0
+ $a3 = 0
+ call :List.InitNew
+ $v0 = $s0
+ $s0 = local[0]
+ ret
+
+func List.SetNext [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+4] = $t1
+ $v0 = 1
+ ret
+
+func List.Delete [in 0, out 0, local 8]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 0
+ $s3 = Sub(0 1)
+ $s4 = $t0
+ $s5 = $t0
+ $s6 = [$t0+8]
+ $s7 = [$t0]
+while1_top:
+ if $s6 goto :ss1_else
+ $t0 = Sub(1 $s2)
+ goto :ss1_end
+ss1_else:
+ $t0 = 0
+ss1_end:
+ if0 $t0 goto :while1_end
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0
+ $a1 = $s7
+ call :Element.Equal
+ $t0 = $v0
+ if0 $t0 goto :if8_else
+ $s2 = 1
+ $t0 = LtS($s3 0)
+ if0 $t0 goto :if9_else
+ if $s4 goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s4
+ call :List.GetNext
+ $s1 = $v0
+ goto :if9_end
+if9_else:
+ $t0 = Sub(0 555)
+ PrintIntS($t0)
+ if $s5 goto :null8
+ Error("null pointer")
+null8:
+ if $s4 goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s4
+ call :List.GetNext
+ $t0 = $v0
+ $a0 = $s5
+ $a1 = $t0
+ call :List.SetNext
+ $t0 = Sub(0 555)
+ PrintIntS($t0)
+if9_end:
+ goto :if8_end
+if8_else:
+if8_end:
+ if $s2 goto :if10_else
+ $s5 = $s4
+ if $s4 goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s4
+ call :List.GetNext
+ $s4 = $v0
+ if $s4 goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s4
+ call :List.GetEnd
+ $s6 = $v0
+ if $s4 goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s4
+ call :List.GetElem
+ $s7 = $v0
+ $s3 = 1
+ goto :if10_end
+if10_else:
+if10_end:
+ goto :while1_top
+while1_end:
+ $v0 = $s1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+
+func List.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = 0
+ $s2 = $t0
+ $s3 = [$t0+8]
+ $t0 = [$t0]
+while2_top:
+ $t1 = Sub(1 $s3)
+ if0 $t1 goto :while2_end
+ if $s0 goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0
+ $a1 = $t0
+ call :Element.Equal
+ $t1 = $v0
+ if0 $t1 goto :if11_else
+ $s1 = 1
+ goto :if11_end
+if11_else:
+if11_end:
+ if $s2 goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s2
+ call :List.GetNext
+ $s2 = $v0
+ if $s2 goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s2
+ call :List.GetEnd
+ $s3 = $v0
+ if $s2 goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s2
+ call :List.GetElem
+ $t0 = $v0
+ goto :while2_top
+while2_end:
+ $v0 = $s1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func List.GetEnd [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func List.GetElem [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0]
+ $v0 = $t0
+ ret
+
+func List.GetNext [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func List.Print [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $t0 = $a0
+ $s0 = $t0
+ $s1 = [$t0+8]
+ $t0 = [$t0]
+while3_top:
+ $t1 = Sub(1 $s1)
+ if0 $t1 goto :while3_end
+ if $t0 goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $t0
+ call :Element.GetAge
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0
+ call :List.GetNext
+ $s0 = $v0
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0
+ call :List.GetEnd
+ $s1 = $v0
+ if $s0 goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s0
+ call :List.GetElem
+ $t0 = $v0
+ goto :while3_top
+while3_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func LL.Start [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = HeapAllocZ(12)
+ if $s0 goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0
+ call :List.Init
+ $s0 = $s0
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0
+ call :List.Init
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0
+ call :List.Print
+ $s1 = HeapAllocZ(12)
+ if $s1 goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s1
+ $a1 = 25
+ $a2 = 37000
+ $a3 = 0
+ call :Element.Init
+ if $s0 goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0
+ $a1 = $s1
+ call :List.Insert
+ $s0 = $v0
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0
+ call :List.Print
+ PrintIntS(10000000)
+ $s1 = HeapAllocZ(12)
+ if $s1 goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s1
+ $a1 = 39
+ $a2 = 42000
+ $a3 = 1
+ call :Element.Init
+ $s2 = $s1
+ if $s0 goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0
+ $a1 = $s1
+ call :List.Insert
+ $s0 = $v0
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0
+ call :List.Print
+ PrintIntS(10000000)
+ $s1 = HeapAllocZ(12)
+ if $s1 goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s1
+ $a1 = 22
+ $a2 = 34000
+ $a3 = 0
+ call :Element.Init
+ if $s0 goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s0
+ $a1 = $s1
+ call :List.Insert
+ $s0 = $v0
+ if $s0 goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s0
+ call :List.Print
+ $s3 = HeapAllocZ(12)
+ if $s3 goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s3
+ $a1 = 27
+ $a2 = 34000
+ $a3 = 0
+ call :Element.Init
+ if $s0 goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s0
+ $a1 = $s2
+ call :List.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s0
+ $a1 = $s3
+ call :List.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ PrintIntS(10000000)
+ $s1 = HeapAllocZ(12)
+ if $s1 goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s1
+ $a1 = 28
+ $a2 = 35000
+ $a3 = 0
+ call :Element.Init
+ if $s0 goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s0
+ $a1 = $s1
+ call :List.Insert
+ $s0 = $v0
+ if $s0 goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s0
+ call :List.Print
+ PrintIntS(2220000)
+ if $s0 goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s0
+ $a1 = $s2
+ call :List.Delete
+ $s0 = $v0
+ if $s0 goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s0
+ call :List.Print
+ PrintIntS(33300000)
+ if $s0 goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $s0
+ $a1 = $s1
+ call :List.Delete
+ $s0 = $v0
+ if $s0 goto :null42
+ Error("null pointer")
+null42:
+ $a0 = $s0
+ call :List.Print
+ PrintIntS(44440000)
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
diff --git a/vaporize/tests/LinkedList.regalloc b/vaporize/tests/LinkedList.regalloc
new file mode 100644
index 0000000..7b3da4e
--- /dev/null
+++ b/vaporize/tests/LinkedList.regalloc
@@ -0,0 +1,539 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 28-29 32-34
+ t.1: 33-34
+ t.2: 35
+Linear Range:
+ t.0: 27-34
+ t.1: 32-34
+ t.2: 34-35
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func Element.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 39-41
+ v_Age: 39
+ v_Salary: 39-40
+ v_Married: 39-41
+Linear Range:
+ this: 38-41
+ v_Age: 38-39
+ v_Salary: 38-40
+ v_Married: 38-41
+Allocation:
+ this: t0
+ v_Age: t1
+ v_Salary: t2
+ v_Married: t3
+
+func Element.GetAge
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 45
+ t.0: 46
+Linear Range:
+ this: 44-45
+ t.0: 45-46
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.GetSalary
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 49
+ t.0: 50
+Linear Range:
+ this: 48-49
+ t.0: 49-50
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.GetMarried
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 53
+ t.0: 54
+Linear Range:
+ this: 52-53
+ t.0: 53-54
+Allocation:
+ this: t0
+ t.0: t0
+
+func Element.Equal
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 57-58 61-69 73 76-84 88
+ other: 57-58 61-69 73 76-84 88-90 93-95 105 108-110
+ ret_val: 58 61-69 71-73 76-84 86-90 93-97 99-105 108-111 113-120
+ t.0: 62-63
+ aux01: 64-67
+ t.1: 65-67
+ t.2: 67
+ t.3: 68
+ t.4: 69
+ t.5: 77-78
+ aux02: 79-82
+ t.6: 80-82
+ t.7: 82
+ t.8: 83
+ t.9: 84
+ t.10: 89
+ t.11: 94-95
+ t.12: 96
+ t.13: 97
+ nt:
+ t.14: 109-110
+ t.15: 111
+Linear Range:
+ this: 56-88 (cross call)
+ other: 56-110 (cross call)
+ ret_val: 57-120 (cross call)
+ t.0: 61-63
+ aux01: 63-67
+ t.1: 64-67
+ t.2: 66-67
+ t.3: 67-68
+ t.4: 68-69
+ t.5: 76-78
+ aux02: 78-82
+ t.6: 79-82
+ t.7: 81-82
+ t.8: 82-83
+ t.9: 83-84
+ t.10: 88-89
+ t.11: 93-95
+ t.12: 95-96
+ t.13: 96-97
+ t.14: 108-110
+ t.15: 110-111
+Allocation:
+ this: s0
+ other: s1
+ ret_val: s2
+ t.0: t0
+ aux01: t0
+ t.1: t1
+ t.2: t2
+ t.3: t2
+ t.4: t2
+ t.5: t2
+ aux02: t2
+ t.6: t1
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+ t.15: t0
+
+func Element.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 123-126 130
+ num2: 123-125
+ retval: 128 134 139
+ aux02: 125-126 130
+ t.0: 126
+ t.1: 131
+ t.2: 132
+Linear Range:
+ num1: 122-130
+ num2: 122-125
+ retval: 127-139
+ aux02: 124-130
+ t.0: 125-126
+ t.1: 130-131
+ t.2: 131-132
+Allocation:
+ num1: t0
+ num2: t1
+ retval: t1
+ aux02: t2
+ t.0: t1
+ t.1: t2
+ t.2: t2
+
+func List.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 142
+Linear Range:
+ this: 141-142
+Allocation:
+ this: t0
+
+func List.InitNew
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 146-148
+ v_elem: 146-147
+ v_next: 146-148
+ v_end: 146
+Linear Range:
+ this: 145-148
+ v_elem: 145-147
+ v_next: 145-148
+ v_end: 145-146
+Allocation:
+ this: t0
+ v_elem: t1
+ v_next: t2
+ v_end: t3
+
+func List.Insert
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 152
+ new_elem: 152-156 159-161
+ aux03: 153-156 159-161
+ t.0: 154-155
+ aux02: 156 159-162
+ t.1: 160-161
+ ret_val:
+Linear Range:
+ this: 151-152
+ new_elem: 151-161
+ aux03: 152-161
+ t.0: 153-155
+ aux02: 155-162 (cross call)
+ t.1: 159-161
+Allocation:
+ this: t0
+ new_elem: t1
+ aux03: t0
+ t.0: t2
+ aux02: s0
+ t.1: t2
+
+func List.SetNext
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 165
+ v_next: 165
+Linear Range:
+ this: 164-165
+ v_next: 164-165
+Allocation:
+ this: t0
+ v_next: t1
+
+func List.Delete
+ in 0, out 0, callee-saves 8, spills 1
+Live In:
+ this: 169-175
+ e: 169-185 188-195 198-205 208-210 213-227 230-233 236-239 242-250
+ my_head: 170-185 188-194 201-205 208-210 213-227 230-233 236-239 242-252
+ ret_val: 171-185 188-191 193-195 198-205 208-210 213-227 230-233 236-239 242-250
+ aux04: 172-185 188-195 198-205 208-210 213-225 246-250
+ aux01: 173-185 188-195 198-205 208-210 213-227 230-233 236-239 242-250
+ prev: 174-185 188-195 198-205 208-210 213-225 227 230-233 236-239 242-250
+ var_end: 175-185 188-195 198-205 208-210 213-225 239 242-250
+ var_elem: 177-185 188-195 198-205 208-210 213-225 245-250
+ t.1: 178
+ t.0: 180 184
+ t.2: 189-190
+ t.3: 191
+ t.4: 194
+ t.5: 199-200
+ t.6: 204
+ t.7: 209-210 213-216
+ t.8: 214-215
+ t.9: 216
+ aux05:
+ t.10: 218
+ nt:
+ t.11: 225
+ t.12: 231-232
+ t.13: 237-238
+ t.14: 243-244
+Linear Range:
+ this: 168-175
+ e: 168-250 (cross call)
+ my_head: 169-252 (cross call)
+ ret_val: 170-250 (cross call)
+ aux04: 171-250 (cross call)
+ aux01: 172-250 (cross call)
+ prev: 173-250 (cross call)
+ var_end: 174-250 (cross call)
+ var_elem: 175-250 (cross call)
+ t.1: 177-178
+ t.0: 179-184
+ t.2: 188-190
+ t.3: 190-191
+ t.4: 193-194
+ t.5: 198-200
+ t.6: 203-204
+ t.7: 208-216 (cross call)
+ t.8: 213-215
+ t.9: 215-216
+ t.10: 217-218
+ t.11: 224-225
+ t.12: 230-232
+ t.13: 236-238
+ t.14: 242-244
+Allocation:
+ this: t0
+ e: s0
+ my_head: s1
+ ret_val: s2
+ aux04: s3
+ aux01: s4
+ prev: s5
+ var_end: s6
+ var_elem: s7
+ t.1: t0
+ t.0: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: local[0]
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+
+func List.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 255-258
+ e: 255-262 265-274 277-280 283-286 289-292
+ int_ret_val: 256-262 265-268 270-274 277-280 283-286 289-294
+ aux01: 257-262 265-274 277-280 283-286 289-292
+ var_end: 258-260 286 289-292
+ var_elem: 260-262 265-267 292
+ t.0: 261
+ t.1: 266-267
+ t.2: 268
+ nt:
+ t.3: 278-279
+ t.4: 284-285
+ t.5: 290-291
+Linear Range:
+ this: 254-258
+ e: 254-292 (cross call)
+ int_ret_val: 255-294 (cross call)
+ aux01: 256-292 (cross call)
+ var_end: 257-292 (cross call)
+ var_elem: 258-292
+ t.0: 260-261
+ t.1: 265-267
+ t.2: 267-268
+ t.3: 277-279
+ t.4: 283-285
+ t.5: 289-291
+Allocation:
+ this: t0
+ e: s0
+ int_ret_val: s1
+ aux01: s2
+ var_end: s3
+ var_elem: t0
+ t.0: t1
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t1
+
+func List.GetEnd
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 297
+ t.0: 298
+Linear Range:
+ this: 296-297
+ t.0: 297-298
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.GetElem
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 301
+ t.0: 302
+Linear Range:
+ this: 300-301
+ t.0: 301-302
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.GetNext
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 305
+ t.0: 306
+Linear Range:
+ this: 304-305
+ t.0: 305-306
+Allocation:
+ this: t0
+ t.0: t0
+
+func List.Print
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 309-311
+ aux01: 310-315 318-322 325-328 331-334 337-340
+ var_end: 311-313 334 337-340
+ var_elem: 313-315 318-320 340
+ t.0: 314
+ t.1: 319-320
+ t.2: 321
+ t.3: 326-327
+ t.4: 332-333
+ t.5: 338-339
+Linear Range:
+ this: 308-311
+ aux01: 309-340 (cross call)
+ var_end: 310-340 (cross call)
+ var_elem: 311-340
+ t.0: 313-314
+ t.1: 318-320
+ t.2: 320-321
+ t.3: 325-327
+ t.4: 331-333
+ t.5: 337-339
+Allocation:
+ this: t0
+ aux01: s0
+ var_end: s1
+ var_elem: t0
+ t.0: t1
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t1
+
+func LL.Start
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this:
+ t.0: 346-347
+ last_elem: 348 351-354
+ t.1: 352-353
+ aux01:
+ head: 355 358-361 364-370 373-376 379-382 385-392 395-399 402-405 408-415 418-421 424-427 430-436 439-442 445-449 452-460 463-466 469-472 475-479 482-485 488-492 495-498 501-503
+ t.2: 359-360
+ t.3: 365-366
+ t.4: 368-369
+ el01: 370 373-376 379-381 392 395-399 402-404 415 418-421 424-426 460 463-466 469-472 475-479 482-485 488-492 495-497
+ t.5: 374-375
+ t.6: 380-381
+ t.7: 386-387
+ t.8: 390-391
+ t.9: 396-397
+ el02: 399 402-405 408-415 418-421 424-427 430-436 439-442 445-449 452-460 463-466 469-472 475-479 482-484
+ t.10: 403-404
+ t.11: 409-410
+ t.12: 413-414
+ t.13: 419-420
+ t.14: 425-426
+ t.15: 431-432
+ t.16: 434-435
+ el03: 436 439-442 445-449 452-454
+ t.17: 440-441
+ t.18: 446-447
+ t.19: 448
+ t.20: 453-454
+ t.21: 455
+ t.22: 458-459
+ t.23: 464-465
+ t.24: 470-471
+ t.25: 476-477
+ t.26: 483-484
+ t.27: 489-490
+ t.28: 496-497
+ t.29: 502-503
+Linear Range:
+ t.0: 345-347
+ last_elem: 347-354 (cross call)
+ t.1: 351-353
+ head: 354-503 (cross call)
+ t.2: 358-360
+ t.3: 364-366
+ t.4: 367-369
+ el01: 369-497 (cross call)
+ t.5: 373-375
+ t.6: 379-381
+ t.7: 385-387
+ t.8: 389-391
+ t.9: 395-397
+ el02: 398-484 (cross call)
+ t.10: 402-404
+ t.11: 408-410
+ t.12: 412-414
+ t.13: 418-420
+ t.14: 424-426
+ t.15: 430-432
+ t.16: 433-435
+ el03: 435-454 (cross call)
+ t.17: 439-441
+ t.18: 445-447
+ t.19: 447-448
+ t.20: 452-454
+ t.21: 454-455
+ t.22: 457-459
+ t.23: 463-465
+ t.24: 469-471
+ t.25: 475-477
+ t.26: 482-484
+ t.27: 488-490
+ t.28: 495-497
+ t.29: 501-503
+Allocation:
+ t.0: t0
+ last_elem: s0
+ t.1: t0
+ head: s0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ el01: s1
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ el02: s2
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+ t.15: t0
+ t.16: t0
+ el03: s3
+ t.17: t0
+ t.18: t0
+ t.19: t0
+ t.20: t0
+ t.21: t0
+ t.22: t0
+ t.23: t0
+ t.24: t0
+ t.25: t0
+ t.26: t0
+ t.27: t0
+ t.28: t0
+ t.29: t0
+
diff --git a/vaporize/tests/LinkedList.vaporm b/vaporize/tests/LinkedList.vaporm
new file mode 100644
index 0000000..80c3a99
--- /dev/null
+++ b/vaporize/tests/LinkedList.vaporm
@@ -0,0 +1,698 @@
+const vmt_Element
+ :Element.Init
+ :Element.GetAge
+ :Element.GetSalary
+ :Element.GetMarried
+ :Element.Equal
+ :Element.Compare
+
+const vmt_List
+ :List.Init
+ :List.InitNew
+ :List.Insert
+ :List.SetNext
+ :List.Delete
+ :List.Search
+ :List.GetEnd
+ :List.GetElem
+ :List.GetNext
+ :List.Print
+
+const vmt_LL
+ :LL.Start
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(4)
+ [$t0] = :vmt_LL
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func Element.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ [$t0+4] = $t1
+ [$t0+8] = $t2
+ [$t0+12] = $t3
+ $v0 = 1
+ ret
+
+func Element.GetAge [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Element.GetSalary [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Element.GetMarried [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func Element.Equal [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = 1
+ if $s1 goto :null2
+ Error("null pointer")
+null2:
+ $t0 = [$s1]
+ $t0 = [$t0+4]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $t1 = [$s0]
+ $t1 = [$t1+20]
+ $t2 = [$s0+4]
+ $a0 = $s0
+ $a1 = $t0
+ $a2 = $t2
+ call $t1
+ $t2 = $v0
+ $t2 = Sub(1 $t2)
+ if0 $t2 goto :if1_else
+ $s2 = 0
+ goto :if1_end
+if1_else:
+ if $s1 goto :null3
+ Error("null pointer")
+null3:
+ $t2 = [$s1]
+ $t2 = [$t2+8]
+ $a0 = $s1
+ call $t2
+ $t2 = $v0
+ $t1 = [$s0]
+ $t1 = [$t1+20]
+ $t0 = [$s0+8]
+ $a0 = $s0
+ $a1 = $t2
+ $a2 = $t0
+ call $t1
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ if0 $t0 goto :if2_else
+ $s2 = 0
+ goto :if2_end
+if2_else:
+ $t0 = [$s0+12]
+ if0 $t0 goto :if3_else
+ if $s1 goto :null4
+ Error("null pointer")
+null4:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ if0 $t0 goto :if4_else
+ $s2 = 0
+ goto :if4_end
+if4_else:
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s1 goto :null5
+ Error("null pointer")
+null5:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ $s2 = 0
+ goto :if5_end
+if5_else:
+if5_end:
+if3_end:
+if2_end:
+if1_end:
+ $v0 = $s2
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Element.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if6_else
+ $t1 = 0
+ goto :if6_end
+if6_else:
+ $t2 = LtS($t0 $t2)
+ $t2 = Sub(1 $t2)
+ if0 $t2 goto :if7_else
+ $t1 = 0
+ goto :if7_end
+if7_else:
+ $t1 = 1
+if7_end:
+if6_end:
+ $v0 = $t1
+ ret
+
+func List.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ [$t0+12] = 1
+ $v0 = 1
+ ret
+
+func List.InitNew [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ [$t0+12] = $t3
+ [$t0+4] = $t1
+ [$t0+8] = $t2
+ $v0 = 1
+ ret
+
+func List.Insert [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = $a0
+ $t1 = $a1
+ $t0 = $t0
+ $t2 = HeapAllocZ(16)
+ [$t2] = :vmt_List
+ $s0 = $t2
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $t2 = [$s0]
+ $t2 = [$t2+4]
+ $a0 = $s0
+ $a1 = $t1
+ $a2 = $t0
+ $a3 = 0
+ call $t2
+ $v0 = $s0
+ $s0 = local[0]
+ ret
+
+func List.SetNext [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ $v0 = 1
+ ret
+
+func List.Delete [in 0, out 0, local 9]
+ local[1] = $s0
+ local[2] = $s1
+ local[3] = $s2
+ local[4] = $s3
+ local[5] = $s4
+ local[6] = $s5
+ local[7] = $s6
+ local[8] = $s7
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 0
+ $s3 = Sub(0 1)
+ $s4 = $t0
+ $s5 = $t0
+ $s6 = [$t0+12]
+ $s7 = [$t0+4]
+while1_top:
+ $t0 = Sub(1 $s6)
+ if0 $t0 goto :ss1_else
+ $t0 = Sub(1 $s2)
+ goto :ss1_end
+ss1_else:
+ $t0 = 0
+ss1_end:
+ if0 $t0 goto :while1_end
+ if $s0 goto :null7
+ Error("null pointer")
+null7:
+ $t0 = [$s0]
+ $t0 = [$t0+16]
+ $a0 = $s0
+ $a1 = $s7
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if8_else
+ $s2 = 1
+ $t0 = LtS($s3 0)
+ if0 $t0 goto :if9_else
+ if $s4 goto :null8
+ Error("null pointer")
+null8:
+ $t0 = [$s4]
+ $t0 = [$t0+32]
+ $a0 = $s4
+ call $t0
+ $s1 = $v0
+ goto :if9_end
+if9_else:
+ $t0 = Sub(0 555)
+ PrintIntS($t0)
+ if $s5 goto :null9
+ Error("null pointer")
+null9:
+ $v0 = [$s5]
+ local[0] = $v0
+ $v0 = local[0]
+ $v0 = [$v0+12]
+ local[0] = $v0
+ if $s4 goto :null10
+ Error("null pointer")
+null10:
+ $t0 = [$s4]
+ $t0 = [$t0+32]
+ $a0 = $s4
+ call $t0
+ $t0 = $v0
+ $a0 = $s5
+ $a1 = $t0
+ $v0 = local[0]
+ call $v0
+ $t0 = Sub(0 555)
+ PrintIntS($t0)
+if9_end:
+ goto :if8_end
+if8_else:
+if8_end:
+ $t0 = Sub(1 $s2)
+ if0 $t0 goto :if10_else
+ $s5 = $s4
+ if $s4 goto :null11
+ Error("null pointer")
+null11:
+ $t0 = [$s4]
+ $t0 = [$t0+32]
+ $a0 = $s4
+ call $t0
+ $s4 = $v0
+ if $s4 goto :null12
+ Error("null pointer")
+null12:
+ $t0 = [$s4]
+ $t0 = [$t0+24]
+ $a0 = $s4
+ call $t0
+ $s6 = $v0
+ if $s4 goto :null13
+ Error("null pointer")
+null13:
+ $t0 = [$s4]
+ $t0 = [$t0+28]
+ $a0 = $s4
+ call $t0
+ $s7 = $v0
+ $s3 = 1
+ goto :if10_end
+if10_else:
+if10_end:
+ goto :while1_top
+while1_end:
+ $v0 = $s1
+ $s0 = local[1]
+ $s1 = local[2]
+ $s2 = local[3]
+ $s3 = local[4]
+ $s4 = local[5]
+ $s5 = local[6]
+ $s6 = local[7]
+ $s7 = local[8]
+ ret
+
+func List.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = 0
+ $s2 = $t0
+ $s3 = [$t0+12]
+ $t0 = [$t0+4]
+while2_top:
+ $t1 = Sub(1 $s3)
+ if0 $t1 goto :while2_end
+ if $s0 goto :null14
+ Error("null pointer")
+null14:
+ $t1 = [$s0]
+ $t1 = [$t1+16]
+ $a0 = $s0
+ $a1 = $t0
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if11_else
+ $s1 = 1
+ goto :if11_end
+if11_else:
+if11_end:
+ if $s2 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$s2]
+ $t1 = [$t1+32]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ if $s2 goto :null16
+ Error("null pointer")
+null16:
+ $t1 = [$s2]
+ $t1 = [$t1+24]
+ $a0 = $s2
+ call $t1
+ $s3 = $v0
+ if $s2 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$s2]
+ $t1 = [$t1+28]
+ $a0 = $s2
+ call $t1
+ $t0 = $v0
+ goto :while2_top
+while2_end:
+ $v0 = $s1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func List.GetEnd [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func List.GetElem [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func List.GetNext [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func List.Print [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $t0 = $a0
+ $s0 = $t0
+ $s1 = [$t0+12]
+ $t0 = [$t0+4]
+while3_top:
+ $t1 = Sub(1 $s1)
+ if0 $t1 goto :while3_end
+ if $t0 goto :null18
+ Error("null pointer")
+null18:
+ $t1 = [$t0]
+ $t1 = [$t1+4]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $t1 = [$s0]
+ $t1 = [$t1+32]
+ $a0 = $s0
+ call $t1
+ $s0 = $v0
+ if $s0 goto :null20
+ Error("null pointer")
+null20:
+ $t1 = [$s0]
+ $t1 = [$t1+24]
+ $a0 = $s0
+ call $t1
+ $s1 = $v0
+ if $s0 goto :null21
+ Error("null pointer")
+null21:
+ $t1 = [$s0]
+ $t1 = [$t1+28]
+ $a0 = $s0
+ call $t1
+ $t0 = $v0
+ goto :while3_top
+while3_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func LL.Start [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_List
+ $s0 = $t0
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $t0 = [$s0]
+ $t0 = [$t0]
+ $a0 = $s0
+ call $t0
+ $s0 = $s0
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $t0 = [$s0]
+ $t0 = [$t0]
+ $a0 = $s0
+ call $t0
+ if $s0 goto :null24
+ Error("null pointer")
+null24:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_Element
+ $s1 = $t0
+ if $s1 goto :null25
+ Error("null pointer")
+null25:
+ $t0 = [$s1]
+ $t0 = [$t0]
+ $a0 = $s1
+ $a1 = 25
+ $a2 = 37000
+ $a3 = 0
+ call $t0
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s1
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null27
+ Error("null pointer")
+null27:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ PrintIntS(10000000)
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_Element
+ $s1 = $t0
+ if $s1 goto :null28
+ Error("null pointer")
+null28:
+ $t0 = [$s1]
+ $t0 = [$t0]
+ $a0 = $s1
+ $a1 = 39
+ $a2 = 42000
+ $a3 = 1
+ call $t0
+ $s2 = $s1
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s1
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null30
+ Error("null pointer")
+null30:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ PrintIntS(10000000)
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_Element
+ $s1 = $t0
+ if $s1 goto :null31
+ Error("null pointer")
+null31:
+ $t0 = [$s1]
+ $t0 = [$t0]
+ $a0 = $s1
+ $a1 = 22
+ $a2 = 34000
+ $a3 = 0
+ call $t0
+ if $s0 goto :null32
+ Error("null pointer")
+null32:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s1
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null33
+ Error("null pointer")
+null33:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_Element
+ $s3 = $t0
+ if $s3 goto :null34
+ Error("null pointer")
+null34:
+ $t0 = [$s3]
+ $t0 = [$t0]
+ $a0 = $s3
+ $a1 = 27
+ $a2 = 34000
+ $a3 = 0
+ call $t0
+ if $s0 goto :null35
+ Error("null pointer")
+null35:
+ $t0 = [$s0]
+ $t0 = [$t0+20]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null36
+ Error("null pointer")
+null36:
+ $t0 = [$s0]
+ $t0 = [$t0+20]
+ $a0 = $s0
+ $a1 = $s3
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ PrintIntS(10000000)
+ $t0 = HeapAllocZ(16)
+ [$t0] = :vmt_Element
+ $s1 = $t0
+ if $s1 goto :null37
+ Error("null pointer")
+null37:
+ $t0 = [$s1]
+ $t0 = [$t0]
+ $a0 = $s1
+ $a1 = 28
+ $a2 = 35000
+ $a3 = 0
+ call $t0
+ if $s0 goto :null38
+ Error("null pointer")
+null38:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s1
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null39
+ Error("null pointer")
+null39:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ PrintIntS(2220000)
+ if $s0 goto :null40
+ Error("null pointer")
+null40:
+ $t0 = [$s0]
+ $t0 = [$t0+16]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null41
+ Error("null pointer")
+null41:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ PrintIntS(33300000)
+ if $s0 goto :null42
+ Error("null pointer")
+null42:
+ $t0 = [$s0]
+ $t0 = [$t0+16]
+ $a0 = $s0
+ $a1 = $s1
+ call $t0
+ $s0 = $v0
+ if $s0 goto :null43
+ Error("null pointer")
+null43:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ call $t0
+ PrintIntS(44440000)
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
diff --git a/vaporize/tests/MoreThan4.names.vaporm b/vaporize/tests/MoreThan4.names.vaporm
new file mode 100644
index 0000000..366618c
--- /dev/null
+++ b/vaporize/tests/MoreThan4.names.vaporm
@@ -0,0 +1,68 @@
+const vmt_MT4
+ :MT4.Start
+ :MT4.Change
+
+func Main [in 0, out 3, local 0]
+ $t0{t.0} = HeapAllocZ(4)
+ [$t0{t.0}] = :vmt_MT4
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 1
+ $a2 = 2
+ $a3 = 3
+ out[0] = 4
+ out[1] = 5
+ out[2] = 6
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func MT4.Start [in 3, out 3, local 0]
+ $t0{this} = $a0
+ $t1{p1} = $a1
+ $t2{p2} = $a2
+ $t3{p3} = $a3
+ $t4{p4} = in[0]
+ $t5{p5} = in[1]
+ $t6{p6} = in[2]
+ PrintIntS($t1{p1})
+ PrintIntS($t2{p2})
+ PrintIntS($t3{p3})
+ PrintIntS($t4{p4})
+ PrintIntS($t5{p5})
+ PrintIntS($t6{p6})
+ $t7{t.0} = [$t0{this}]
+ $t7{t.0} = [$t7{t.0}+4]
+ $a0 = $t0{this}
+ $a1 = $t6{p6}
+ $a2 = $t5{p5}
+ $a3 = $t4{p4}
+ out[0] = $t3{p3}
+ out[1] = $t2{p2}
+ out[2] = $t1{p1}
+ call $t7{t.0}
+ $t7{aux} = $v0
+ $v0 = $t7{aux}
+ ret
+
+func MT4.Change [in 3, out 0, local 0]
+ $t0{p1} = $a1
+ $t1{p2} = $a2
+ $t2{p3} = $a3
+ $t3{p4} = in[0]
+ $t4{p5} = in[1]
+ $t5{p6} = in[2]
+ PrintIntS($t0{p1})
+ PrintIntS($t1{p2})
+ PrintIntS($t2{p3})
+ PrintIntS($t3{p4})
+ PrintIntS($t4{p5})
+ PrintIntS($t5{p6})
+ $v0 = 0
+ ret
+
diff --git a/vaporize/tests/MoreThan4.opt.names.vaporm b/vaporize/tests/MoreThan4.opt.names.vaporm
new file mode 100644
index 0000000..a07f7e7
--- /dev/null
+++ b/vaporize/tests/MoreThan4.opt.names.vaporm
@@ -0,0 +1,57 @@
+const empty_MT4
+
+func Main [in 0, out 3, local 0]
+ $a0 = :empty_MT4
+ $a1 = 1
+ $a2 = 2
+ $a3 = 3
+ out[0] = 4
+ out[1] = 5
+ out[2] = 6
+ call :MT4.Start
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func MT4.Start [in 3, out 3, local 0]
+ $t0{this} = $a0
+ $t1{p1} = $a1
+ $t2{p2} = $a2
+ $t3{p3} = $a3
+ $t4{p4} = in[0]
+ $t5{p5} = in[1]
+ $t6{p6} = in[2]
+ PrintIntS($t1{p1})
+ PrintIntS($t2{p2})
+ PrintIntS($t3{p3})
+ PrintIntS($t4{p4})
+ PrintIntS($t5{p5})
+ PrintIntS($t6{p6})
+ $a0 = $t0{this}
+ $a1 = $t6{p6}
+ $a2 = $t5{p5}
+ $a3 = $t4{p4}
+ out[0] = $t3{p3}
+ out[1] = $t2{p2}
+ out[2] = $t1{p1}
+ call :MT4.Change
+ $t6{aux} = $v0
+ $v0 = $t6{aux}
+ ret
+
+func MT4.Change [in 3, out 0, local 0]
+ $t0{p1} = $a1
+ $t1{p2} = $a2
+ $t2{p3} = $a3
+ $t3{p4} = in[0]
+ $t4{p5} = in[1]
+ $t5{p6} = in[2]
+ PrintIntS($t0{p1})
+ PrintIntS($t1{p2})
+ PrintIntS($t2{p3})
+ PrintIntS($t3{p4})
+ PrintIntS($t4{p5})
+ PrintIntS($t5{p6})
+ $v0 = 0
+ ret
+
diff --git a/vaporize/tests/MoreThan4.opt.regalloc b/vaporize/tests/MoreThan4.opt.regalloc
new file mode 100644
index 0000000..ceb8927
--- /dev/null
+++ b/vaporize/tests/MoreThan4.opt.regalloc
@@ -0,0 +1,64 @@
+func Main
+ in 0, out 3, callee-saves 0, spills 0
+Live In:
+ t.0: 7
+Linear Range:
+ t.0: 6-7
+Allocation:
+ t.0: t0
+
+func MT4.Start
+ in 3, out 3, callee-saves 0, spills 0
+Live In:
+ this: 11-17
+ p1: 11-17
+ p2: 11-17
+ p3: 11-17
+ p4: 11-17
+ p5: 11-17
+ p6: 11-17
+ aux: 18
+Linear Range:
+ this: 10-17
+ p1: 10-17
+ p2: 10-17
+ p3: 10-17
+ p4: 10-17
+ p5: 10-17
+ p6: 10-17
+ aux: 17-18
+Allocation:
+ this: t0
+ p1: t1
+ p2: t2
+ p3: t3
+ p4: t4
+ p5: t5
+ p6: t6
+ aux: t6
+
+func MT4.Change
+ in 3, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ p1: 21
+ p2: 21-22
+ p3: 21-23
+ p4: 21-24
+ p5: 21-25
+ p6: 21-26
+Linear Range:
+ p1: 20-21
+ p2: 20-22
+ p3: 20-23
+ p4: 20-24
+ p5: 20-25
+ p6: 20-26
+Allocation:
+ p1: t0
+ p2: t1
+ p3: t2
+ p4: t3
+ p5: t4
+ p6: t5
+
diff --git a/vaporize/tests/MoreThan4.opt.vaporm b/vaporize/tests/MoreThan4.opt.vaporm
new file mode 100644
index 0000000..d1d663b
--- /dev/null
+++ b/vaporize/tests/MoreThan4.opt.vaporm
@@ -0,0 +1,57 @@
+const empty_MT4
+
+func Main [in 0, out 3, local 0]
+ $a0 = :empty_MT4
+ $a1 = 1
+ $a2 = 2
+ $a3 = 3
+ out[0] = 4
+ out[1] = 5
+ out[2] = 6
+ call :MT4.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func MT4.Start [in 3, out 3, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ $t4 = in[0]
+ $t5 = in[1]
+ $t6 = in[2]
+ PrintIntS($t1)
+ PrintIntS($t2)
+ PrintIntS($t3)
+ PrintIntS($t4)
+ PrintIntS($t5)
+ PrintIntS($t6)
+ $a0 = $t0
+ $a1 = $t6
+ $a2 = $t5
+ $a3 = $t4
+ out[0] = $t3
+ out[1] = $t2
+ out[2] = $t1
+ call :MT4.Change
+ $t6 = $v0
+ $v0 = $t6
+ ret
+
+func MT4.Change [in 3, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = $a3
+ $t3 = in[0]
+ $t4 = in[1]
+ $t5 = in[2]
+ PrintIntS($t0)
+ PrintIntS($t1)
+ PrintIntS($t2)
+ PrintIntS($t3)
+ PrintIntS($t4)
+ PrintIntS($t5)
+ $v0 = 0
+ ret
+
diff --git a/vaporize/tests/MoreThan4.regalloc b/vaporize/tests/MoreThan4.regalloc
new file mode 100644
index 0000000..0748f62
--- /dev/null
+++ b/vaporize/tests/MoreThan4.regalloc
@@ -0,0 +1,73 @@
+func Main
+ in 0, out 3, callee-saves 0, spills 0
+Live In:
+ t.0: 9-10 13-15
+ t.1: 14-15
+ t.2: 16
+Linear Range:
+ t.0: 8-15
+ t.1: 13-15
+ t.2: 15-16
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func MT4.Start
+ in 3, out 3, callee-saves 0, spills 0
+Live In:
+ this: 20-28
+ p1: 20-28
+ p2: 20-28
+ p3: 20-28
+ p4: 20-28
+ p5: 20-28
+ p6: 20-28
+ t.0: 27-28
+ aux: 29
+Linear Range:
+ this: 19-28
+ p1: 19-28
+ p2: 19-28
+ p3: 19-28
+ p4: 19-28
+ p5: 19-28
+ p6: 19-28
+ t.0: 26-28
+ aux: 28-29
+Allocation:
+ this: t0
+ p1: t1
+ p2: t2
+ p3: t3
+ p4: t4
+ p5: t5
+ p6: t6
+ t.0: t7
+ aux: t7
+
+func MT4.Change
+ in 3, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ p1: 32
+ p2: 32-33
+ p3: 32-34
+ p4: 32-35
+ p5: 32-36
+ p6: 32-37
+Linear Range:
+ p1: 31-32
+ p2: 31-33
+ p3: 31-34
+ p4: 31-35
+ p5: 31-36
+ p6: 31-37
+Allocation:
+ p1: t0
+ p2: t1
+ p3: t2
+ p4: t3
+ p5: t4
+ p6: t5
+
diff --git a/vaporize/tests/MoreThan4.vaporm b/vaporize/tests/MoreThan4.vaporm
new file mode 100644
index 0000000..bf549b2
--- /dev/null
+++ b/vaporize/tests/MoreThan4.vaporm
@@ -0,0 +1,68 @@
+const vmt_MT4
+ :MT4.Start
+ :MT4.Change
+
+func Main [in 0, out 3, local 0]
+ $t0 = HeapAllocZ(4)
+ [$t0] = :vmt_MT4
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ $a1 = 1
+ $a2 = 2
+ $a3 = 3
+ out[0] = 4
+ out[1] = 5
+ out[2] = 6
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func MT4.Start [in 3, out 3, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ $t2 = $a2
+ $t3 = $a3
+ $t4 = in[0]
+ $t5 = in[1]
+ $t6 = in[2]
+ PrintIntS($t1)
+ PrintIntS($t2)
+ PrintIntS($t3)
+ PrintIntS($t4)
+ PrintIntS($t5)
+ PrintIntS($t6)
+ $t7 = [$t0]
+ $t7 = [$t7+4]
+ $a0 = $t0
+ $a1 = $t6
+ $a2 = $t5
+ $a3 = $t4
+ out[0] = $t3
+ out[1] = $t2
+ out[2] = $t1
+ call $t7
+ $t7 = $v0
+ $v0 = $t7
+ ret
+
+func MT4.Change [in 3, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = $a3
+ $t3 = in[0]
+ $t4 = in[1]
+ $t5 = in[2]
+ PrintIntS($t0)
+ PrintIntS($t1)
+ PrintIntS($t2)
+ PrintIntS($t3)
+ PrintIntS($t4)
+ PrintIntS($t5)
+ $v0 = 0
+ ret
+
diff --git a/vaporize/tests/QuickSort.names.vaporm b/vaporize/tests/QuickSort.names.vaporm
new file mode 100644
index 0000000..0029cf0
--- /dev/null
+++ b/vaporize/tests/QuickSort.names.vaporm
@@ -0,0 +1,439 @@
+const vmt_QS
+ :QS.Start
+ :QS.Sort
+ :QS.Print
+ :QS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(12)
+ [$t0{t.0}] = :vmt_QS
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func QS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $t1{t.0} = [$s0{this}]
+ $t1{t.0} = [$t1{t.0}+12]
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call $t1{t.0}
+ $t1{t.1} = [$s0{this}]
+ $t1{t.1} = [$t1{t.1}+8]
+ $a0 = $s0{this}
+ call $t1{t.1}
+ PrintIntS(9999)
+ $t1{t.2} = [$s0{this}+8]
+ $t1{aux01} = Sub($t1{t.2} 1)
+ $t0{t.3} = [$s0{this}]
+ $t0{t.3} = [$t0{t.3}+4]
+ $a0 = $s0{this}
+ $a1 = 0
+ $a2 = $t1{aux01}
+ call $t0{t.3}
+ $t0{t.4} = [$s0{this}]
+ $t0{t.4} = [$t0{t.4}+8]
+ $a0 = $s0{this}
+ call $t0{t.4}
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func QS.Sort [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $t0{left} = $a1
+ $s1{right} = $a2
+ $t1{t} = 0
+ $t2{t.0} = LtS($t0{left} $s1{right})
+ if0 $t2{t.0} goto :if1_else
+ $t2{t.1} = [$s0{this}+4]
+ if $t2{t.1} goto :null2
+ Error("null pointer")
+null2:
+ $t3{t.2} = [$t2{t.1}]
+ $t3{t.2} = Lt($s1{right} $t3{t.2})
+ if $t3{t.2} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3{t.2} = MulS($s1{right} 4)
+ $t3{t.2} = Add($t3{t.2} $t2{t.1})
+ $t3{v} = [$t3{t.2}+4]
+ $s2{i} = Sub($t0{left} 1)
+ $t2{j} = $s1{right}
+ $t4{cont01} = 1
+while1_top:
+ if0 $t4{cont01} goto :while1_end
+ $t5{cont02} = 1
+while2_top:
+ if0 $t5{cont02} goto :while2_end
+ $s2{i} = Add($s2{i} 1)
+ $t6{t.3} = [$s0{this}+4]
+ if $t6{t.3} goto :null3
+ Error("null pointer")
+null3:
+ $t7{t.4} = [$t6{t.3}]
+ $t7{t.4} = Lt($s2{i} $t7{t.4})
+ if $t7{t.4} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t7{t.4} = MulS($s2{i} 4)
+ $t7{t.4} = Add($t7{t.4} $t6{t.3})
+ $t7{aux03} = [$t7{t.4}+4]
+ $t6{t.5} = LtS($t7{aux03} $t3{v})
+ $t6{t.6} = Sub(1 $t6{t.5})
+ if0 $t6{t.6} goto :if2_else
+ $t5{cont02} = 0
+ goto :if2_end
+if2_else:
+ $t5{cont02} = 1
+if2_end:
+ goto :while2_top
+while2_end:
+ $t5{cont02} = 1
+while3_top:
+ if0 $t5{cont02} goto :while3_end
+ $t2{j} = Sub($t2{j} 1)
+ $t6{t.7} = [$s0{this}+4]
+ if $t6{t.7} goto :null4
+ Error("null pointer")
+null4:
+ $t8{t.8} = [$t6{t.7}]
+ $t8{t.8} = Lt($t2{j} $t8{t.8})
+ if $t8{t.8} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t8{t.8} = MulS($t2{j} 4)
+ $t8{t.8} = Add($t8{t.8} $t6{t.7})
+ $t7{aux03} = [$t8{t.8}+4]
+ $t7{t.9} = LtS($t3{v} $t7{aux03})
+ $t7{t.10} = Sub(1 $t7{t.9})
+ if0 $t7{t.10} goto :if3_else
+ $t5{cont02} = 0
+ goto :if3_end
+if3_else:
+ $t5{cont02} = 1
+if3_end:
+ goto :while3_top
+while3_end:
+ $t5{t.11} = [$s0{this}+4]
+ if $t5{t.11} goto :null5
+ Error("null pointer")
+null5:
+ $t7{t.12} = [$t5{t.11}]
+ $t7{t.12} = Lt($s2{i} $t7{t.12})
+ if $t7{t.12} goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7{t.12} = MulS($s2{i} 4)
+ $t7{t.12} = Add($t7{t.12} $t5{t.11})
+ $t1{t} = [$t7{t.12}+4]
+ $t7{t.13} = [$s0{this}+4]
+ if $t7{t.13} goto :null6
+ Error("null pointer")
+null6:
+ $t5{t.14} = [$t7{t.13}]
+ $t5{t.14} = Lt($s2{i} $t5{t.14})
+ if $t5{t.14} goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t5{t.14} = MulS($s2{i} 4)
+ $t5{t.14} = Add($t5{t.14} $t7{t.13})
+ $t7{t.15} = [$s0{this}+4]
+ if $t7{t.15} goto :null7
+ Error("null pointer")
+null7:
+ $t8{t.16} = [$t7{t.15}]
+ $t8{t.16} = Lt($t2{j} $t8{t.16})
+ if $t8{t.16} goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t8{t.16} = MulS($t2{j} 4)
+ $t8{t.16} = Add($t8{t.16} $t7{t.15})
+ $t8{t.17} = [$t8{t.16}+4]
+ [$t5{t.14}+4] = $t8{t.17}
+ $t8{t.18} = [$s0{this}+4]
+ if $t8{t.18} goto :null8
+ Error("null pointer")
+null8:
+ $t5{t.19} = [$t8{t.18}]
+ $t5{t.19} = Lt($t2{j} $t5{t.19})
+ if $t5{t.19} goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t5{t.19} = MulS($t2{j} 4)
+ $t5{t.19} = Add($t5{t.19} $t8{t.18})
+ [$t5{t.19}+4] = $t1{t}
+ $t5{t.20} = Add($s2{i} 1)
+ $t5{t.21} = LtS($t2{j} $t5{t.20})
+ if0 $t5{t.21} goto :if4_else
+ $t4{cont01} = 0
+ goto :if4_end
+if4_else:
+ $t4{cont01} = 1
+if4_end:
+ goto :while1_top
+while1_end:
+ $t4{t.22} = [$s0{this}+4]
+ if $t4{t.22} goto :null9
+ Error("null pointer")
+null9:
+ $t3{t.23} = [$t4{t.22}]
+ $t3{t.23} = Lt($t2{j} $t3{t.23})
+ if $t3{t.23} goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t3{t.23} = MulS($t2{j} 4)
+ $t3{t.23} = Add($t3{t.23} $t4{t.22})
+ $t4{t.24} = [$s0{this}+4]
+ if $t4{t.24} goto :null10
+ Error("null pointer")
+null10:
+ $t2{t.25} = [$t4{t.24}]
+ $t2{t.25} = Lt($s2{i} $t2{t.25})
+ if $t2{t.25} goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t2{t.25} = MulS($s2{i} 4)
+ $t2{t.25} = Add($t2{t.25} $t4{t.24})
+ $t2{t.26} = [$t2{t.25}+4]
+ [$t3{t.23}+4] = $t2{t.26}
+ $t2{t.27} = [$s0{this}+4]
+ if $t2{t.27} goto :null11
+ Error("null pointer")
+null11:
+ $t3{t.28} = [$t2{t.27}]
+ $t3{t.28} = Lt($s2{i} $t3{t.28})
+ if $t3{t.28} goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t3{t.28} = MulS($s2{i} 4)
+ $t3{t.28} = Add($t3{t.28} $t2{t.27})
+ $t2{t.29} = [$s0{this}+4]
+ if $t2{t.29} goto :null12
+ Error("null pointer")
+null12:
+ $t4{t.30} = [$t2{t.29}]
+ $t4{t.30} = Lt($s1{right} $t4{t.30})
+ if $t4{t.30} goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t4{t.30} = MulS($s1{right} 4)
+ $t4{t.30} = Add($t4{t.30} $t2{t.29})
+ $t4{t.31} = [$t4{t.30}+4]
+ [$t3{t.28}+4] = $t4{t.31}
+ $t4{t.32} = [$s0{this}+4]
+ if $t4{t.32} goto :null13
+ Error("null pointer")
+null13:
+ $t3{t.33} = [$t4{t.32}]
+ $t3{t.33} = Lt($s1{right} $t3{t.33})
+ if $t3{t.33} goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t3{t.33} = MulS($s1{right} 4)
+ $t3{t.33} = Add($t3{t.33} $t4{t.32})
+ [$t3{t.33}+4] = $t1{t}
+ $t3{t.34} = [$s0{this}]
+ $t3{t.34} = [$t3{t.34}+4]
+ $t1{t.35} = Sub($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t0{left}
+ $a2 = $t1{t.35}
+ call $t3{t.34}
+ $t1{t.36} = [$s0{this}]
+ $t1{t.36} = [$t1{t.36}+4]
+ $t3{t.37} = Add($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t3{t.37}
+ $a2 = $s1{right}
+ call $t1{t.36}
+ goto :if1_end
+if1_else:
+if1_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func QS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 0
+while4_top:
+ $t2{t.0} = [$t0{this}+8]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while4_end
+ $t2{t.2} = [$t0{this}+4]
+ if $t2{t.2} goto :null14
+ Error("null pointer")
+null14:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while4_top
+while4_end:
+ $v0 = 0
+ ret
+
+func QS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+8] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}+4] = $t0{t.0}
+ $t0{t.1} = [$s0{this}+4]
+ if $t0{t.1} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.2} = [$t0{t.1}]
+ $t1{t.2} = Lt(0 $t1{t.2})
+ if $t1{t.2} goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1{t.2} = MulS(0 4)
+ $t1{t.2} = Add($t1{t.2} $t0{t.1})
+ [$t1{t.2}+4] = 20
+ $t1{t.3} = [$s0{this}+4]
+ if $t1{t.3} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.4} = [$t1{t.3}]
+ $t0{t.4} = Lt(1 $t0{t.4})
+ if $t0{t.4} goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0{t.4} = MulS(1 4)
+ $t0{t.4} = Add($t0{t.4} $t1{t.3})
+ [$t0{t.4}+4] = 7
+ $t0{t.5} = [$s0{this}+4]
+ if $t0{t.5} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.6} = [$t0{t.5}]
+ $t1{t.6} = Lt(2 $t1{t.6})
+ if $t1{t.6} goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1{t.6} = MulS(2 4)
+ $t1{t.6} = Add($t1{t.6} $t0{t.5})
+ [$t1{t.6}+4] = 12
+ $t1{t.7} = [$s0{this}+4]
+ if $t1{t.7} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.8} = [$t1{t.7}]
+ $t0{t.8} = Lt(3 $t0{t.8})
+ if $t0{t.8} goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0{t.8} = MulS(3 4)
+ $t0{t.8} = Add($t0{t.8} $t1{t.7})
+ [$t0{t.8}+4] = 18
+ $t0{t.9} = [$s0{this}+4]
+ if $t0{t.9} goto :null19
+ Error("null pointer")
+null19:
+ $t1{t.10} = [$t0{t.9}]
+ $t1{t.10} = Lt(4 $t1{t.10})
+ if $t1{t.10} goto :bounds18
+ Error("array index out of bounds")
+bounds18:
+ $t1{t.10} = MulS(4 4)
+ $t1{t.10} = Add($t1{t.10} $t0{t.9})
+ [$t1{t.10}+4] = 2
+ $t1{t.11} = [$s0{this}+4]
+ if $t1{t.11} goto :null20
+ Error("null pointer")
+null20:
+ $t0{t.12} = [$t1{t.11}]
+ $t0{t.12} = Lt(5 $t0{t.12})
+ if $t0{t.12} goto :bounds19
+ Error("array index out of bounds")
+bounds19:
+ $t0{t.12} = MulS(5 4)
+ $t0{t.12} = Add($t0{t.12} $t1{t.11})
+ [$t0{t.12}+4] = 11
+ $t0{t.13} = [$s0{this}+4]
+ if $t0{t.13} goto :null21
+ Error("null pointer")
+null21:
+ $t1{t.14} = [$t0{t.13}]
+ $t1{t.14} = Lt(6 $t1{t.14})
+ if $t1{t.14} goto :bounds20
+ Error("array index out of bounds")
+bounds20:
+ $t1{t.14} = MulS(6 4)
+ $t1{t.14} = Add($t1{t.14} $t0{t.13})
+ [$t1{t.14}+4] = 6
+ $t1{t.15} = [$s0{this}+4]
+ if $t1{t.15} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.16} = [$t1{t.15}]
+ $t0{t.16} = Lt(7 $t0{t.16})
+ if $t0{t.16} goto :bounds21
+ Error("array index out of bounds")
+bounds21:
+ $t0{t.16} = MulS(7 4)
+ $t0{t.16} = Add($t0{t.16} $t1{t.15})
+ [$t0{t.16}+4] = 9
+ $t0{t.17} = [$s0{this}+4]
+ if $t0{t.17} goto :null23
+ Error("null pointer")
+null23:
+ $t1{t.18} = [$t0{t.17}]
+ $t1{t.18} = Lt(8 $t1{t.18})
+ if $t1{t.18} goto :bounds22
+ Error("array index out of bounds")
+bounds22:
+ $t1{t.18} = MulS(8 4)
+ $t1{t.18} = Add($t1{t.18} $t0{t.17})
+ [$t1{t.18}+4] = 19
+ $t1{t.19} = [$s0{this}+4]
+ if $t1{t.19} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.20} = [$t1{t.19}]
+ $t0{t.20} = Lt(9 $t0{t.20})
+ if $t0{t.20} goto :bounds23
+ Error("array index out of bounds")
+bounds23:
+ $t0{t.20} = MulS(9 4)
+ $t0{t.20} = Add($t0{t.20} $t1{t.19})
+ [$t0{t.20}+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/QuickSort.opt.names.vaporm b/vaporize/tests/QuickSort.opt.names.vaporm
new file mode 100644
index 0000000..9946042
--- /dev/null
+++ b/vaporize/tests/QuickSort.opt.names.vaporm
@@ -0,0 +1,418 @@
+const empty_QS
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(8)
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call :QS.Start
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ ret
+
+func QS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call :QS.Init
+ $a0 = $s0{this}
+ call :QS.Print
+ PrintIntS(9999)
+ $t0{t.0} = [$s0{this}+4]
+ $t0{aux01} = Sub($t0{t.0} 1)
+ $a0 = $s0{this}
+ $a1 = 0
+ $a2 = $t0{aux01}
+ call :QS.Sort
+ $a0 = $s0{this}
+ call :QS.Print
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func QS.Sort [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $t0{left} = $a1
+ $s1{right} = $a2
+ $t1{t} = 0
+ $t2{t.0} = LtS($t0{left} $s1{right})
+ if0 $t2{t.0} goto :if1_else
+ $t2{t.1} = [$s0{this}]
+ if $t2{t.1} goto :null2
+ Error("null pointer")
+null2:
+ $t3{t.2} = [$t2{t.1}]
+ $t3{t.2} = Lt($s1{right} $t3{t.2})
+ if $t3{t.2} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3{t.2} = MulS($s1{right} 4)
+ $t3{t.2} = Add($t3{t.2} $t2{t.1})
+ $t3{v} = [$t3{t.2}+4]
+ $s2{i} = Sub($t0{left} 1)
+ $t2{j} = $s1{right}
+ $t4{cont01} = 1
+while1_top:
+ if0 $t4{cont01} goto :while1_end
+ $t5{cont02} = 1
+while2_top:
+ if0 $t5{cont02} goto :while2_end
+ $s2{i} = Add($s2{i} 1)
+ $t6{t.3} = [$s0{this}]
+ if $t6{t.3} goto :null3
+ Error("null pointer")
+null3:
+ $t7{t.4} = [$t6{t.3}]
+ $t7{t.4} = Lt($s2{i} $t7{t.4})
+ if $t7{t.4} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t7{t.4} = MulS($s2{i} 4)
+ $t7{t.4} = Add($t7{t.4} $t6{t.3})
+ $t7{aux03} = [$t7{t.4}+4]
+ $t6{t.5} = LtS($t7{aux03} $t3{v})
+ if $t6{t.5} goto :if2_else
+ $t5{cont02} = 0
+ goto :if2_end
+if2_else:
+ $t5{cont02} = 1
+if2_end:
+ goto :while2_top
+while2_end:
+ $t5{cont02} = 1
+while3_top:
+ if0 $t5{cont02} goto :while3_end
+ $t2{j} = Sub($t2{j} 1)
+ $t6{t.6} = [$s0{this}]
+ if $t6{t.6} goto :null4
+ Error("null pointer")
+null4:
+ $t8{t.7} = [$t6{t.6}]
+ $t8{t.7} = Lt($t2{j} $t8{t.7})
+ if $t8{t.7} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t8{t.7} = MulS($t2{j} 4)
+ $t8{t.7} = Add($t8{t.7} $t6{t.6})
+ $t7{aux03} = [$t8{t.7}+4]
+ $t7{t.8} = LtS($t3{v} $t7{aux03})
+ if $t7{t.8} goto :if3_else
+ $t5{cont02} = 0
+ goto :if3_end
+if3_else:
+ $t5{cont02} = 1
+if3_end:
+ goto :while3_top
+while3_end:
+ $t5{t.9} = [$s0{this}]
+ if $t5{t.9} goto :null5
+ Error("null pointer")
+null5:
+ $t7{t.10} = [$t5{t.9}]
+ $t7{t.10} = Lt($s2{i} $t7{t.10})
+ if $t7{t.10} goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7{t.10} = MulS($s2{i} 4)
+ $t7{t.10} = Add($t7{t.10} $t5{t.9})
+ $t1{t} = [$t7{t.10}+4]
+ $t7{t.11} = [$s0{this}]
+ if $t7{t.11} goto :null6
+ Error("null pointer")
+null6:
+ $t5{t.12} = [$t7{t.11}]
+ $t5{t.12} = Lt($s2{i} $t5{t.12})
+ if $t5{t.12} goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t5{t.12} = MulS($s2{i} 4)
+ $t5{t.12} = Add($t5{t.12} $t7{t.11})
+ $t7{t.13} = [$s0{this}]
+ if $t7{t.13} goto :null7
+ Error("null pointer")
+null7:
+ $t8{t.14} = [$t7{t.13}]
+ $t8{t.14} = Lt($t2{j} $t8{t.14})
+ if $t8{t.14} goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t8{t.14} = MulS($t2{j} 4)
+ $t8{t.14} = Add($t8{t.14} $t7{t.13})
+ $t8{t.15} = [$t8{t.14}+4]
+ [$t5{t.12}+4] = $t8{t.15}
+ $t8{t.16} = [$s0{this}]
+ if $t8{t.16} goto :null8
+ Error("null pointer")
+null8:
+ $t5{t.17} = [$t8{t.16}]
+ $t5{t.17} = Lt($t2{j} $t5{t.17})
+ if $t5{t.17} goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t5{t.17} = MulS($t2{j} 4)
+ $t5{t.17} = Add($t5{t.17} $t8{t.16})
+ [$t5{t.17}+4] = $t1{t}
+ $t5{t.18} = Add($s2{i} 1)
+ $t5{t.19} = LtS($t2{j} $t5{t.18})
+ if0 $t5{t.19} goto :if4_else
+ $t4{cont01} = 0
+ goto :if4_end
+if4_else:
+ $t4{cont01} = 1
+if4_end:
+ goto :while1_top
+while1_end:
+ $t4{t.20} = [$s0{this}]
+ if $t4{t.20} goto :null9
+ Error("null pointer")
+null9:
+ $t3{t.21} = [$t4{t.20}]
+ $t3{t.21} = Lt($t2{j} $t3{t.21})
+ if $t3{t.21} goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t3{t.21} = MulS($t2{j} 4)
+ $t3{t.21} = Add($t3{t.21} $t4{t.20})
+ $t4{t.22} = [$s0{this}]
+ if $t4{t.22} goto :null10
+ Error("null pointer")
+null10:
+ $t2{t.23} = [$t4{t.22}]
+ $t2{t.23} = Lt($s2{i} $t2{t.23})
+ if $t2{t.23} goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t2{t.23} = MulS($s2{i} 4)
+ $t2{t.23} = Add($t2{t.23} $t4{t.22})
+ $t2{t.24} = [$t2{t.23}+4]
+ [$t3{t.21}+4] = $t2{t.24}
+ $t2{t.25} = [$s0{this}]
+ if $t2{t.25} goto :null11
+ Error("null pointer")
+null11:
+ $t3{t.26} = [$t2{t.25}]
+ $t3{t.26} = Lt($s2{i} $t3{t.26})
+ if $t3{t.26} goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t3{t.26} = MulS($s2{i} 4)
+ $t3{t.26} = Add($t3{t.26} $t2{t.25})
+ $t2{t.27} = [$s0{this}]
+ if $t2{t.27} goto :null12
+ Error("null pointer")
+null12:
+ $t4{t.28} = [$t2{t.27}]
+ $t4{t.28} = Lt($s1{right} $t4{t.28})
+ if $t4{t.28} goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t4{t.28} = MulS($s1{right} 4)
+ $t4{t.28} = Add($t4{t.28} $t2{t.27})
+ $t4{t.29} = [$t4{t.28}+4]
+ [$t3{t.26}+4] = $t4{t.29}
+ $t4{t.30} = [$s0{this}]
+ if $t4{t.30} goto :null13
+ Error("null pointer")
+null13:
+ $t3{t.31} = [$t4{t.30}]
+ $t3{t.31} = Lt($s1{right} $t3{t.31})
+ if $t3{t.31} goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t3{t.31} = MulS($s1{right} 4)
+ $t3{t.31} = Add($t3{t.31} $t4{t.30})
+ [$t3{t.31}+4] = $t1{t}
+ $t3{t.32} = Sub($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t0{left}
+ $a2 = $t3{t.32}
+ call :QS.Sort
+ $t3{t.33} = Add($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t3{t.33}
+ $a2 = $s1{right}
+ call :QS.Sort
+ goto :if1_end
+if1_else:
+if1_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func QS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 0
+while4_top:
+ $t2{t.0} = [$t0{this}+4]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while4_end
+ $t2{t.2} = [$t0{this}]
+ if $t2{t.2} goto :null14
+ Error("null pointer")
+null14:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while4_top
+while4_end:
+ $v0 = 0
+ ret
+
+func QS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+4] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}] = $t0{t.0}
+ $t0{t.1} = [$s0{this}]
+ if $t0{t.1} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.2} = [$t0{t.1}]
+ $t1{t.2} = Lt(0 $t1{t.2})
+ if $t1{t.2} goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1{t.2} = MulS(0 4)
+ $t1{t.2} = Add($t1{t.2} $t0{t.1})
+ [$t1{t.2}+4] = 20
+ $t1{t.3} = [$s0{this}]
+ if $t1{t.3} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.4} = [$t1{t.3}]
+ $t0{t.4} = Lt(1 $t0{t.4})
+ if $t0{t.4} goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0{t.4} = MulS(1 4)
+ $t0{t.4} = Add($t0{t.4} $t1{t.3})
+ [$t0{t.4}+4] = 7
+ $t0{t.5} = [$s0{this}]
+ if $t0{t.5} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.6} = [$t0{t.5}]
+ $t1{t.6} = Lt(2 $t1{t.6})
+ if $t1{t.6} goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1{t.6} = MulS(2 4)
+ $t1{t.6} = Add($t1{t.6} $t0{t.5})
+ [$t1{t.6}+4] = 12
+ $t1{t.7} = [$s0{this}]
+ if $t1{t.7} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.8} = [$t1{t.7}]
+ $t0{t.8} = Lt(3 $t0{t.8})
+ if $t0{t.8} goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0{t.8} = MulS(3 4)
+ $t0{t.8} = Add($t0{t.8} $t1{t.7})
+ [$t0{t.8}+4] = 18
+ $t0{t.9} = [$s0{this}]
+ if $t0{t.9} goto :null19
+ Error("null pointer")
+null19:
+ $t1{t.10} = [$t0{t.9}]
+ $t1{t.10} = Lt(4 $t1{t.10})
+ if $t1{t.10} goto :bounds18
+ Error("array index out of bounds")
+bounds18:
+ $t1{t.10} = MulS(4 4)
+ $t1{t.10} = Add($t1{t.10} $t0{t.9})
+ [$t1{t.10}+4] = 2
+ $t1{t.11} = [$s0{this}]
+ if $t1{t.11} goto :null20
+ Error("null pointer")
+null20:
+ $t0{t.12} = [$t1{t.11}]
+ $t0{t.12} = Lt(5 $t0{t.12})
+ if $t0{t.12} goto :bounds19
+ Error("array index out of bounds")
+bounds19:
+ $t0{t.12} = MulS(5 4)
+ $t0{t.12} = Add($t0{t.12} $t1{t.11})
+ [$t0{t.12}+4] = 11
+ $t0{t.13} = [$s0{this}]
+ if $t0{t.13} goto :null21
+ Error("null pointer")
+null21:
+ $t1{t.14} = [$t0{t.13}]
+ $t1{t.14} = Lt(6 $t1{t.14})
+ if $t1{t.14} goto :bounds20
+ Error("array index out of bounds")
+bounds20:
+ $t1{t.14} = MulS(6 4)
+ $t1{t.14} = Add($t1{t.14} $t0{t.13})
+ [$t1{t.14}+4] = 6
+ $t1{t.15} = [$s0{this}]
+ if $t1{t.15} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.16} = [$t1{t.15}]
+ $t0{t.16} = Lt(7 $t0{t.16})
+ if $t0{t.16} goto :bounds21
+ Error("array index out of bounds")
+bounds21:
+ $t0{t.16} = MulS(7 4)
+ $t0{t.16} = Add($t0{t.16} $t1{t.15})
+ [$t0{t.16}+4] = 9
+ $t0{t.17} = [$s0{this}]
+ if $t0{t.17} goto :null23
+ Error("null pointer")
+null23:
+ $t1{t.18} = [$t0{t.17}]
+ $t1{t.18} = Lt(8 $t1{t.18})
+ if $t1{t.18} goto :bounds22
+ Error("array index out of bounds")
+bounds22:
+ $t1{t.18} = MulS(8 4)
+ $t1{t.18} = Add($t1{t.18} $t0{t.17})
+ [$t1{t.18}+4] = 19
+ $t1{t.19} = [$s0{this}]
+ if $t1{t.19} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.20} = [$t1{t.19}]
+ $t0{t.20} = Lt(9 $t0{t.20})
+ if $t0{t.20} goto :bounds23
+ Error("array index out of bounds")
+bounds23:
+ $t0{t.20} = MulS(9 4)
+ $t0{t.20} = Add($t0{t.20} $t1{t.19})
+ [$t0{t.20}+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+
diff --git a/vaporize/tests/QuickSort.opt.regalloc b/vaporize/tests/QuickSort.opt.regalloc
new file mode 100644
index 0000000..cb7fb8c
--- /dev/null
+++ b/vaporize/tests/QuickSort.opt.regalloc
@@ -0,0 +1,286 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 7 10
+ t.1: 11
+Linear Range:
+ t.0: 6-10
+ t.1: 10-11
+Allocation:
+ t.0: t0
+ t.1: t0
+
+func QS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 15-21
+ sz: 15
+ aux01: 20
+ t.0: 19
+Linear Range:
+ this: 14-21 (cross call)
+ sz: 14-15
+ aux01: 19-20
+ t.0: 18-19
+Allocation:
+ this: s0
+ sz: t0
+ aux01: t0
+ t.0: t0
+
+func QS.Sort
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 25-29 32-34 37-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162-165 168-170 173-178 181-183 186-189 192-194 197-202 205-207 210-216
+ left: 25-29 32-34 37-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162-165 168-170 173-178 181-183 186-189 192-194 197-202 205-207 210-214
+ right: 25-29 32-34 37-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162-165 168-170 173-178 181-183 186-189 192-194 197-202 205-207 210-216
+ t: 26-29 32-34 37-44 107-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162-165 168-170 173-178 181-183 186-189 192-194 197-202 205-207 210-212
+ t.0: 27
+ t.1: 29 32-34 37-38
+ t.2: 33-34 38-39
+ v: 40-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-151
+ i: 41-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162-165 168-170 173-178 181-183 186-189 192-194 197-202 205-207 210-215
+ j: 42-50 53-55 58-75 78-80 83-96 99-101 104-108 111-113 116-119 122-124 127-132 135-137 140-154 157-159 162
+ cont01: 44 147 151
+ cont02: 47 64 68 72 89 93
+ t.3: 50 53-55 58-59
+ t.4: 54-55 59-60
+ aux03: 61 86
+ t.5: 62
+ t.6: 75 78-80 83-84
+ t.7: 79-80 84-85
+ t.8: 87
+ t.9: 96 99-101 104-105
+ t.10: 100-101 105-106
+ t.11: 108 111-113 116-117
+ t.12: 112-113 117-119 122-124 127-130
+ t.13: 119 122-124 127-128
+ t.14: 123-124 128-129
+ t.15: 130
+ t.16: 132 135-137 140-141
+ t.17: 136-137 141-142
+ t.18: 144
+ t.19: 145
+ t.20: 154 157-159 162-163
+ t.21: 158-159 163-165 168-170 173-176
+ t.22: 165 168-170 173-174
+ t.23: 169-170 174-175
+ t.24: 176
+ t.25: 178 181-183 186-187
+ t.26: 182-183 187-189 192-194 197-200
+ t.27: 189 192-194 197-198
+ t.28: 193-194 198-199
+ t.29: 200
+ t.30: 202 205-207 210-211
+ t.31: 206-207 211-212
+ t.32: 214
+ nt:
+ t.33: 216
+Linear Range:
+ this: 24-216 (cross call)
+ left: 24-214
+ right: 24-216 (cross call)
+ t: 25-212
+ t.0: 26-27
+ t.1: 28-38
+ t.2: 32-39
+ v: 39-151
+ i: 40-215 (cross call)
+ j: 41-162
+ cont01: 42-151
+ cont02: 45-93
+ t.3: 49-59
+ t.4: 53-60
+ aux03: 60-86
+ t.5: 61-62
+ t.6: 74-84
+ t.7: 78-85
+ t.8: 86-87
+ t.9: 95-105
+ t.10: 99-106
+ t.11: 107-117
+ t.12: 111-130
+ t.13: 118-128
+ t.14: 122-129
+ t.15: 129-130
+ t.16: 131-141
+ t.17: 135-142
+ t.18: 143-144
+ t.19: 144-145
+ t.20: 153-163
+ t.21: 157-176
+ t.22: 164-174
+ t.23: 168-175
+ t.24: 175-176
+ t.25: 177-187
+ t.26: 181-200
+ t.27: 188-198
+ t.28: 192-199
+ t.29: 199-200
+ t.30: 201-211
+ t.31: 205-212
+ t.32: 213-214
+ t.33: 215-216
+Allocation:
+ this: s0
+ left: t0
+ right: s1
+ t: t1
+ t.0: t2
+ t.1: t2
+ t.2: t3
+ v: t3
+ i: s2
+ j: t2
+ cont01: t4
+ cont02: t5
+ t.3: t6
+ t.4: t7
+ aux03: t7
+ t.5: t6
+ t.6: t6
+ t.7: t8
+ t.8: t7
+ t.9: t5
+ t.10: t7
+ t.11: t7
+ t.12: t5
+ t.13: t7
+ t.14: t8
+ t.15: t8
+ t.16: t8
+ t.17: t5
+ t.18: t5
+ t.19: t5
+ t.20: t4
+ t.21: t3
+ t.22: t4
+ t.23: t2
+ t.24: t2
+ t.25: t2
+ t.26: t3
+ t.27: t2
+ t.28: t4
+ t.29: t4
+ t.30: t4
+ t.31: t3
+ t.32: t3
+ t.33: t3
+
+func QS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 224-230 233-235 238-243
+ j: 226-230 233-235 238-243
+ t.0: 227
+ t.1: 228
+ t.2: 230 233-235 238-239
+ t.3: 234-235 239-240
+ t.4: 241
+Linear Range:
+ this: 223-243
+ j: 224-243
+ t.0: 226-227
+ t.1: 227-228
+ t.2: 229-239
+ t.3: 233-240
+ t.4: 240-241
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func QS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 248-252 255-257 260-264 267-269 272-276 279-281 284-288 291-293 296-300 303-305 308-312 315-317 320-324 327-329 332-336 339-341 344-348 351-353 356-359
+ sz: 248-249
+ t.0: 250
+ t.1: 252 255-257 260-261
+ t.2: 256-257 261-262
+ t.3: 264 267-269 272-273
+ t.4: 268-269 273-274
+ t.5: 276 279-281 284-285
+ t.6: 280-281 285-286
+ t.7: 288 291-293 296-297
+ t.8: 292-293 297-298
+ t.9: 300 303-305 308-309
+ t.10: 304-305 309-310
+ t.11: 312 315-317 320-321
+ t.12: 316-317 321-322
+ t.13: 324 327-329 332-333
+ t.14: 328-329 333-334
+ t.15: 336 339-341 344-345
+ t.16: 340-341 345-346
+ t.17: 348 351-353 356-357
+ t.18: 352-353 357-358
+ t.19: 360 363-365 368-369
+ t.20: 364-365 369-370
+Linear Range:
+ this: 247-359 (cross call)
+ sz: 247-249
+ t.0: 249-250
+ t.1: 251-261
+ t.2: 255-262
+ t.3: 263-273
+ t.4: 267-274
+ t.5: 275-285
+ t.6: 279-286
+ t.7: 287-297
+ t.8: 291-298
+ t.9: 299-309
+ t.10: 303-310
+ t.11: 311-321
+ t.12: 315-322
+ t.13: 323-333
+ t.14: 327-334
+ t.15: 335-345
+ t.16: 339-346
+ t.17: 347-357
+ t.18: 351-358
+ t.19: 359-369
+ t.20: 363-370
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ t.1: t0
+ t.2: t1
+ t.3: t1
+ t.4: t0
+ t.5: t0
+ t.6: t1
+ t.7: t1
+ t.8: t0
+ t.9: t0
+ t.10: t1
+ t.11: t1
+ t.12: t0
+ t.13: t0
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+ t.18: t1
+ t.19: t1
+ t.20: t0
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 374-377
+ bytes: 375-376
+ v: 377-378
+Linear Range:
+ size: 373-377
+ bytes: 374-376
+ v: 376-378
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/QuickSort.opt.vaporm b/vaporize/tests/QuickSort.opt.vaporm
new file mode 100644
index 0000000..61f1151
--- /dev/null
+++ b/vaporize/tests/QuickSort.opt.vaporm
@@ -0,0 +1,418 @@
+const empty_QS
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(8)
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $t0
+ $a1 = 10
+ call :QS.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func QS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $a0 = $s0
+ $a1 = $t0
+ call :QS.Init
+ $a0 = $s0
+ call :QS.Print
+ PrintIntS(9999)
+ $t0 = [$s0+4]
+ $t0 = Sub($t0 1)
+ $a0 = $s0
+ $a1 = 0
+ $a2 = $t0
+ call :QS.Sort
+ $a0 = $s0
+ call :QS.Print
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func QS.Sort [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $t0 = $a1
+ $s1 = $a2
+ $t1 = 0
+ $t2 = LtS($t0 $s1)
+ if0 $t2 goto :if1_else
+ $t2 = [$s0]
+ if $t2 goto :null2
+ Error("null pointer")
+null2:
+ $t3 = [$t2]
+ $t3 = Lt($s1 $t3)
+ if $t3 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3 = MulS($s1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ $s2 = Sub($t0 1)
+ $t2 = $s1
+ $t4 = 1
+while1_top:
+ if0 $t4 goto :while1_end
+ $t5 = 1
+while2_top:
+ if0 $t5 goto :while2_end
+ $s2 = Add($s2 1)
+ $t6 = [$s0]
+ if $t6 goto :null3
+ Error("null pointer")
+null3:
+ $t7 = [$t6]
+ $t7 = Lt($s2 $t7)
+ if $t7 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t7 = MulS($s2 4)
+ $t7 = Add($t7 $t6)
+ $t7 = [$t7+4]
+ $t6 = LtS($t7 $t3)
+ if $t6 goto :if2_else
+ $t5 = 0
+ goto :if2_end
+if2_else:
+ $t5 = 1
+if2_end:
+ goto :while2_top
+while2_end:
+ $t5 = 1
+while3_top:
+ if0 $t5 goto :while3_end
+ $t2 = Sub($t2 1)
+ $t6 = [$s0]
+ if $t6 goto :null4
+ Error("null pointer")
+null4:
+ $t8 = [$t6]
+ $t8 = Lt($t2 $t8)
+ if $t8 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t8 = MulS($t2 4)
+ $t8 = Add($t8 $t6)
+ $t7 = [$t8+4]
+ $t7 = LtS($t3 $t7)
+ if $t7 goto :if3_else
+ $t5 = 0
+ goto :if3_end
+if3_else:
+ $t5 = 1
+if3_end:
+ goto :while3_top
+while3_end:
+ $t5 = [$s0]
+ if $t5 goto :null5
+ Error("null pointer")
+null5:
+ $t7 = [$t5]
+ $t7 = Lt($s2 $t7)
+ if $t7 goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7 = MulS($s2 4)
+ $t7 = Add($t7 $t5)
+ $t1 = [$t7+4]
+ $t7 = [$s0]
+ if $t7 goto :null6
+ Error("null pointer")
+null6:
+ $t5 = [$t7]
+ $t5 = Lt($s2 $t5)
+ if $t5 goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t5 = MulS($s2 4)
+ $t5 = Add($t5 $t7)
+ $t7 = [$s0]
+ if $t7 goto :null7
+ Error("null pointer")
+null7:
+ $t8 = [$t7]
+ $t8 = Lt($t2 $t8)
+ if $t8 goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t8 = MulS($t2 4)
+ $t8 = Add($t8 $t7)
+ $t8 = [$t8+4]
+ [$t5+4] = $t8
+ $t8 = [$s0]
+ if $t8 goto :null8
+ Error("null pointer")
+null8:
+ $t5 = [$t8]
+ $t5 = Lt($t2 $t5)
+ if $t5 goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t5 = MulS($t2 4)
+ $t5 = Add($t5 $t8)
+ [$t5+4] = $t1
+ $t5 = Add($s2 1)
+ $t5 = LtS($t2 $t5)
+ if0 $t5 goto :if4_else
+ $t4 = 0
+ goto :if4_end
+if4_else:
+ $t4 = 1
+if4_end:
+ goto :while1_top
+while1_end:
+ $t4 = [$s0]
+ if $t4 goto :null9
+ Error("null pointer")
+null9:
+ $t3 = [$t4]
+ $t3 = Lt($t2 $t3)
+ if $t3 goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t3 = MulS($t2 4)
+ $t3 = Add($t3 $t4)
+ $t4 = [$s0]
+ if $t4 goto :null10
+ Error("null pointer")
+null10:
+ $t2 = [$t4]
+ $t2 = Lt($s2 $t2)
+ if $t2 goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t2 = MulS($s2 4)
+ $t2 = Add($t2 $t4)
+ $t2 = [$t2+4]
+ [$t3+4] = $t2
+ $t2 = [$s0]
+ if $t2 goto :null11
+ Error("null pointer")
+null11:
+ $t3 = [$t2]
+ $t3 = Lt($s2 $t3)
+ if $t3 goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t3 = MulS($s2 4)
+ $t3 = Add($t3 $t2)
+ $t2 = [$s0]
+ if $t2 goto :null12
+ Error("null pointer")
+null12:
+ $t4 = [$t2]
+ $t4 = Lt($s1 $t4)
+ if $t4 goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t4 = MulS($s1 4)
+ $t4 = Add($t4 $t2)
+ $t4 = [$t4+4]
+ [$t3+4] = $t4
+ $t4 = [$s0]
+ if $t4 goto :null13
+ Error("null pointer")
+null13:
+ $t3 = [$t4]
+ $t3 = Lt($s1 $t3)
+ if $t3 goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t3 = MulS($s1 4)
+ $t3 = Add($t3 $t4)
+ [$t3+4] = $t1
+ $t3 = Sub($s2 1)
+ $a0 = $s0
+ $a1 = $t0
+ $a2 = $t3
+ call :QS.Sort
+ $t3 = Add($s2 1)
+ $a0 = $s0
+ $a1 = $t3
+ $a2 = $s1
+ call :QS.Sort
+ goto :if1_end
+if1_else:
+if1_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func QS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 0
+while4_top:
+ $t2 = [$t0+4]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while4_end
+ $t2 = [$t0]
+ if $t2 goto :null14
+ Error("null pointer")
+null14:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while4_top
+while4_end:
+ $v0 = 0
+ ret
+
+func QS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+4] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0] = $t0
+ $t0 = [$s0]
+ if $t0 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$t0]
+ $t1 = Lt(0 $t1)
+ if $t1 goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1 = MulS(0 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 20
+ $t1 = [$s0]
+ if $t1 goto :null16
+ Error("null pointer")
+null16:
+ $t0 = [$t1]
+ $t0 = Lt(1 $t0)
+ if $t0 goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0 = MulS(1 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 7
+ $t0 = [$s0]
+ if $t0 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$t0]
+ $t1 = Lt(2 $t1)
+ if $t1 goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1 = MulS(2 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 12
+ $t1 = [$s0]
+ if $t1 goto :null18
+ Error("null pointer")
+null18:
+ $t0 = [$t1]
+ $t0 = Lt(3 $t0)
+ if $t0 goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0 = MulS(3 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 18
+ $t0 = [$s0]
+ if $t0 goto :null19
+ Error("null pointer")
+null19:
+ $t1 = [$t0]
+ $t1 = Lt(4 $t1)
+ if $t1 goto :bounds18
+ Error("array index out of bounds")
+bounds18:
+ $t1 = MulS(4 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 2
+ $t1 = [$s0]
+ if $t1 goto :null20
+ Error("null pointer")
+null20:
+ $t0 = [$t1]
+ $t0 = Lt(5 $t0)
+ if $t0 goto :bounds19
+ Error("array index out of bounds")
+bounds19:
+ $t0 = MulS(5 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 11
+ $t0 = [$s0]
+ if $t0 goto :null21
+ Error("null pointer")
+null21:
+ $t1 = [$t0]
+ $t1 = Lt(6 $t1)
+ if $t1 goto :bounds20
+ Error("array index out of bounds")
+bounds20:
+ $t1 = MulS(6 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 6
+ $t1 = [$s0]
+ if $t1 goto :null22
+ Error("null pointer")
+null22:
+ $t0 = [$t1]
+ $t0 = Lt(7 $t0)
+ if $t0 goto :bounds21
+ Error("array index out of bounds")
+bounds21:
+ $t0 = MulS(7 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 9
+ $t0 = [$s0]
+ if $t0 goto :null23
+ Error("null pointer")
+null23:
+ $t1 = [$t0]
+ $t1 = Lt(8 $t1)
+ if $t1 goto :bounds22
+ Error("array index out of bounds")
+bounds22:
+ $t1 = MulS(8 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 19
+ $t1 = [$s0]
+ if $t1 goto :null24
+ Error("null pointer")
+null24:
+ $t0 = [$t1]
+ $t0 = Lt(9 $t0)
+ if $t0 goto :bounds23
+ Error("array index out of bounds")
+bounds23:
+ $t0 = MulS(9 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/QuickSort.regalloc b/vaporize/tests/QuickSort.regalloc
new file mode 100644
index 0000000..02b4418
--- /dev/null
+++ b/vaporize/tests/QuickSort.regalloc
@@ -0,0 +1,313 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 11-12 15-17
+ t.1: 16-17
+ t.2: 18
+Linear Range:
+ t.0: 10-17
+ t.1: 15-17
+ t.2: 17-18
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func QS.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 22-36
+ sz: 22-24
+ t.0: 23-24
+ aux01: 31-33
+ t.1: 26-27
+ t.2: 30
+ t.3: 32-33
+ t.4: 35-36
+Linear Range:
+ this: 21-36 (cross call)
+ sz: 21-24
+ t.0: 22-24
+ aux01: 30-33
+ t.1: 25-27
+ t.2: 29-30
+ t.3: 31-33
+ t.4: 34-36
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t1
+ aux01: t1
+ t.1: t1
+ t.2: t1
+ t.3: t0
+ t.4: t0
+
+func QS.Sort
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 40-44 47-49 52-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179-182 185-187 190-195 198-200 203-206 209-211 214-219 222-224 227-237
+ left: 40-44 47-49 52-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179-182 185-187 190-195 198-200 203-206 209-211 214-219 222-224 227-233
+ right: 40-44 47-49 52-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179-182 185-187 190-195 198-200 203-206 209-211 214-219 222-224 227-237
+ t: 41-44 47-49 52-59 124-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179-182 185-187 190-195 198-200 203-206 209-211 214-219 222-224 227-229
+ t.0: 42
+ t.1: 44 47-49 52-53
+ t.2: 48-49 53-54
+ v: 55-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-168
+ i: 56-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179-182 185-187 190-195 198-200 203-206 209-211 214-219 222-224 227-236
+ j: 57-65 68-70 73-91 94-96 99-113 116-118 121-125 128-130 133-136 139-141 144-149 152-154 157-171 174-176 179
+ cont01: 59 164 168
+ cont02: 62 80 84 88 106 110
+ t.3: 65 68-70 73-74
+ t.4: 69-70 74-75
+ aux03: 76 102
+ t.5: 77
+ t.6: 78
+ t.7: 91 94-96 99-100
+ t.8: 95-96 100-101
+ t.9: 103
+ t.10: 104
+ t.11: 113 116-118 121-122
+ t.12: 117-118 122-123
+ t.13: 125 128-130 133-134
+ t.14: 129-130 134-136 139-141 144-147
+ t.15: 136 139-141 144-145
+ t.16: 140-141 145-146
+ t.17: 147
+ t.18: 149 152-154 157-158
+ t.19: 153-154 158-159
+ t.20: 161
+ t.21: 162
+ t.22: 171 174-176 179-180
+ t.23: 175-176 180-182 185-187 190-193
+ t.24: 182 185-187 190-191
+ t.25: 186-187 191-192
+ t.26: 193
+ t.27: 195 198-200 203-204
+ t.28: 199-200 204-206 209-211 214-217
+ t.29: 206 209-211 214-215
+ t.30: 210-211 215-216
+ t.31: 217
+ t.32: 219 222-224 227-228
+ t.33: 223-224 228-229
+ t.34: 231-233
+ t.35: 233
+ nt:
+ t.36: 235-237
+ t.37: 237
+Linear Range:
+ this: 39-237 (cross call)
+ left: 39-233
+ right: 39-237 (cross call)
+ t: 40-229
+ t.0: 41-42
+ t.1: 43-53
+ t.2: 47-54
+ v: 54-168
+ i: 55-236 (cross call)
+ j: 56-179
+ cont01: 57-168
+ cont02: 60-110
+ t.3: 64-74
+ t.4: 68-75
+ aux03: 75-102
+ t.5: 76-77
+ t.6: 77-78
+ t.7: 90-100
+ t.8: 94-101
+ t.9: 102-103
+ t.10: 103-104
+ t.11: 112-122
+ t.12: 116-123
+ t.13: 124-134
+ t.14: 128-147
+ t.15: 135-145
+ t.16: 139-146
+ t.17: 146-147
+ t.18: 148-158
+ t.19: 152-159
+ t.20: 160-161
+ t.21: 161-162
+ t.22: 170-180
+ t.23: 174-193
+ t.24: 181-191
+ t.25: 185-192
+ t.26: 192-193
+ t.27: 194-204
+ t.28: 198-217
+ t.29: 205-215
+ t.30: 209-216
+ t.31: 216-217
+ t.32: 218-228
+ t.33: 222-229
+ t.34: 230-233
+ t.35: 232-233
+ t.36: 234-237
+ t.37: 236-237
+Allocation:
+ this: s0
+ left: t0
+ right: s1
+ t: t1
+ t.0: t2
+ t.1: t2
+ t.2: t3
+ v: t3
+ i: s2
+ j: t2
+ cont01: t4
+ cont02: t5
+ t.3: t6
+ t.4: t7
+ aux03: t7
+ t.5: t6
+ t.6: t6
+ t.7: t6
+ t.8: t8
+ t.9: t7
+ t.10: t7
+ t.11: t5
+ t.12: t7
+ t.13: t7
+ t.14: t5
+ t.15: t7
+ t.16: t8
+ t.17: t8
+ t.18: t8
+ t.19: t5
+ t.20: t5
+ t.21: t5
+ t.22: t4
+ t.23: t3
+ t.24: t4
+ t.25: t2
+ t.26: t2
+ t.27: t2
+ t.28: t3
+ t.29: t2
+ t.30: t4
+ t.31: t4
+ t.32: t4
+ t.33: t3
+ t.34: t3
+ t.35: t1
+ t.36: t1
+ t.37: t3
+
+func QS.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 245-251 254-256 259-264
+ j: 247-251 254-256 259-264
+ t.0: 248
+ t.1: 249
+ t.2: 251 254-256 259-260
+ t.3: 255-256 260-261
+ t.4: 262
+Linear Range:
+ this: 244-264
+ j: 245-264
+ t.0: 247-248
+ t.1: 248-249
+ t.2: 250-260
+ t.3: 254-261
+ t.4: 261-262
+Allocation:
+ this: t0
+ j: t1
+ t.0: t2
+ t.1: t2
+ t.2: t2
+ t.3: t3
+ t.4: t3
+
+func QS.Init
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this: 269-273 276-278 281-285 288-290 293-297 300-302 305-309 312-314 317-321 324-326 329-333 336-338 341-345 348-350 353-357 360-362 365-369 372-374 377-380
+ sz: 269-270
+ t.0: 271
+ t.1: 273 276-278 281-282
+ t.2: 277-278 282-283
+ t.3: 285 288-290 293-294
+ t.4: 289-290 294-295
+ t.5: 297 300-302 305-306
+ t.6: 301-302 306-307
+ t.7: 309 312-314 317-318
+ t.8: 313-314 318-319
+ t.9: 321 324-326 329-330
+ t.10: 325-326 330-331
+ t.11: 333 336-338 341-342
+ t.12: 337-338 342-343
+ t.13: 345 348-350 353-354
+ t.14: 349-350 354-355
+ t.15: 357 360-362 365-366
+ t.16: 361-362 366-367
+ t.17: 369 372-374 377-378
+ t.18: 373-374 378-379
+ t.19: 381 384-386 389-390
+ t.20: 385-386 390-391
+Linear Range:
+ this: 268-380 (cross call)
+ sz: 268-270
+ t.0: 270-271
+ t.1: 272-282
+ t.2: 276-283
+ t.3: 284-294
+ t.4: 288-295
+ t.5: 296-306
+ t.6: 300-307
+ t.7: 308-318
+ t.8: 312-319
+ t.9: 320-330
+ t.10: 324-331
+ t.11: 332-342
+ t.12: 336-343
+ t.13: 344-354
+ t.14: 348-355
+ t.15: 356-366
+ t.16: 360-367
+ t.17: 368-378
+ t.18: 372-379
+ t.19: 380-390
+ t.20: 384-391
+Allocation:
+ this: s0
+ sz: t0
+ t.0: t0
+ t.1: t0
+ t.2: t1
+ t.3: t1
+ t.4: t0
+ t.5: t0
+ t.6: t1
+ t.7: t1
+ t.8: t0
+ t.9: t0
+ t.10: t1
+ t.11: t1
+ t.12: t0
+ t.13: t0
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+ t.18: t1
+ t.19: t1
+ t.20: t0
+
+func AllocArray
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ size: 395-398
+ bytes: 396-397
+ v: 398-399
+Linear Range:
+ size: 394-398
+ bytes: 395-397
+ v: 397-399
+Allocation:
+ size: t0
+ bytes: t1
+ v: t1
+
diff --git a/vaporize/tests/QuickSort.vaporm b/vaporize/tests/QuickSort.vaporm
new file mode 100644
index 0000000..2aaa582
--- /dev/null
+++ b/vaporize/tests/QuickSort.vaporm
@@ -0,0 +1,439 @@
+const vmt_QS
+ :QS.Start
+ :QS.Sort
+ :QS.Print
+ :QS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(12)
+ [$t0] = :vmt_QS
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ $a1 = 10
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func QS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ $t1 = [$s0]
+ $t1 = [$t1+12]
+ $a0 = $s0
+ $a1 = $t0
+ call $t1
+ $t1 = [$s0]
+ $t1 = [$t1+8]
+ $a0 = $s0
+ call $t1
+ PrintIntS(9999)
+ $t1 = [$s0+8]
+ $t1 = Sub($t1 1)
+ $t0 = [$s0]
+ $t0 = [$t0+4]
+ $a0 = $s0
+ $a1 = 0
+ $a2 = $t1
+ call $t0
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ call $t0
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func QS.Sort [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $t0 = $a1
+ $s1 = $a2
+ $t1 = 0
+ $t2 = LtS($t0 $s1)
+ if0 $t2 goto :if1_else
+ $t2 = [$s0+4]
+ if $t2 goto :null2
+ Error("null pointer")
+null2:
+ $t3 = [$t2]
+ $t3 = Lt($s1 $t3)
+ if $t3 goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3 = MulS($s1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ $s2 = Sub($t0 1)
+ $t2 = $s1
+ $t4 = 1
+while1_top:
+ if0 $t4 goto :while1_end
+ $t5 = 1
+while2_top:
+ if0 $t5 goto :while2_end
+ $s2 = Add($s2 1)
+ $t6 = [$s0+4]
+ if $t6 goto :null3
+ Error("null pointer")
+null3:
+ $t7 = [$t6]
+ $t7 = Lt($s2 $t7)
+ if $t7 goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t7 = MulS($s2 4)
+ $t7 = Add($t7 $t6)
+ $t7 = [$t7+4]
+ $t6 = LtS($t7 $t3)
+ $t6 = Sub(1 $t6)
+ if0 $t6 goto :if2_else
+ $t5 = 0
+ goto :if2_end
+if2_else:
+ $t5 = 1
+if2_end:
+ goto :while2_top
+while2_end:
+ $t5 = 1
+while3_top:
+ if0 $t5 goto :while3_end
+ $t2 = Sub($t2 1)
+ $t6 = [$s0+4]
+ if $t6 goto :null4
+ Error("null pointer")
+null4:
+ $t8 = [$t6]
+ $t8 = Lt($t2 $t8)
+ if $t8 goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t8 = MulS($t2 4)
+ $t8 = Add($t8 $t6)
+ $t7 = [$t8+4]
+ $t7 = LtS($t3 $t7)
+ $t7 = Sub(1 $t7)
+ if0 $t7 goto :if3_else
+ $t5 = 0
+ goto :if3_end
+if3_else:
+ $t5 = 1
+if3_end:
+ goto :while3_top
+while3_end:
+ $t5 = [$s0+4]
+ if $t5 goto :null5
+ Error("null pointer")
+null5:
+ $t7 = [$t5]
+ $t7 = Lt($s2 $t7)
+ if $t7 goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7 = MulS($s2 4)
+ $t7 = Add($t7 $t5)
+ $t1 = [$t7+4]
+ $t7 = [$s0+4]
+ if $t7 goto :null6
+ Error("null pointer")
+null6:
+ $t5 = [$t7]
+ $t5 = Lt($s2 $t5)
+ if $t5 goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t5 = MulS($s2 4)
+ $t5 = Add($t5 $t7)
+ $t7 = [$s0+4]
+ if $t7 goto :null7
+ Error("null pointer")
+null7:
+ $t8 = [$t7]
+ $t8 = Lt($t2 $t8)
+ if $t8 goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t8 = MulS($t2 4)
+ $t8 = Add($t8 $t7)
+ $t8 = [$t8+4]
+ [$t5+4] = $t8
+ $t8 = [$s0+4]
+ if $t8 goto :null8
+ Error("null pointer")
+null8:
+ $t5 = [$t8]
+ $t5 = Lt($t2 $t5)
+ if $t5 goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t5 = MulS($t2 4)
+ $t5 = Add($t5 $t8)
+ [$t5+4] = $t1
+ $t5 = Add($s2 1)
+ $t5 = LtS($t2 $t5)
+ if0 $t5 goto :if4_else
+ $t4 = 0
+ goto :if4_end
+if4_else:
+ $t4 = 1
+if4_end:
+ goto :while1_top
+while1_end:
+ $t4 = [$s0+4]
+ if $t4 goto :null9
+ Error("null pointer")
+null9:
+ $t3 = [$t4]
+ $t3 = Lt($t2 $t3)
+ if $t3 goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t3 = MulS($t2 4)
+ $t3 = Add($t3 $t4)
+ $t4 = [$s0+4]
+ if $t4 goto :null10
+ Error("null pointer")
+null10:
+ $t2 = [$t4]
+ $t2 = Lt($s2 $t2)
+ if $t2 goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t2 = MulS($s2 4)
+ $t2 = Add($t2 $t4)
+ $t2 = [$t2+4]
+ [$t3+4] = $t2
+ $t2 = [$s0+4]
+ if $t2 goto :null11
+ Error("null pointer")
+null11:
+ $t3 = [$t2]
+ $t3 = Lt($s2 $t3)
+ if $t3 goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t3 = MulS($s2 4)
+ $t3 = Add($t3 $t2)
+ $t2 = [$s0+4]
+ if $t2 goto :null12
+ Error("null pointer")
+null12:
+ $t4 = [$t2]
+ $t4 = Lt($s1 $t4)
+ if $t4 goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t4 = MulS($s1 4)
+ $t4 = Add($t4 $t2)
+ $t4 = [$t4+4]
+ [$t3+4] = $t4
+ $t4 = [$s0+4]
+ if $t4 goto :null13
+ Error("null pointer")
+null13:
+ $t3 = [$t4]
+ $t3 = Lt($s1 $t3)
+ if $t3 goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t3 = MulS($s1 4)
+ $t3 = Add($t3 $t4)
+ [$t3+4] = $t1
+ $t3 = [$s0]
+ $t3 = [$t3+4]
+ $t1 = Sub($s2 1)
+ $a0 = $s0
+ $a1 = $t0
+ $a2 = $t1
+ call $t3
+ $t1 = [$s0]
+ $t1 = [$t1+4]
+ $t3 = Add($s2 1)
+ $a0 = $s0
+ $a1 = $t3
+ $a2 = $s1
+ call $t1
+ goto :if1_end
+if1_else:
+if1_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func QS.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = 0
+while4_top:
+ $t2 = [$t0+8]
+ $t2 = LtS($t1 $t2)
+ if0 $t2 goto :while4_end
+ $t2 = [$t0+4]
+ if $t2 goto :null14
+ Error("null pointer")
+null14:
+ $t3 = [$t2]
+ $t3 = Lt($t1 $t3)
+ if $t3 goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t3 = MulS($t1 4)
+ $t3 = Add($t3 $t2)
+ $t3 = [$t3+4]
+ PrintIntS($t3)
+ $t1 = Add($t1 1)
+ goto :while4_top
+while4_end:
+ $v0 = 0
+ ret
+
+func QS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = $a0
+ $t0 = $a1
+ [$s0+8] = $t0
+ $a0 = $t0
+ call :AllocArray
+ $t0 = $v0
+ [$s0+4] = $t0
+ $t0 = [$s0+4]
+ if $t0 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$t0]
+ $t1 = Lt(0 $t1)
+ if $t1 goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1 = MulS(0 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 20
+ $t1 = [$s0+4]
+ if $t1 goto :null16
+ Error("null pointer")
+null16:
+ $t0 = [$t1]
+ $t0 = Lt(1 $t0)
+ if $t0 goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0 = MulS(1 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 7
+ $t0 = [$s0+4]
+ if $t0 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$t0]
+ $t1 = Lt(2 $t1)
+ if $t1 goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1 = MulS(2 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 12
+ $t1 = [$s0+4]
+ if $t1 goto :null18
+ Error("null pointer")
+null18:
+ $t0 = [$t1]
+ $t0 = Lt(3 $t0)
+ if $t0 goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0 = MulS(3 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 18
+ $t0 = [$s0+4]
+ if $t0 goto :null19
+ Error("null pointer")
+null19:
+ $t1 = [$t0]
+ $t1 = Lt(4 $t1)
+ if $t1 goto :bounds18
+ Error("array index out of bounds")
+bounds18:
+ $t1 = MulS(4 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 2
+ $t1 = [$s0+4]
+ if $t1 goto :null20
+ Error("null pointer")
+null20:
+ $t0 = [$t1]
+ $t0 = Lt(5 $t0)
+ if $t0 goto :bounds19
+ Error("array index out of bounds")
+bounds19:
+ $t0 = MulS(5 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 11
+ $t0 = [$s0+4]
+ if $t0 goto :null21
+ Error("null pointer")
+null21:
+ $t1 = [$t0]
+ $t1 = Lt(6 $t1)
+ if $t1 goto :bounds20
+ Error("array index out of bounds")
+bounds20:
+ $t1 = MulS(6 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 6
+ $t1 = [$s0+4]
+ if $t1 goto :null22
+ Error("null pointer")
+null22:
+ $t0 = [$t1]
+ $t0 = Lt(7 $t0)
+ if $t0 goto :bounds21
+ Error("array index out of bounds")
+bounds21:
+ $t0 = MulS(7 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 9
+ $t0 = [$s0+4]
+ if $t0 goto :null23
+ Error("null pointer")
+null23:
+ $t1 = [$t0]
+ $t1 = Lt(8 $t1)
+ if $t1 goto :bounds22
+ Error("array index out of bounds")
+bounds22:
+ $t1 = MulS(8 4)
+ $t1 = Add($t1 $t0)
+ [$t1+4] = 19
+ $t1 = [$s0+4]
+ if $t1 goto :null24
+ Error("null pointer")
+null24:
+ $t0 = [$t1]
+ $t0 = Lt(9 $t0)
+ if $t0 goto :bounds23
+ Error("array index out of bounds")
+bounds23:
+ $t0 = MulS(9 4)
+ $t0 = Add($t0 $t1)
+ [$t0+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = MulS($t0 4)
+ $t1 = Add($t1 4)
+ $t1 = HeapAllocZ($t1)
+ [$t1] = $t0
+ $v0 = $t1
+ ret
+
diff --git a/vaporize/tests/TreeVisitor.names.vaporm b/vaporize/tests/TreeVisitor.names.vaporm
new file mode 100644
index 0000000..0eefb6e
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.names.vaporm
@@ -0,0 +1,1174 @@
+const vmt_TV
+ :TV.Start
+
+const vmt_Tree
+ :Tree.Init
+ :Tree.SetRight
+ :Tree.SetLeft
+ :Tree.GetRight
+ :Tree.GetLeft
+ :Tree.GetKey
+ :Tree.SetKey
+ :Tree.GetHas_Right
+ :Tree.GetHas_Left
+ :Tree.SetHas_Left
+ :Tree.SetHas_Right
+ :Tree.Compare
+ :Tree.Insert
+ :Tree.Delete
+ :Tree.Remove
+ :Tree.RemoveRight
+ :Tree.RemoveLeft
+ :Tree.Search
+ :Tree.Print
+ :Tree.RecPrint
+ :Tree.accept
+
+const vmt_Visitor
+ :Visitor.visit
+
+const vmt_MyVisitor
+ :MyVisitor.visit
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(4)
+ [$t0{t.0}] = :vmt_TV
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func TV.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{t.0} = HeapAllocZ(28)
+ [$t0{t.0}] = :vmt_Tree
+ $s0{root} = $t0{t.0}
+ if $s0{root} goto :null2
+ Error("null pointer")
+null2:
+ $t0{t.1} = [$s0{root}]
+ $t0{t.1} = [$t0{t.1}]
+ $a0 = $s0{root}
+ $a1 = 16
+ call $t0{t.1}
+ if $s0{root} goto :null3
+ Error("null pointer")
+null3:
+ $t0{t.2} = [$s0{root}]
+ $t0{t.2} = [$t0{t.2}+72]
+ $a0 = $s0{root}
+ call $t0{t.2}
+ PrintIntS(100000000)
+ if $s0{root} goto :null4
+ Error("null pointer")
+null4:
+ $t0{t.3} = [$s0{root}]
+ $t0{t.3} = [$t0{t.3}+48]
+ $a0 = $s0{root}
+ $a1 = 8
+ call $t0{t.3}
+ if $s0{root} goto :null5
+ Error("null pointer")
+null5:
+ $t0{t.4} = [$s0{root}]
+ $t0{t.4} = [$t0{t.4}+48]
+ $a0 = $s0{root}
+ $a1 = 24
+ call $t0{t.4}
+ if $s0{root} goto :null6
+ Error("null pointer")
+null6:
+ $t0{t.5} = [$s0{root}]
+ $t0{t.5} = [$t0{t.5}+48]
+ $a0 = $s0{root}
+ $a1 = 4
+ call $t0{t.5}
+ if $s0{root} goto :null7
+ Error("null pointer")
+null7:
+ $t0{t.6} = [$s0{root}]
+ $t0{t.6} = [$t0{t.6}+48]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t0{t.6}
+ if $s0{root} goto :null8
+ Error("null pointer")
+null8:
+ $t0{t.7} = [$s0{root}]
+ $t0{t.7} = [$t0{t.7}+48]
+ $a0 = $s0{root}
+ $a1 = 20
+ call $t0{t.7}
+ if $s0{root} goto :null9
+ Error("null pointer")
+null9:
+ $t0{t.8} = [$s0{root}]
+ $t0{t.8} = [$t0{t.8}+48]
+ $a0 = $s0{root}
+ $a1 = 28
+ call $t0{t.8}
+ if $s0{root} goto :null10
+ Error("null pointer")
+null10:
+ $t0{t.9} = [$s0{root}]
+ $t0{t.9} = [$t0{t.9}+48]
+ $a0 = $s0{root}
+ $a1 = 14
+ call $t0{t.9}
+ if $s0{root} goto :null11
+ Error("null pointer")
+null11:
+ $t0{t.10} = [$s0{root}]
+ $t0{t.10} = [$t0{t.10}+72]
+ $a0 = $s0{root}
+ call $t0{t.10}
+ PrintIntS(100000000)
+ $t0{t.11} = HeapAllocZ(12)
+ [$t0{t.11}] = :vmt_MyVisitor
+ $t0{v} = $t0{t.11}
+ PrintIntS(50000000)
+ if $s0{root} goto :null12
+ Error("null pointer")
+null12:
+ $t1{t.12} = [$s0{root}]
+ $t1{t.12} = [$t1{t.12}+80]
+ $a0 = $s0{root}
+ $a1 = $t0{v}
+ call $t1{t.12}
+ PrintIntS(100000000)
+ if $s0{root} goto :null13
+ Error("null pointer")
+null13:
+ $t1{t.13} = [$s0{root}]
+ $t1{t.13} = [$t1{t.13}+68]
+ $a0 = $s0{root}
+ $a1 = 24
+ call $t1{t.13}
+ $t1{t.14} = $v0
+ PrintIntS($t1{t.14})
+ if $s0{root} goto :null14
+ Error("null pointer")
+null14:
+ $t1{t.15} = [$s0{root}]
+ $t1{t.15} = [$t1{t.15}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t1{t.15}
+ $t1{t.16} = $v0
+ PrintIntS($t1{t.16})
+ if $s0{root} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.17} = [$s0{root}]
+ $t1{t.17} = [$t1{t.17}+68]
+ $a0 = $s0{root}
+ $a1 = 16
+ call $t1{t.17}
+ $t1{t.18} = $v0
+ PrintIntS($t1{t.18})
+ if $s0{root} goto :null16
+ Error("null pointer")
+null16:
+ $t1{t.19} = [$s0{root}]
+ $t1{t.19} = [$t1{t.19}+68]
+ $a0 = $s0{root}
+ $a1 = 50
+ call $t1{t.19}
+ $t1{t.20} = $v0
+ PrintIntS($t1{t.20})
+ if $s0{root} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.21} = [$s0{root}]
+ $t1{t.21} = [$t1{t.21}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t1{t.21}
+ $t1{t.22} = $v0
+ PrintIntS($t1{t.22})
+ if $s0{root} goto :null18
+ Error("null pointer")
+null18:
+ $t1{t.23} = [$s0{root}]
+ $t1{t.23} = [$t1{t.23}+52]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t1{t.23}
+ if $s0{root} goto :null19
+ Error("null pointer")
+null19:
+ $t1{t.24} = [$s0{root}]
+ $t1{t.24} = [$t1{t.24}+72]
+ $a0 = $s0{root}
+ call $t1{t.24}
+ if $s0{root} goto :null20
+ Error("null pointer")
+null20:
+ $t1{t.25} = [$s0{root}]
+ $t1{t.25} = [$t1{t.25}+68]
+ $a0 = $s0{root}
+ $a1 = 12
+ call $t1{t.25}
+ $t1{t.26} = $v0
+ PrintIntS($t1{t.26})
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+12] = $t1{v_key}
+ [$t0{this}+16] = 0
+ [$t0{this}+20] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{rn} = $a1
+ [$t0{this}+8] = $t1{rn}
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{ln} = $a1
+ [$t0{this}+4] = $t1{ln}
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+12] = $t1{v_key}
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+20]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+16]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+16] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+20] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{nti} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if1_else
+ $t1{ntb} = 0
+ goto :if1_end
+if1_else:
+ $t2{t.1} = LtS($t0{num1} $t2{nti})
+ $t2{t.2} = Sub(1 $t2{t.1})
+ if0 $t2{t.2} goto :if2_else
+ $t1{ntb} = 0
+ goto :if2_end
+if2_else:
+ $t1{ntb} = 1
+if2_end:
+if1_end:
+ $v0 = $t1{ntb}
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $t0{t.0} = HeapAllocZ(28)
+ [$t0{t.0}] = :vmt_Tree
+ $s2{new_node} = $t0{t.0}
+ if $s2{new_node} goto :null21
+ Error("null pointer")
+null21:
+ $t0{t.1} = [$s2{new_node}]
+ $t0{t.1} = [$t0{t.1}]
+ $a0 = $s2{new_node}
+ $a1 = $s1{v_key}
+ call $t0{t.1}
+ $s0{current_node} = $s0{this}
+ $s3{cont} = 1
+while1_top:
+ if0 $s3{cont} goto :while1_end
+ if $s0{current_node} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.2} = [$s0{current_node}]
+ $t0{t.2} = [$t0{t.2}+20]
+ $a0 = $s0{current_node}
+ call $t0{t.2}
+ $t0{key_aux} = $v0
+ $t0{t.3} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t0{t.3} goto :if3_else
+ if $s0{current_node} goto :null23
+ Error("null pointer")
+null23:
+ $t0{t.4} = [$s0{current_node}]
+ $t0{t.4} = [$t0{t.4}+32]
+ $a0 = $s0{current_node}
+ call $t0{t.4}
+ $t0{t.5} = $v0
+ if0 $t0{t.5} goto :if4_else
+ if $s0{current_node} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.6} = [$s0{current_node}]
+ $t0{t.6} = [$t0{t.6}+16]
+ $a0 = $s0{current_node}
+ call $t0{t.6}
+ $s0{current_node} = $v0
+ goto :if4_end
+if4_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null25
+ Error("null pointer")
+null25:
+ $t0{t.7} = [$s0{current_node}]
+ $t0{t.7} = [$t0{t.7}+36]
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call $t0{t.7}
+ if $s0{current_node} goto :null26
+ Error("null pointer")
+null26:
+ $t0{t.8} = [$s0{current_node}]
+ $t0{t.8} = [$t0{t.8}+8]
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call $t0{t.8}
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0{current_node} goto :null27
+ Error("null pointer")
+null27:
+ $t0{t.9} = [$s0{current_node}]
+ $t0{t.9} = [$t0{t.9}+28]
+ $a0 = $s0{current_node}
+ call $t0{t.9}
+ $t0{t.10} = $v0
+ if0 $t0{t.10} goto :if5_else
+ if $s0{current_node} goto :null28
+ Error("null pointer")
+null28:
+ $t0{t.11} = [$s0{current_node}]
+ $t0{t.11} = [$t0{t.11}+12]
+ $a0 = $s0{current_node}
+ call $t0{t.11}
+ $s0{current_node} = $v0
+ goto :if5_end
+if5_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null29
+ Error("null pointer")
+null29:
+ $t0{t.12} = [$s0{current_node}]
+ $t0{t.12} = [$t0{t.12}+40]
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call $t0{t.12}
+ if $s0{current_node} goto :null30
+ Error("null pointer")
+null30:
+ $t0{t.13} = [$s0{current_node}]
+ $t0{t.13} = [$t0{t.13}+4]
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call $t0{t.13}
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{current_node} = $s0{this}
+ $s3{parent_node} = $s0{this}
+ $s4{cont} = 1
+ $s5{found} = 0
+ $s6{is_root} = 1
+while2_top:
+ if0 $s4{cont} goto :while2_end
+ if $s2{current_node} goto :null31
+ Error("null pointer")
+null31:
+ $t0{t.0} = [$s2{current_node}]
+ $t0{t.0} = [$t0{t.0}+20]
+ $a0 = $s2{current_node}
+ call $t0{t.0}
+ $t0{key_aux} = $v0
+ $t1{t.1} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t1{t.1} goto :if6_else
+ if $s2{current_node} goto :null32
+ Error("null pointer")
+null32:
+ $t1{t.2} = [$s2{current_node}]
+ $t1{t.2} = [$t1{t.2}+32]
+ $a0 = $s2{current_node}
+ call $t1{t.2}
+ $t1{t.3} = $v0
+ if0 $t1{t.3} goto :if7_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null33
+ Error("null pointer")
+null33:
+ $t1{t.4} = [$s2{current_node}]
+ $t1{t.4} = [$t1{t.4}+16]
+ $a0 = $s2{current_node}
+ call $t1{t.4}
+ $s2{current_node} = $v0
+ goto :if7_end
+if7_else:
+ $s4{cont} = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0{t.5} = LtS($t0{key_aux} $s1{v_key})
+ if0 $t0{t.5} goto :if8_else
+ if $s2{current_node} goto :null34
+ Error("null pointer")
+null34:
+ $t0{t.6} = [$s2{current_node}]
+ $t0{t.6} = [$t0{t.6}+28]
+ $a0 = $s2{current_node}
+ call $t0{t.6}
+ $t0{t.7} = $v0
+ if0 $t0{t.7} goto :if9_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null35
+ Error("null pointer")
+null35:
+ $t0{t.8} = [$s2{current_node}]
+ $t0{t.8} = [$t0{t.8}+12]
+ $a0 = $s2{current_node}
+ call $t0{t.8}
+ $s2{current_node} = $v0
+ goto :if9_end
+if9_else:
+ $s4{cont} = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6{is_root} goto :if10_else
+ if $s2{current_node} goto :null36
+ Error("null pointer")
+null36:
+ $t0{t.10} = [$s2{current_node}]
+ $t0{t.10} = [$t0{t.10}+28]
+ $a0 = $s2{current_node}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ $t0{t.12} = Sub(1 $t0{t.11})
+ if0 $t0{t.12} goto :ss1_else
+ if $s2{current_node} goto :null37
+ Error("null pointer")
+null37:
+ $t0{t.13} = [$s2{current_node}]
+ $t0{t.13} = [$t0{t.13}+32]
+ $a0 = $s2{current_node}
+ call $t0{t.13}
+ $t0{t.14} = $v0
+ $t0{t.9} = Sub(1 $t0{t.14})
+ goto :ss1_end
+ss1_else:
+ $t0{t.9} = 0
+ss1_end:
+ if0 $t0{t.9} goto :if11_else
+ goto :if11_end
+if11_else:
+ $t0{t.15} = [$s0{this}]
+ $t0{t.15} = [$t0{t.15}+56]
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call $t0{t.15}
+if11_end:
+ goto :if10_end
+if10_else:
+ $t0{t.16} = [$s0{this}]
+ $t0{t.16} = [$t0{t.16}+56]
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call $t0{t.16}
+if10_end:
+ $s5{found} = 1
+ $s4{cont} = 0
+if8_end:
+if6_end:
+ $s6{is_root} = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5{found}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+ if $s2{c_node} goto :null38
+ Error("null pointer")
+null38:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if12_else
+ $t0{t.2} = [$s0{this}]
+ $t0{t.2} = [$t0{t.2}+64]
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call $t0{t.2}
+ goto :if12_end
+if12_else:
+ if $s2{c_node} goto :null39
+ Error("null pointer")
+null39:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+28]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if0 $t0{t.4} goto :if13_else
+ $t0{t.5} = [$s0{this}]
+ $t0{t.5} = [$t0{t.5}+60]
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call $t0{t.5}
+ goto :if13_end
+if13_else:
+ if $s2{c_node} goto :null40
+ Error("null pointer")
+null40:
+ $t0{t.6} = [$s2{c_node}]
+ $t0{t.6} = [$t0{t.6}+20]
+ $a0 = $s2{c_node}
+ call $t0{t.6}
+ $s2{auxkey1} = $v0
+ if $s1{p_node} goto :null41
+ Error("null pointer")
+null41:
+ $t0{t.7} = [$s1{p_node}]
+ $t0{t.7} = [$t0{t.7}+16]
+ $a0 = $s1{p_node}
+ call $t0{t.7}
+ $t0{t.8} = $v0
+ if $t0{t.8} goto :null42
+ Error("null pointer")
+null42:
+ $t1{t.9} = [$t0{t.8}]
+ $t1{t.9} = [$t1{t.9}+20]
+ $a0 = $t0{t.8}
+ call $t1{t.9}
+ $t1{auxkey2} = $v0
+ $t0{t.10} = [$s0{this}]
+ $t0{t.10} = [$t0{t.10}+44]
+ $a0 = $s0{this}
+ $a1 = $s2{auxkey1}
+ $a2 = $t1{auxkey2}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ if0 $t0{t.11} goto :if14_else
+ if $s1{p_node} goto :null43
+ Error("null pointer")
+null43:
+ $t0{t.12} = [$s1{p_node}]
+ $t0{t.12} = [$t0{t.12}+8]
+ $t1{t.13} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t1{t.13}
+ call $t0{t.12}
+ if $s1{p_node} goto :null44
+ Error("null pointer")
+null44:
+ $t1{t.14} = [$s1{p_node}]
+ $t1{t.14} = [$t1{t.14}+36]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t1{t.14}
+ goto :if14_end
+if14_else:
+ if $s1{p_node} goto :null45
+ Error("null pointer")
+null45:
+ $t1{t.15} = [$s1{p_node}]
+ $t1{t.15} = [$t1{t.15}+4]
+ $t0{t.16} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.16}
+ call $t1{t.15}
+ if $s1{p_node} goto :null46
+ Error("null pointer")
+null46:
+ $t0{t.17} = [$s1{p_node}]
+ $t0{t.17} = [$t0{t.17}+40]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.17}
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while3_top:
+ if $s2{c_node} goto :null47
+ Error("null pointer")
+null47:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+28]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :while3_end
+ if $s2{c_node} goto :null48
+ Error("null pointer")
+null48:
+ $s3{t.2} = [$s2{c_node}]
+ $s3{t.2} = [$s3{t.2}+24]
+ if $s2{c_node} goto :null49
+ Error("null pointer")
+null49:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+12]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :null50
+ Error("null pointer")
+null50:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+20]
+ $a0 = $t0{t.4}
+ call $t1{t.5}
+ $t1{t.6} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t1{t.6}
+ call $s3{t.2}
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null51
+ Error("null pointer")
+null51:
+ $t1{t.7} = [$s2{c_node}]
+ $t1{t.7} = [$t1{t.7}+12]
+ $a0 = $s2{c_node}
+ call $t1{t.7}
+ $s2{c_node} = $v0
+ goto :while3_top
+while3_end:
+ if $s1{p_node} goto :null52
+ Error("null pointer")
+null52:
+ $t1{t.8} = [$s1{p_node}]
+ $t1{t.8} = [$t1{t.8}+4]
+ $t0{t.9} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.9}
+ call $t1{t.8}
+ if $s1{p_node} goto :null53
+ Error("null pointer")
+null53:
+ $t0{t.10} = [$s1{p_node}]
+ $t0{t.10} = [$t0{t.10}+40]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.10}
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while4_top:
+ if $s2{c_node} goto :null54
+ Error("null pointer")
+null54:
+ $t0{t.0} = [$s2{c_node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s2{c_node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :while4_end
+ if $s2{c_node} goto :null55
+ Error("null pointer")
+null55:
+ $s3{t.2} = [$s2{c_node}]
+ $s3{t.2} = [$s3{t.2}+24]
+ if $s2{c_node} goto :null56
+ Error("null pointer")
+null56:
+ $t0{t.3} = [$s2{c_node}]
+ $t0{t.3} = [$t0{t.3}+16]
+ $a0 = $s2{c_node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :null57
+ Error("null pointer")
+null57:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+20]
+ $a0 = $t0{t.4}
+ call $t1{t.5}
+ $t1{t.6} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t1{t.6}
+ call $s3{t.2}
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null58
+ Error("null pointer")
+null58:
+ $t1{t.7} = [$s2{c_node}]
+ $t1{t.7} = [$t1{t.7}+16]
+ $a0 = $s2{c_node}
+ call $t1{t.7}
+ $s2{c_node} = $v0
+ goto :while4_top
+while4_end:
+ if $s1{p_node} goto :null59
+ Error("null pointer")
+null59:
+ $t1{t.8} = [$s1{p_node}]
+ $t1{t.8} = [$t1{t.8}+8]
+ $t0{t.9} = [$s0{this}+24]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.9}
+ call $t1{t.8}
+ if $s1{p_node} goto :null60
+ Error("null pointer")
+null60:
+ $t0{t.10} = [$s1{p_node}]
+ $t0{t.10} = [$t0{t.10}+36]
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call $t0{t.10}
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{v_key} = $a1
+ $s1{current_node} = $t0{this}
+ $s2{cont} = 1
+ $s3{ifound} = 0
+while5_top:
+ if0 $s2{cont} goto :while5_end
+ if $s1{current_node} goto :null61
+ Error("null pointer")
+null61:
+ $t0{t.0} = [$s1{current_node}]
+ $t0{t.0} = [$t0{t.0}+20]
+ $a0 = $s1{current_node}
+ call $t0{t.0}
+ $t0{key_aux} = $v0
+ $t1{t.1} = LtS($s0{v_key} $t0{key_aux})
+ if0 $t1{t.1} goto :if15_else
+ if $s1{current_node} goto :null62
+ Error("null pointer")
+null62:
+ $t1{t.2} = [$s1{current_node}]
+ $t1{t.2} = [$t1{t.2}+32]
+ $a0 = $s1{current_node}
+ call $t1{t.2}
+ $t1{t.3} = $v0
+ if0 $t1{t.3} goto :if16_else
+ if $s1{current_node} goto :null63
+ Error("null pointer")
+null63:
+ $t1{t.4} = [$s1{current_node}]
+ $t1{t.4} = [$t1{t.4}+16]
+ $a0 = $s1{current_node}
+ call $t1{t.4}
+ $s1{current_node} = $v0
+ goto :if16_end
+if16_else:
+ $s2{cont} = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0{t.5} = LtS($t0{key_aux} $s0{v_key})
+ if0 $t0{t.5} goto :if17_else
+ if $s1{current_node} goto :null64
+ Error("null pointer")
+null64:
+ $t0{t.6} = [$s1{current_node}]
+ $t0{t.6} = [$t0{t.6}+28]
+ $a0 = $s1{current_node}
+ call $t0{t.6}
+ $t0{t.7} = $v0
+ if0 $t0{t.7} goto :if18_else
+ if $s1{current_node} goto :null65
+ Error("null pointer")
+null65:
+ $t0{t.8} = [$s1{current_node}]
+ $t0{t.8} = [$t0{t.8}+12]
+ $a0 = $s1{current_node}
+ call $t0{t.8}
+ $s1{current_node} = $v0
+ goto :if18_end
+if18_else:
+ $s2{cont} = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3{ifound} = 1
+ $s2{cont} = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3{ifound}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{current_node} = $t0{this}
+ $t2{t.0} = [$t0{this}]
+ $t2{t.0} = [$t2{t.0}+76]
+ $a0 = $t0{this}
+ $a1 = $t1{current_node}
+ call $t2{t.0}
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{node} = $a1
+ if $s1{node} goto :null66
+ Error("null pointer")
+null66:
+ $t0{t.0} = [$s1{node}]
+ $t0{t.0} = [$t0{t.0}+32]
+ $a0 = $s1{node}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if19_else
+ $s2{t.2} = [$s0{this}]
+ $s2{t.2} = [$s2{t.2}+76]
+ if $s1{node} goto :null67
+ Error("null pointer")
+null67:
+ $t0{t.3} = [$s1{node}]
+ $t0{t.3} = [$t0{t.3}+16]
+ $a0 = $s1{node}
+ call $t0{t.3}
+ $t0{t.4} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.4}
+ call $s2{t.2}
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1{node} goto :null68
+ Error("null pointer")
+null68:
+ $t0{t.5} = [$s1{node}]
+ $t0{t.5} = [$t0{t.5}+20]
+ $a0 = $s1{node}
+ call $t0{t.5}
+ $t0{t.6} = $v0
+ PrintIntS($t0{t.6})
+ if $s1{node} goto :null69
+ Error("null pointer")
+null69:
+ $t0{t.7} = [$s1{node}]
+ $t0{t.7} = [$t0{t.7}+28]
+ $a0 = $s1{node}
+ call $t0{t.7}
+ $t0{t.8} = $v0
+ if0 $t0{t.8} goto :if20_else
+ $s2{t.9} = [$s0{this}]
+ $s2{t.9} = [$s2{t.9}+76]
+ if $s1{node} goto :null70
+ Error("null pointer")
+null70:
+ $t0{t.10} = [$s1{node}]
+ $t0{t.10} = [$t0{t.10}+12]
+ $a0 = $s1{node}
+ call $t0{t.10}
+ $t0{t.11} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.11}
+ call $s2{t.9}
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.accept [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v} = $a1
+ PrintIntS(333)
+ if $t1{v} goto :null71
+ Error("null pointer")
+null71:
+ $t2{t.0} = [$t1{v}]
+ $t2{t.0} = [$t2{t.0}]
+ $a0 = $t1{v}
+ $a1 = $t0{this}
+ call $t2{t.0}
+ $v0 = 0
+ ret
+
+func Visitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{n} = $a1
+ if $s1{n} goto :null72
+ Error("null pointer")
+null72:
+ $t0{t.0} = [$s1{n}]
+ $t0{t.0} = [$t0{t.0}+28]
+ $a0 = $s1{n}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if21_else
+ if $s1{n} goto :null73
+ Error("null pointer")
+null73:
+ $t0{t.2} = [$s1{n}]
+ $t0{t.2} = [$t0{t.2}+12]
+ $a0 = $s1{n}
+ call $t0{t.2}
+ $t0{t.3} = $v0
+ [$s0{this}+8] = $t0{t.3}
+ $t0{t.4} = [$s0{this}+8]
+ if $t0{t.4} goto :null74
+ Error("null pointer")
+null74:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+80]
+ $a0 = $t0{t.4}
+ $a1 = $s0{this}
+ call $t1{t.5}
+ goto :if21_end
+if21_else:
+if21_end:
+ if $s1{n} goto :null75
+ Error("null pointer")
+null75:
+ $t1{t.6} = [$s1{n}]
+ $t1{t.6} = [$t1{t.6}+32]
+ $a0 = $s1{n}
+ call $t1{t.6}
+ $t1{t.7} = $v0
+ if0 $t1{t.7} goto :if22_else
+ if $s1{n} goto :null76
+ Error("null pointer")
+null76:
+ $t1{t.8} = [$s1{n}]
+ $t1{t.8} = [$t1{t.8}+16]
+ $a0 = $s1{n}
+ call $t1{t.8}
+ $t1{t.9} = $v0
+ [$s0{this}+4] = $t1{t.9}
+ $t1{t.10} = [$s0{this}+4]
+ if $t1{t.10} goto :null77
+ Error("null pointer")
+null77:
+ $t0{t.11} = [$t1{t.10}]
+ $t0{t.11} = [$t0{t.11}+80]
+ $a0 = $t1{t.10}
+ $a1 = $s0{this}
+ call $t0{t.11}
+ goto :if22_end
+if22_else:
+if22_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func MyVisitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{n} = $a1
+ if $s1{n} goto :null78
+ Error("null pointer")
+null78:
+ $t0{t.0} = [$s1{n}]
+ $t0{t.0} = [$t0{t.0}+28]
+ $a0 = $s1{n}
+ call $t0{t.0}
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if23_else
+ if $s1{n} goto :null79
+ Error("null pointer")
+null79:
+ $t0{t.2} = [$s1{n}]
+ $t0{t.2} = [$t0{t.2}+12]
+ $a0 = $s1{n}
+ call $t0{t.2}
+ $t0{t.3} = $v0
+ [$s0{this}+8] = $t0{t.3}
+ $t0{t.4} = [$s0{this}+8]
+ if $t0{t.4} goto :null80
+ Error("null pointer")
+null80:
+ $t1{t.5} = [$t0{t.4}]
+ $t1{t.5} = [$t1{t.5}+80]
+ $a0 = $t0{t.4}
+ $a1 = $s0{this}
+ call $t1{t.5}
+ goto :if23_end
+if23_else:
+if23_end:
+ if $s1{n} goto :null81
+ Error("null pointer")
+null81:
+ $t1{t.6} = [$s1{n}]
+ $t1{t.6} = [$t1{t.6}+20]
+ $a0 = $s1{n}
+ call $t1{t.6}
+ $t1{t.7} = $v0
+ PrintIntS($t1{t.7})
+ if $s1{n} goto :null82
+ Error("null pointer")
+null82:
+ $t1{t.8} = [$s1{n}]
+ $t1{t.8} = [$t1{t.8}+32]
+ $a0 = $s1{n}
+ call $t1{t.8}
+ $t1{t.9} = $v0
+ if0 $t1{t.9} goto :if24_else
+ if $s1{n} goto :null83
+ Error("null pointer")
+null83:
+ $t1{t.10} = [$s1{n}]
+ $t1{t.10} = [$t1{t.10}+16]
+ $a0 = $s1{n}
+ call $t1{t.10}
+ $t1{t.11} = $v0
+ [$s0{this}+4] = $t1{t.11}
+ $t1{t.12} = [$s0{this}+4]
+ if $t1{t.12} goto :null84
+ Error("null pointer")
+null84:
+ $t0{t.13} = [$t1{t.12}]
+ $t0{t.13} = [$t0{t.13}+80]
+ $a0 = $t1{t.12}
+ $a1 = $s0{this}
+ call $t0{t.13}
+ goto :if24_end
+if24_else:
+if24_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
diff --git a/vaporize/tests/TreeVisitor.opt.names.vaporm b/vaporize/tests/TreeVisitor.opt.names.vaporm
new file mode 100644
index 0000000..69a62c4
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.opt.names.vaporm
@@ -0,0 +1,948 @@
+const empty_TV
+
+const empty_Tree
+
+const vmt_Visitor
+ :Visitor.visit
+
+const vmt_MyVisitor
+ :MyVisitor.visit
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_TV
+ call :TV.Start
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func TV.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{root} = HeapAllocZ(24)
+ if $s0{root} goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s0{root}
+ $a1 = 16
+ call :Tree.Init
+ if $s0{root} goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s0{root}
+ call :Tree.Print
+ PrintIntS(100000000)
+ if $s0{root} goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s0{root}
+ $a1 = 8
+ call :Tree.Insert
+ if $s0{root} goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s0{root}
+ $a1 = 24
+ call :Tree.Insert
+ if $s0{root} goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0{root}
+ $a1 = 4
+ call :Tree.Insert
+ if $s0{root} goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Insert
+ if $s0{root} goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s0{root}
+ $a1 = 20
+ call :Tree.Insert
+ if $s0{root} goto :null8
+ Error("null pointer")
+null8:
+ $a0 = $s0{root}
+ $a1 = 28
+ call :Tree.Insert
+ if $s0{root} goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s0{root}
+ $a1 = 14
+ call :Tree.Insert
+ if $s0{root} goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s0{root}
+ call :Tree.Print
+ PrintIntS(100000000)
+ $t0{t.0} = HeapAllocZ(12)
+ [$t0{t.0}] = :vmt_MyVisitor
+ $t0{v} = $t0{t.0}
+ PrintIntS(50000000)
+ if $s0{root} goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s0{root}
+ $a1 = $t0{v}
+ call :Tree.accept
+ PrintIntS(100000000)
+ if $s0{root} goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s0{root}
+ $a1 = 24
+ call :Tree.Search
+ $t0{t.1} = $v0
+ PrintIntS($t0{t.1})
+ if $s0{root} goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.2} = $v0
+ PrintIntS($t0{t.2})
+ if $s0{root} goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s0{root}
+ $a1 = 16
+ call :Tree.Search
+ $t0{t.3} = $v0
+ PrintIntS($t0{t.3})
+ if $s0{root} goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s0{root}
+ $a1 = 50
+ call :Tree.Search
+ $t0{t.4} = $v0
+ PrintIntS($t0{t.4})
+ if $s0{root} goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.5} = $v0
+ PrintIntS($t0{t.5})
+ if $s0{root} goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Delete
+ if $s0{root} goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0{root}
+ call :Tree.Print
+ if $s0{root} goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0{root}
+ $a1 = 12
+ call :Tree.Search
+ $t0{t.6} = $v0
+ PrintIntS($t0{t.6})
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+8] = $t1{v_key}
+ [$t0{this}+12] = 0
+ [$t0{this}+16] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{rn} = $a1
+ [$t0{this}+4] = $t1{rn}
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{ln} = $a1
+ [$t0{this}] = $t1{ln}
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+4]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+8]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v_key} = $a1
+ [$t0{this}+8] = $t1{v_key}
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+16]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t0{t.0} = [$t0{this}+12]
+ $v0 = $t0{t.0}
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+12] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{val} = $a1
+ [$t0{this}+16] = $t1{val}
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0{num1} = $a1
+ $t1{num2} = $a2
+ $t2{nti} = Add($t1{num2} 1)
+ $t1{t.0} = LtS($t0{num1} $t1{num2})
+ if0 $t1{t.0} goto :if1_else
+ $t1{ntb} = 0
+ goto :if1_end
+if1_else:
+ $t2{t.1} = LtS($t0{num1} $t2{nti})
+ if $t2{t.1} goto :if2_else
+ $t1{ntb} = 0
+ goto :if2_end
+if2_else:
+ $t1{ntb} = 1
+if2_end:
+if1_end:
+ $v0 = $t1{ntb}
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{new_node} = HeapAllocZ(24)
+ if $s2{new_node} goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s2{new_node}
+ $a1 = $s1{v_key}
+ call :Tree.Init
+ $s0{current_node} = $s0{this}
+ $s3{cont} = 1
+while1_top:
+ if0 $s3{cont} goto :while1_end
+ if $s0{current_node} goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t0{t.0} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t0{t.0} goto :if3_else
+ if $s0{current_node} goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0{current_node}
+ call :Tree.GetHas_Left
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if4_else
+ if $s0{current_node} goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0{current_node}
+ call :Tree.GetLeft
+ $s0{current_node} = $v0
+ goto :if4_end
+if4_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call :Tree.SetHas_Left
+ if $s0{current_node} goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call :Tree.SetLeft
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0{current_node} goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.2} = $v0
+ if0 $t0{t.2} goto :if5_else
+ if $s0{current_node} goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s0{current_node}
+ call :Tree.GetRight
+ $s0{current_node} = $v0
+ goto :if5_end
+if5_else:
+ $s3{cont} = 0
+ if $s0{current_node} goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0{current_node}
+ $a1 = 1
+ call :Tree.SetHas_Right
+ if $s0{current_node} goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0{current_node}
+ $a1 = $s2{new_node}
+ call :Tree.SetRight
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0{this} = $a0
+ $s1{v_key} = $a1
+ $s2{current_node} = $s0{this}
+ $s3{parent_node} = $s0{this}
+ $s4{cont} = 1
+ $s5{found} = 0
+ $s6{is_root} = 1
+while2_top:
+ if0 $s4{cont} goto :while2_end
+ if $s2{current_node} goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s2{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t1{t.0} = LtS($s1{v_key} $t0{key_aux})
+ if0 $t1{t.0} goto :if6_else
+ if $s2{current_node} goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Left
+ $t1{t.1} = $v0
+ if0 $t1{t.1} goto :if7_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s2{current_node}
+ call :Tree.GetLeft
+ $s2{current_node} = $v0
+ goto :if7_end
+if7_else:
+ $s4{cont} = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0{t.2} = LtS($t0{key_aux} $s1{v_key})
+ if0 $t0{t.2} goto :if8_else
+ if $s2{current_node} goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if9_else
+ $s3{parent_node} = $s2{current_node}
+ if $s2{current_node} goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s2{current_node}
+ call :Tree.GetRight
+ $s2{current_node} = $v0
+ goto :if9_end
+if9_else:
+ $s4{cont} = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6{is_root} goto :if10_else
+ if $s2{current_node} goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.4} = $v0
+ if $t0{t.4} goto :if11_else
+ if $s2{current_node} goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s2{current_node}
+ call :Tree.GetHas_Left
+ $t0{t.5} = $v0
+ if $t0{t.5} goto :if11_else
+ goto :if11_end
+if11_else:
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call :Tree.Remove
+if11_end:
+ goto :if10_end
+if10_else:
+ $a0 = $s0{this}
+ $a1 = $s3{parent_node}
+ $a2 = $s2{current_node}
+ call :Tree.Remove
+if10_end:
+ $s5{found} = 1
+ $s4{cont} = 0
+if8_end:
+if6_end:
+ $s6{is_root} = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5{found}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+ if $s2{c_node} goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if12_else
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call :Tree.RemoveLeft
+ goto :if12_end
+if12_else:
+ if $s2{c_node} goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Right
+ $t0{t.1} = $v0
+ if0 $t0{t.1} goto :if13_else
+ $a0 = $s0{this}
+ $a1 = $s1{p_node}
+ $a2 = $s2{c_node}
+ call :Tree.RemoveRight
+ goto :if13_end
+if13_else:
+ if $s2{c_node} goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s2{c_node}
+ call :Tree.GetKey
+ $s2{auxkey1} = $v0
+ if $s1{p_node} goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s1{p_node}
+ call :Tree.GetLeft
+ $t0{t.2} = $v0
+ if $t0{t.2} goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $t0{t.2}
+ call :Tree.GetKey
+ $t0{auxkey2} = $v0
+ $a0 = $s0{this}
+ $a1 = $s2{auxkey1}
+ $a2 = $t0{auxkey2}
+ call :Tree.Compare
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if14_else
+ if $s1{p_node} goto :null42
+ Error("null pointer")
+null42:
+ $t0{t.4} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.4}
+ call :Tree.SetLeft
+ if $s1{p_node} goto :null43
+ Error("null pointer")
+null43:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Left
+ goto :if14_end
+if14_else:
+ if $s1{p_node} goto :null44
+ Error("null pointer")
+null44:
+ $t0{t.5} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.5}
+ call :Tree.SetRight
+ if $s1{p_node} goto :null45
+ Error("null pointer")
+null45:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Right
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while3_top:
+ if $s2{c_node} goto :null46
+ Error("null pointer")
+null46:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Right
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :while3_end
+ if $s2{c_node} goto :null47
+ Error("null pointer")
+null47:
+ if $s2{c_node} goto :null48
+ Error("null pointer")
+null48:
+ $a0 = $s2{c_node}
+ call :Tree.GetRight
+ $t0{t.1} = $v0
+ if $t0{t.1} goto :null49
+ Error("null pointer")
+null49:
+ $a0 = $t0{t.1}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t0{t.2}
+ call :Tree.SetKey
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null50
+ Error("null pointer")
+null50:
+ $a0 = $s2{c_node}
+ call :Tree.GetRight
+ $s2{c_node} = $v0
+ goto :while3_top
+while3_end:
+ if $s1{p_node} goto :null51
+ Error("null pointer")
+null51:
+ $t0{t.3} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.3}
+ call :Tree.SetRight
+ if $s1{p_node} goto :null52
+ Error("null pointer")
+null52:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Right
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $s1{p_node} = $a1
+ $s2{c_node} = $a2
+while4_top:
+ if $s2{c_node} goto :null53
+ Error("null pointer")
+null53:
+ $a0 = $s2{c_node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :while4_end
+ if $s2{c_node} goto :null54
+ Error("null pointer")
+null54:
+ if $s2{c_node} goto :null55
+ Error("null pointer")
+null55:
+ $a0 = $s2{c_node}
+ call :Tree.GetLeft
+ $t0{t.1} = $v0
+ if $t0{t.1} goto :null56
+ Error("null pointer")
+null56:
+ $a0 = $t0{t.1}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ $a0 = $s2{c_node}
+ $a1 = $t0{t.2}
+ call :Tree.SetKey
+ $s1{p_node} = $s2{c_node}
+ if $s2{c_node} goto :null57
+ Error("null pointer")
+null57:
+ $a0 = $s2{c_node}
+ call :Tree.GetLeft
+ $s2{c_node} = $v0
+ goto :while4_top
+while4_end:
+ if $s1{p_node} goto :null58
+ Error("null pointer")
+null58:
+ $t0{t.3} = [$s0{this}+20]
+ $a0 = $s1{p_node}
+ $a1 = $t0{t.3}
+ call :Tree.SetLeft
+ if $s1{p_node} goto :null59
+ Error("null pointer")
+null59:
+ $a0 = $s1{p_node}
+ $a1 = 0
+ call :Tree.SetHas_Left
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0{this} = $a0
+ $s0{v_key} = $a1
+ $s1{current_node} = $t0{this}
+ $s2{cont} = 1
+ $s3{ifound} = 0
+while5_top:
+ if0 $s2{cont} goto :while5_end
+ if $s1{current_node} goto :null60
+ Error("null pointer")
+null60:
+ $a0 = $s1{current_node}
+ call :Tree.GetKey
+ $t0{key_aux} = $v0
+ $t1{t.0} = LtS($s0{v_key} $t0{key_aux})
+ if0 $t1{t.0} goto :if15_else
+ if $s1{current_node} goto :null61
+ Error("null pointer")
+null61:
+ $a0 = $s1{current_node}
+ call :Tree.GetHas_Left
+ $t1{t.1} = $v0
+ if0 $t1{t.1} goto :if16_else
+ if $s1{current_node} goto :null62
+ Error("null pointer")
+null62:
+ $a0 = $s1{current_node}
+ call :Tree.GetLeft
+ $s1{current_node} = $v0
+ goto :if16_end
+if16_else:
+ $s2{cont} = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0{t.2} = LtS($t0{key_aux} $s0{v_key})
+ if0 $t0{t.2} goto :if17_else
+ if $s1{current_node} goto :null63
+ Error("null pointer")
+null63:
+ $a0 = $s1{current_node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if18_else
+ if $s1{current_node} goto :null64
+ Error("null pointer")
+null64:
+ $a0 = $s1{current_node}
+ call :Tree.GetRight
+ $s1{current_node} = $v0
+ goto :if18_end
+if18_else:
+ $s2{cont} = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3{ifound} = 1
+ $s2{cont} = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3{ifound}
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{current_node} = $t0{this}
+ $a0 = $t0{this}
+ $a1 = $t1{current_node}
+ call :Tree.RecPrint
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{node} = $a1
+ if $s1{node} goto :null65
+ Error("null pointer")
+null65:
+ $a0 = $s1{node}
+ call :Tree.GetHas_Left
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if19_else
+ if $s1{node} goto :null66
+ Error("null pointer")
+null66:
+ $a0 = $s1{node}
+ call :Tree.GetLeft
+ $t0{t.1} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.1}
+ call :Tree.RecPrint
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1{node} goto :null67
+ Error("null pointer")
+null67:
+ $a0 = $s1{node}
+ call :Tree.GetKey
+ $t0{t.2} = $v0
+ PrintIntS($t0{t.2})
+ if $s1{node} goto :null68
+ Error("null pointer")
+null68:
+ $a0 = $s1{node}
+ call :Tree.GetHas_Right
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if20_else
+ if $s1{node} goto :null69
+ Error("null pointer")
+null69:
+ $a0 = $s1{node}
+ call :Tree.GetRight
+ $t0{t.4} = $v0
+ $a0 = $s0{this}
+ $a1 = $t0{t.4}
+ call :Tree.RecPrint
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func Tree.accept [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{v} = $a1
+ PrintIntS(333)
+ if $t1{v} goto :null70
+ Error("null pointer")
+null70:
+ $t2{t.0} = [$t1{v}]
+ $t2{t.0} = [$t2{t.0}]
+ $a0 = $t1{v}
+ $a1 = $t0{this}
+ call $t2{t.0}
+ $v0 = 0
+ ret
+
+func Visitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{n} = $a1
+ if $s1{n} goto :null71
+ Error("null pointer")
+null71:
+ $a0 = $s1{n}
+ call :Tree.GetHas_Right
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if21_else
+ if $s1{n} goto :null72
+ Error("null pointer")
+null72:
+ $a0 = $s1{n}
+ call :Tree.GetRight
+ $t0{t.1} = $v0
+ [$s0{this}+8] = $t0{t.1}
+ $t0{t.2} = [$s0{this}+8]
+ if $t0{t.2} goto :null73
+ Error("null pointer")
+null73:
+ $a0 = $t0{t.2}
+ $a1 = $s0{this}
+ call :Tree.accept
+ goto :if21_end
+if21_else:
+if21_end:
+ if $s1{n} goto :null74
+ Error("null pointer")
+null74:
+ $a0 = $s1{n}
+ call :Tree.GetHas_Left
+ $t0{t.3} = $v0
+ if0 $t0{t.3} goto :if22_else
+ if $s1{n} goto :null75
+ Error("null pointer")
+null75:
+ $a0 = $s1{n}
+ call :Tree.GetLeft
+ $t0{t.4} = $v0
+ [$s0{this}+4] = $t0{t.4}
+ $t0{t.5} = [$s0{this}+4]
+ if $t0{t.5} goto :null76
+ Error("null pointer")
+null76:
+ $a0 = $t0{t.5}
+ $a1 = $s0{this}
+ call :Tree.accept
+ goto :if22_end
+if22_else:
+if22_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func MyVisitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0{this} = $a0
+ $s1{n} = $a1
+ if $s1{n} goto :null77
+ Error("null pointer")
+null77:
+ $a0 = $s1{n}
+ call :Tree.GetHas_Right
+ $t0{t.0} = $v0
+ if0 $t0{t.0} goto :if23_else
+ if $s1{n} goto :null78
+ Error("null pointer")
+null78:
+ $a0 = $s1{n}
+ call :Tree.GetRight
+ $t0{t.1} = $v0
+ [$s0{this}+8] = $t0{t.1}
+ $t0{t.2} = [$s0{this}+8]
+ if $t0{t.2} goto :null79
+ Error("null pointer")
+null79:
+ $a0 = $t0{t.2}
+ $a1 = $s0{this}
+ call :Tree.accept
+ goto :if23_end
+if23_else:
+if23_end:
+ if $s1{n} goto :null80
+ Error("null pointer")
+null80:
+ $a0 = $s1{n}
+ call :Tree.GetKey
+ $t0{t.3} = $v0
+ PrintIntS($t0{t.3})
+ if $s1{n} goto :null81
+ Error("null pointer")
+null81:
+ $a0 = $s1{n}
+ call :Tree.GetHas_Left
+ $t0{t.4} = $v0
+ if0 $t0{t.4} goto :if24_else
+ if $s1{n} goto :null82
+ Error("null pointer")
+null82:
+ $a0 = $s1{n}
+ call :Tree.GetLeft
+ $t0{t.5} = $v0
+ [$s0{this}+4] = $t0{t.5}
+ $t0{t.6} = [$s0{this}+4]
+ if $t0{t.6} goto :null83
+ Error("null pointer")
+null83:
+ $a0 = $t0{t.6}
+ $a1 = $s0{this}
+ call :Tree.accept
+ goto :if24_end
+if24_else:
+if24_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
diff --git a/vaporize/tests/TreeVisitor.opt.regalloc b/vaporize/tests/TreeVisitor.opt.regalloc
new file mode 100644
index 0000000..985ead2
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.opt.regalloc
@@ -0,0 +1,539 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 15
+Linear Range:
+ t.0: 14-15
+Allocation:
+ t.0: t0
+
+func TV.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this:
+ root: 20 23-24 27-29 32-33 36-37 40-41 44-45 48-49 52-53 56-57 60-66 69-71 74-76 79-81 84-86 89-91 94-96 99-100 103-104 107
+ ntb:
+ t.0: 63-64
+ v: 65-66 69
+ nti:
+ t.1: 75
+ t.2: 80
+ t.3: 85
+ t.4: 90
+ t.5: 95
+ t.6: 108
+Linear Range:
+ root: 19-107 (cross call)
+ t.0: 62-64
+ v: 64-69
+ t.1: 74-75
+ t.2: 79-80
+ t.3: 84-85
+ t.4: 89-90
+ t.5: 94-95
+ t.6: 107-108
+Allocation:
+ root: s0
+ t.0: t0
+ v: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+
+func Tree.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 112-114
+ v_key: 112
+Linear Range:
+ this: 111-114
+ v_key: 111-112
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.SetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 118
+ rn: 118
+Linear Range:
+ this: 117-118
+ rn: 117-118
+Allocation:
+ this: t0
+ rn: t1
+
+func Tree.SetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 122
+ ln: 122
+Linear Range:
+ this: 121-122
+ ln: 121-122
+Allocation:
+ this: t0
+ ln: t1
+
+func Tree.GetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 126
+ t.0: 127
+Linear Range:
+ this: 125-126
+ t.0: 126-127
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 130
+ t.0: 131
+Linear Range:
+ this: 129-130
+ t.0: 130-131
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 134
+ t.0: 135
+Linear Range:
+ this: 133-134
+ t.0: 134-135
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 138
+ v_key: 138
+Linear Range:
+ this: 137-138
+ v_key: 137-138
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.GetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 142
+ t.0: 143
+Linear Range:
+ this: 141-142
+ t.0: 142-143
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 146
+ t.0: 147
+Linear Range:
+ this: 145-146
+ t.0: 146-147
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 150
+ val: 150
+Linear Range:
+ this: 149-150
+ val: 149-150
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.SetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 154
+ val: 154
+Linear Range:
+ this: 153-154
+ val: 153-154
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 158-161 165
+ num2: 158-160
+ ntb: 163 168 173
+ nti: 160-161 165
+ t.0: 161
+ t.1: 166
+Linear Range:
+ num1: 157-165
+ num2: 157-160
+ ntb: 162-173
+ nti: 159-165
+ t.0: 160-161
+ t.1: 165-166
+Allocation:
+ num1: t0
+ num2: t1
+ ntb: t1
+ nti: t2
+ t.0: t1
+ t.1: t2
+
+func Tree.Insert
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 176-177 180-181
+ v_key: 176-177 180-185 188-191 194-196 199-203 206-207 210-214 217-219 222-226 229-230 233-236
+ new_node: 177 180-185 188-191 194-196 199-203 206-207 210-214 217-219 222-226 229-230 233-236
+ ntb:
+ current_node: 182-185 188-191 194-196 199-203 206-207 210-214 217-219 222-226 229-230 233-236
+ cont: 184-185 188-191 194-196 199-200 203 206-207 210-214 217-219 222-223 226 229-230 233-236
+ key_aux: 189
+ t.0: 190
+ t.1: 195
+ t.2: 218
+Linear Range:
+ this: 175-181 (cross call)
+ v_key: 175-236 (cross call)
+ new_node: 176-236 (cross call)
+ current_node: 181-236 (cross call)
+ cont: 182-236 (cross call)
+ key_aux: 188-189
+ t.0: 189-190
+ t.1: 194-195
+ t.2: 217-218
+Allocation:
+ this: s0
+ v_key: s1
+ new_node: s2
+ current_node: s0
+ cont: s3
+ key_aux: t0
+ t.0: t0
+ t.1: t0
+ t.2: t0
+
+func Tree.Delete
+ in 0, out 0, callee-saves 7, spills 0
+Live In:
+ this: 241-248 251-254 257-260 263-272 275-278 281-289 292-294 297-313
+ v_key: 241-248 251-254 257-260 263-272 275-278 281-289 292-294 297-313
+ current_node: 242-248 251-254 257-260 263-272 275-278 281-289 292-294 297-313
+ parent_node: 243-248 251-254 257-258 260 263-272 275-276 278 281-289 292-294 297-313
+ cont: 244-248 251-254 257-260 263-264 268-272 275-278 281-282 286 312-313
+ found: 245-248 251-254 257-260 263-272 275-278 281-286 309-315
+ is_root: 247-248 251-253 270-271 288 313
+ key_aux: 252-253 270
+ t.0: 253
+ t.1: 258
+ t.2: 271
+ t.3: 276
+ t.4: 293
+ t.5: 298
+ ntb:
+Linear Range:
+ this: 240-313 (cross call)
+ v_key: 240-313 (cross call)
+ current_node: 241-313 (cross call)
+ parent_node: 242-313 (cross call)
+ cont: 243-313 (cross call)
+ found: 244-315 (cross call)
+ is_root: 245-313 (cross call)
+ key_aux: 251-270
+ t.0: 252-253
+ t.1: 257-258
+ t.2: 270-271
+ t.3: 275-276
+ t.4: 292-293
+ t.5: 297-298
+Allocation:
+ this: s0
+ v_key: s1
+ current_node: s2
+ parent_node: s3
+ cont: s4
+ found: s5
+ is_root: s6
+ key_aux: t0
+ t.0: t1
+ t.1: t1
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func Tree.Remove
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 318 321-323 326 329-331 334 337-338 341-342 345-348 351 359 362
+ p_node: 318 321-323 326 329-331 334 337-338 341-342 345-348 351-353 356 359 362-364 367
+ c_node: 318 321-323 326 329-331 334 337
+ t.0: 322
+ ntb:
+ t.1: 330
+ auxkey1: 338 341-342 345-346
+ t.2: 342 345
+ auxkey2: 346
+ t.3: 347
+ t.4: 352
+ t.5: 363
+Linear Range:
+ this: 317-362 (cross call)
+ p_node: 317-367 (cross call)
+ c_node: 317-337 (cross call)
+ t.0: 321-322
+ t.1: 329-330
+ auxkey1: 337-346 (cross call)
+ t.2: 341-345
+ auxkey2: 345-346
+ t.3: 346-347
+ t.4: 351-352
+ t.5: 362-363
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ auxkey1: s2
+ t.2: t0
+ auxkey2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func Tree.RemoveRight
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 375 378-380 383 386-387 390-393 396-399 402
+ p_node: 375 378-379 393 396-399 402-404 407
+ c_node: 375 378-380 383 386-387 390-393 396-397
+ t.0: 379
+ t.1: 387 390
+ t.2: 391
+ ntb:
+ t.3: 403
+Linear Range:
+ this: 373-402 (cross call)
+ p_node: 373-407 (cross call)
+ c_node: 373-397 (cross call)
+ t.0: 378-379
+ t.1: 386-390
+ t.2: 390-391
+ t.3: 402-403
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+
+func Tree.RemoveLeft
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 412 415-417 420 423-424 427-430 433-436 439
+ p_node: 412 415-416 430 433-436 439-441 444
+ c_node: 412 415-417 420 423-424 427-430 433-434
+ t.0: 416
+ t.1: 424 427
+ t.2: 428
+ ntb:
+ t.3: 440
+Linear Range:
+ this: 410-439 (cross call)
+ p_node: 410-444 (cross call)
+ c_node: 410-434 (cross call)
+ t.0: 415-416
+ t.1: 423-427
+ t.2: 427-428
+ t.3: 439-440
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+
+func Tree.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 448
+ v_key: 448-453 456-459 462-464 467-476 479-481 484-495
+ current_node: 449-453 456-459 462-464 467-476 479-481 484-495
+ cont: 450-453 456-459 462-464 467-468 472-476 479-481 484-485 489 495
+ ifound: 452-453 456-459 462-464 467-476 479-481 484-489 492-497
+ key_aux: 457-458 474
+ t.0: 458
+ t.1: 463
+ t.2: 475
+ t.3: 480
+Linear Range:
+ this: 447-448
+ v_key: 447-495 (cross call)
+ current_node: 448-495 (cross call)
+ cont: 449-495 (cross call)
+ ifound: 450-497 (cross call)
+ key_aux: 456-474
+ t.0: 457-458
+ t.1: 462-463
+ t.2: 474-475
+ t.3: 479-480
+Allocation:
+ this: t0
+ v_key: s0
+ current_node: s1
+ cont: s2
+ ifound: s3
+ key_aux: t0
+ t.0: t1
+ t.1: t1
+ t.2: t0
+ t.3: t0
+
+func Tree.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 500-501
+ current_node: 501
+ ntb:
+Linear Range:
+ this: 499-501
+ current_node: 500-501
+Allocation:
+ this: t0
+ current_node: t1
+
+func Tree.RecPrint
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 505 508-510 513-519 522-524 527-529 532-533
+ node: 505 508-510 513-519 522-524 527-529 532
+ t.0: 509
+ t.1: 514
+ ntb:
+ t.2: 523
+ t.3: 528
+ t.4: 533
+Linear Range:
+ this: 504-533 (cross call)
+ node: 504-532 (cross call)
+ t.0: 508-509
+ t.1: 513-514
+ t.2: 522-523
+ t.3: 527-528
+ t.4: 532-533
+Allocation:
+ this: s0
+ node: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+
+func Tree.accept
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 541-542 545-547
+ v: 541-542 545-547
+ t.0: 546-547
+ nti:
+Linear Range:
+ this: 540-547
+ v: 540-547
+ t.0: 545-547
+Allocation:
+ this: t0
+ v: t1
+ t.0: t2
+
+func Visitor.visit
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 551 554-556 559-562 565-570 573-575 578-581 584
+ n: 551 554-556 559-562 565-570 573-575 578
+ t.0: 555
+ t.1: 560
+ t.2: 562 565
+ nti:
+ t.3: 574
+ t.4: 579
+ t.5: 581 584
+Linear Range:
+ this: 550-584 (cross call)
+ n: 550-578 (cross call)
+ t.0: 554-555
+ t.1: 559-560
+ t.2: 561-565
+ t.3: 573-574
+ t.4: 578-579
+ t.5: 580-584
+Allocation:
+ this: s0
+ n: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+
+func MyVisitor.visit
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 592 595-597 600-603 606-611 614-616 619-621 624-627 630
+ n: 592 595-597 600-603 606-611 614-616 619-621 624
+ t.0: 596
+ t.1: 601
+ t.2: 603 606
+ nti:
+ t.3: 615
+ t.4: 620
+ t.5: 625
+ t.6: 627 630
+Linear Range:
+ this: 591-630 (cross call)
+ n: 591-624 (cross call)
+ t.0: 595-596
+ t.1: 600-601
+ t.2: 602-606
+ t.3: 614-615
+ t.4: 619-620
+ t.5: 624-625
+ t.6: 626-630
+Allocation:
+ this: s0
+ n: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+
diff --git a/vaporize/tests/TreeVisitor.opt.vaporm b/vaporize/tests/TreeVisitor.opt.vaporm
new file mode 100644
index 0000000..0ff4fc4
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.opt.vaporm
@@ -0,0 +1,948 @@
+const empty_TV
+
+const empty_Tree
+
+const vmt_Visitor
+ :Visitor.visit
+
+const vmt_MyVisitor
+ :MyVisitor.visit
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_TV
+ call :TV.Start
+ $t0 = $v0
+ PrintIntS($t0)
+ ret
+
+func TV.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0 = HeapAllocZ(24)
+ if $s0 goto :null1
+ Error("null pointer")
+null1:
+ $a0 = $s0
+ $a1 = 16
+ call :Tree.Init
+ if $s0 goto :null2
+ Error("null pointer")
+null2:
+ $a0 = $s0
+ call :Tree.Print
+ PrintIntS(100000000)
+ if $s0 goto :null3
+ Error("null pointer")
+null3:
+ $a0 = $s0
+ $a1 = 8
+ call :Tree.Insert
+ if $s0 goto :null4
+ Error("null pointer")
+null4:
+ $a0 = $s0
+ $a1 = 24
+ call :Tree.Insert
+ if $s0 goto :null5
+ Error("null pointer")
+null5:
+ $a0 = $s0
+ $a1 = 4
+ call :Tree.Insert
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Insert
+ if $s0 goto :null7
+ Error("null pointer")
+null7:
+ $a0 = $s0
+ $a1 = 20
+ call :Tree.Insert
+ if $s0 goto :null8
+ Error("null pointer")
+null8:
+ $a0 = $s0
+ $a1 = 28
+ call :Tree.Insert
+ if $s0 goto :null9
+ Error("null pointer")
+null9:
+ $a0 = $s0
+ $a1 = 14
+ call :Tree.Insert
+ if $s0 goto :null10
+ Error("null pointer")
+null10:
+ $a0 = $s0
+ call :Tree.Print
+ PrintIntS(100000000)
+ $t0 = HeapAllocZ(12)
+ [$t0] = :vmt_MyVisitor
+ $t0 = $t0
+ PrintIntS(50000000)
+ if $s0 goto :null11
+ Error("null pointer")
+null11:
+ $a0 = $s0
+ $a1 = $t0
+ call :Tree.accept
+ PrintIntS(100000000)
+ if $s0 goto :null12
+ Error("null pointer")
+null12:
+ $a0 = $s0
+ $a1 = 24
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null13
+ Error("null pointer")
+null13:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null14
+ Error("null pointer")
+null14:
+ $a0 = $s0
+ $a1 = 16
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null15
+ Error("null pointer")
+null15:
+ $a0 = $s0
+ $a1 = 50
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null16
+ Error("null pointer")
+null16:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s0 goto :null17
+ Error("null pointer")
+null17:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Delete
+ if $s0 goto :null18
+ Error("null pointer")
+null18:
+ $a0 = $s0
+ call :Tree.Print
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $a0 = $s0
+ $a1 = 12
+ call :Tree.Search
+ $t0 = $v0
+ PrintIntS($t0)
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ [$t0+12] = 0
+ [$t0+16] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+4] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0]
+ $v0 = $t0
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+16]
+ $v0 = $t0
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+16] = $t1
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if1_else
+ $t1 = 0
+ goto :if1_end
+if1_else:
+ $t2 = LtS($t0 $t2)
+ if $t2 goto :if2_else
+ $t1 = 0
+ goto :if2_end
+if2_else:
+ $t1 = 1
+if2_end:
+if1_end:
+ $v0 = $t1
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = HeapAllocZ(24)
+ if $s2 goto :null20
+ Error("null pointer")
+null20:
+ $a0 = $s2
+ $a1 = $s1
+ call :Tree.Init
+ $s0 = $s0
+ $s3 = 1
+while1_top:
+ if0 $s3 goto :while1_end
+ if $s0 goto :null21
+ Error("null pointer")
+null21:
+ $a0 = $s0
+ call :Tree.GetKey
+ $t0 = $v0
+ $t0 = LtS($s1 $t0)
+ if0 $t0 goto :if3_else
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $a0 = $s0
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if4_else
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $a0 = $s0
+ call :Tree.GetLeft
+ $s0 = $v0
+ goto :if4_end
+if4_else:
+ $s3 = 0
+ if $s0 goto :null24
+ Error("null pointer")
+null24:
+ $a0 = $s0
+ $a1 = 1
+ call :Tree.SetHas_Left
+ if $s0 goto :null25
+ Error("null pointer")
+null25:
+ $a0 = $s0
+ $a1 = $s2
+ call :Tree.SetLeft
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $a0 = $s0
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ if $s0 goto :null27
+ Error("null pointer")
+null27:
+ $a0 = $s0
+ call :Tree.GetRight
+ $s0 = $v0
+ goto :if5_end
+if5_else:
+ $s3 = 0
+ if $s0 goto :null28
+ Error("null pointer")
+null28:
+ $a0 = $s0
+ $a1 = 1
+ call :Tree.SetHas_Right
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $a0 = $s0
+ $a1 = $s2
+ call :Tree.SetRight
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $s0
+ $s3 = $s0
+ $s4 = 1
+ $s5 = 0
+ $s6 = 1
+while2_top:
+ if0 $s4 goto :while2_end
+ if $s2 goto :null30
+ Error("null pointer")
+null30:
+ $a0 = $s2
+ call :Tree.GetKey
+ $t0 = $v0
+ $t1 = LtS($s1 $t0)
+ if0 $t1 goto :if6_else
+ if $s2 goto :null31
+ Error("null pointer")
+null31:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t1 = $v0
+ if0 $t1 goto :if7_else
+ $s3 = $s2
+ if $s2 goto :null32
+ Error("null pointer")
+null32:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $s2 = $v0
+ goto :if7_end
+if7_else:
+ $s4 = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0 = LtS($t0 $s1)
+ if0 $t0 goto :if8_else
+ if $s2 goto :null33
+ Error("null pointer")
+null33:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if9_else
+ $s3 = $s2
+ if $s2 goto :null34
+ Error("null pointer")
+null34:
+ $a0 = $s2
+ call :Tree.GetRight
+ $s2 = $v0
+ goto :if9_end
+if9_else:
+ $s4 = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6 goto :if10_else
+ if $s2 goto :null35
+ Error("null pointer")
+null35:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if $t0 goto :if11_else
+ if $s2 goto :null36
+ Error("null pointer")
+null36:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if $t0 goto :if11_else
+ goto :if11_end
+if11_else:
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call :Tree.Remove
+if11_end:
+ goto :if10_end
+if10_else:
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call :Tree.Remove
+if10_end:
+ $s5 = 1
+ $s4 = 0
+if8_end:
+if6_end:
+ $s6 = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+ if $s2 goto :null37
+ Error("null pointer")
+null37:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if12_else
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call :Tree.RemoveLeft
+ goto :if12_end
+if12_else:
+ if $s2 goto :null38
+ Error("null pointer")
+null38:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if13_else
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call :Tree.RemoveRight
+ goto :if13_end
+if13_else:
+ if $s2 goto :null39
+ Error("null pointer")
+null39:
+ $a0 = $s2
+ call :Tree.GetKey
+ $s2 = $v0
+ if $s1 goto :null40
+ Error("null pointer")
+null40:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ if $t0 goto :null41
+ Error("null pointer")
+null41:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $s2
+ $a2 = $t0
+ call :Tree.Compare
+ $t0 = $v0
+ if0 $t0 goto :if14_else
+ if $s1 goto :null42
+ Error("null pointer")
+null42:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetLeft
+ if $s1 goto :null43
+ Error("null pointer")
+null43:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Left
+ goto :if14_end
+if14_else:
+ if $s1 goto :null44
+ Error("null pointer")
+null44:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetRight
+ if $s1 goto :null45
+ Error("null pointer")
+null45:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Right
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while3_top:
+ if $s2 goto :null46
+ Error("null pointer")
+null46:
+ $a0 = $s2
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :while3_end
+ if $s2 goto :null47
+ Error("null pointer")
+null47:
+ if $s2 goto :null48
+ Error("null pointer")
+null48:
+ $a0 = $s2
+ call :Tree.GetRight
+ $t0 = $v0
+ if $t0 goto :null49
+ Error("null pointer")
+null49:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s2
+ $a1 = $t0
+ call :Tree.SetKey
+ $s1 = $s2
+ if $s2 goto :null50
+ Error("null pointer")
+null50:
+ $a0 = $s2
+ call :Tree.GetRight
+ $s2 = $v0
+ goto :while3_top
+while3_end:
+ if $s1 goto :null51
+ Error("null pointer")
+null51:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetRight
+ if $s1 goto :null52
+ Error("null pointer")
+null52:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Right
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while4_top:
+ if $s2 goto :null53
+ Error("null pointer")
+null53:
+ $a0 = $s2
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :while4_end
+ if $s2 goto :null54
+ Error("null pointer")
+null54:
+ if $s2 goto :null55
+ Error("null pointer")
+null55:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $t0 = $v0
+ if $t0 goto :null56
+ Error("null pointer")
+null56:
+ $a0 = $t0
+ call :Tree.GetKey
+ $t0 = $v0
+ $a0 = $s2
+ $a1 = $t0
+ call :Tree.SetKey
+ $s1 = $s2
+ if $s2 goto :null57
+ Error("null pointer")
+null57:
+ $a0 = $s2
+ call :Tree.GetLeft
+ $s2 = $v0
+ goto :while4_top
+while4_end:
+ if $s1 goto :null58
+ Error("null pointer")
+null58:
+ $t0 = [$s0+20]
+ $a0 = $s1
+ $a1 = $t0
+ call :Tree.SetLeft
+ if $s1 goto :null59
+ Error("null pointer")
+null59:
+ $a0 = $s1
+ $a1 = 0
+ call :Tree.SetHas_Left
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 1
+ $s3 = 0
+while5_top:
+ if0 $s2 goto :while5_end
+ if $s1 goto :null60
+ Error("null pointer")
+null60:
+ $a0 = $s1
+ call :Tree.GetKey
+ $t0 = $v0
+ $t1 = LtS($s0 $t0)
+ if0 $t1 goto :if15_else
+ if $s1 goto :null61
+ Error("null pointer")
+null61:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t1 = $v0
+ if0 $t1 goto :if16_else
+ if $s1 goto :null62
+ Error("null pointer")
+null62:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $s1 = $v0
+ goto :if16_end
+if16_else:
+ $s2 = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0 = LtS($t0 $s0)
+ if0 $t0 goto :if17_else
+ if $s1 goto :null63
+ Error("null pointer")
+null63:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if18_else
+ if $s1 goto :null64
+ Error("null pointer")
+null64:
+ $a0 = $s1
+ call :Tree.GetRight
+ $s1 = $v0
+ goto :if18_end
+if18_else:
+ $s2 = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3 = 1
+ $s2 = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $t0
+ $a0 = $t0
+ $a1 = $t1
+ call :Tree.RecPrint
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null65
+ Error("null pointer")
+null65:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if19_else
+ if $s1 goto :null66
+ Error("null pointer")
+null66:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call :Tree.RecPrint
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1 goto :null67
+ Error("null pointer")
+null67:
+ $a0 = $s1
+ call :Tree.GetKey
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s1 goto :null68
+ Error("null pointer")
+null68:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if20_else
+ if $s1 goto :null69
+ Error("null pointer")
+null69:
+ $a0 = $s1
+ call :Tree.GetRight
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call :Tree.RecPrint
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func Tree.accept [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ PrintIntS(333)
+ if $t1 goto :null70
+ Error("null pointer")
+null70:
+ $t2 = [$t1]
+ $t2 = [$t2]
+ $a0 = $t1
+ $a1 = $t0
+ call $t2
+ $v0 = 0
+ ret
+
+func Visitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null71
+ Error("null pointer")
+null71:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if21_else
+ if $s1 goto :null72
+ Error("null pointer")
+null72:
+ $a0 = $s1
+ call :Tree.GetRight
+ $t0 = $v0
+ [$s0+8] = $t0
+ $t0 = [$s0+8]
+ if $t0 goto :null73
+ Error("null pointer")
+null73:
+ $a0 = $t0
+ $a1 = $s0
+ call :Tree.accept
+ goto :if21_end
+if21_else:
+if21_end:
+ if $s1 goto :null74
+ Error("null pointer")
+null74:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if22_else
+ if $s1 goto :null75
+ Error("null pointer")
+null75:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ [$s0+4] = $t0
+ $t0 = [$s0+4]
+ if $t0 goto :null76
+ Error("null pointer")
+null76:
+ $a0 = $t0
+ $a1 = $s0
+ call :Tree.accept
+ goto :if22_end
+if22_else:
+if22_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func MyVisitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null77
+ Error("null pointer")
+null77:
+ $a0 = $s1
+ call :Tree.GetHas_Right
+ $t0 = $v0
+ if0 $t0 goto :if23_else
+ if $s1 goto :null78
+ Error("null pointer")
+null78:
+ $a0 = $s1
+ call :Tree.GetRight
+ $t0 = $v0
+ [$s0+8] = $t0
+ $t0 = [$s0+8]
+ if $t0 goto :null79
+ Error("null pointer")
+null79:
+ $a0 = $t0
+ $a1 = $s0
+ call :Tree.accept
+ goto :if23_end
+if23_else:
+if23_end:
+ if $s1 goto :null80
+ Error("null pointer")
+null80:
+ $a0 = $s1
+ call :Tree.GetKey
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s1 goto :null81
+ Error("null pointer")
+null81:
+ $a0 = $s1
+ call :Tree.GetHas_Left
+ $t0 = $v0
+ if0 $t0 goto :if24_else
+ if $s1 goto :null82
+ Error("null pointer")
+null82:
+ $a0 = $s1
+ call :Tree.GetLeft
+ $t0 = $v0
+ [$s0+4] = $t0
+ $t0 = [$s0+4]
+ if $t0 goto :null83
+ Error("null pointer")
+null83:
+ $a0 = $t0
+ $a1 = $s0
+ call :Tree.accept
+ goto :if24_end
+if24_else:
+if24_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
diff --git a/vaporize/tests/TreeVisitor.regalloc b/vaporize/tests/TreeVisitor.regalloc
new file mode 100644
index 0000000..3edb0c1
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.regalloc
@@ -0,0 +1,830 @@
+func Main
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ t.0: 37-38 41-43
+ t.1: 42-43
+ t.2: 44
+Linear Range:
+ t.0: 36-43
+ t.1: 41-43
+ t.2: 43-44
+Allocation:
+ t.0: t0
+ t.1: t1
+ t.2: t1
+
+func TV.Start
+ in 0, out 0, callee-saves 1, spills 0
+Live In:
+ this:
+ t.0: 49-50
+ root: 51 54-57 60-64 67-70 73-76 79-82 85-88 91-94 97-100 103-106 109-117 120-124 127-131 134-138 141-145 148-152 155-159 162-165 168-171 174-176
+ t.1: 55-56
+ ntb:
+ t.2: 61-62
+ t.3: 68-69
+ t.4: 74-75
+ t.5: 80-81
+ t.6: 86-87
+ t.7: 92-93
+ t.8: 98-99
+ t.9: 104-105
+ t.10: 110-111
+ t.11: 114-115
+ v: 116-117 120-122
+ t.12: 121-122
+ nti:
+ t.13: 128-129
+ t.14: 130
+ t.15: 135-136
+ t.16: 137
+ t.17: 142-143
+ t.18: 144
+ t.19: 149-150
+ t.20: 151
+ t.21: 156-157
+ t.22: 158
+ t.23: 163-164
+ t.24: 169-170
+ t.25: 175-176
+ t.26: 177
+Linear Range:
+ t.0: 48-50
+ root: 50-176 (cross call)
+ t.1: 54-56
+ t.2: 60-62
+ t.3: 67-69
+ t.4: 73-75
+ t.5: 79-81
+ t.6: 85-87
+ t.7: 91-93
+ t.8: 97-99
+ t.9: 103-105
+ t.10: 109-111
+ t.11: 113-115
+ v: 115-122
+ t.12: 120-122
+ t.13: 127-129
+ t.14: 129-130
+ t.15: 134-136
+ t.16: 136-137
+ t.17: 141-143
+ t.18: 143-144
+ t.19: 148-150
+ t.20: 150-151
+ t.21: 155-157
+ t.22: 157-158
+ t.23: 162-164
+ t.24: 168-170
+ t.25: 174-176
+ t.26: 176-177
+Allocation:
+ t.0: t0
+ root: s0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ v: t0
+ t.12: t1
+ t.13: t1
+ t.14: t1
+ t.15: t1
+ t.16: t1
+ t.17: t1
+ t.18: t1
+ t.19: t1
+ t.20: t1
+ t.21: t1
+ t.22: t1
+ t.23: t1
+ t.24: t1
+ t.25: t1
+ t.26: t1
+
+func Tree.Init
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 181-183
+ v_key: 181
+Linear Range:
+ this: 180-183
+ v_key: 180-181
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.SetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 187
+ rn: 187
+Linear Range:
+ this: 186-187
+ rn: 186-187
+Allocation:
+ this: t0
+ rn: t1
+
+func Tree.SetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 191
+ ln: 191
+Linear Range:
+ this: 190-191
+ ln: 190-191
+Allocation:
+ this: t0
+ ln: t1
+
+func Tree.GetRight
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 195
+ t.0: 196
+Linear Range:
+ this: 194-195
+ t.0: 195-196
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetLeft
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 199
+ t.0: 200
+Linear Range:
+ this: 198-199
+ t.0: 199-200
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 203
+ t.0: 204
+Linear Range:
+ this: 202-203
+ t.0: 203-204
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetKey
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 207
+ v_key: 207
+Linear Range:
+ this: 206-207
+ v_key: 206-207
+Allocation:
+ this: t0
+ v_key: t1
+
+func Tree.GetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 211
+ t.0: 212
+Linear Range:
+ this: 210-211
+ t.0: 211-212
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.GetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 215
+ t.0: 216
+Linear Range:
+ this: 214-215
+ t.0: 215-216
+Allocation:
+ this: t0
+ t.0: t0
+
+func Tree.SetHas_Left
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 219
+ val: 219
+Linear Range:
+ this: 218-219
+ val: 218-219
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.SetHas_Right
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 223
+ val: 223
+Linear Range:
+ this: 222-223
+ val: 222-223
+Allocation:
+ this: t0
+ val: t1
+
+func Tree.Compare
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this:
+ num1: 227-230 234
+ num2: 227-229
+ ntb: 232 238 243
+ nti: 229-230 234
+ t.0: 230
+ t.1: 235
+ t.2: 236
+Linear Range:
+ num1: 226-234
+ num2: 226-229
+ ntb: 231-243
+ nti: 228-234
+ t.0: 229-230
+ t.1: 234-235
+ t.2: 235-236
+Allocation:
+ num1: t0
+ num2: t1
+ ntb: t1
+ nti: t2
+ t.0: t1
+ t.1: t2
+ t.2: t2
+
+func Tree.Insert
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 246-249 252-255
+ v_key: 246-249 252-259 262-267 270-274 277-283 286-289 292-298 301-305 308-314 317-320 323-328
+ t.0: 247-248
+ new_node: 249 252-259 262-267 270-274 277-283 286-289 292-298 301-305 308-314 317-320 323-328
+ t.1: 253-254
+ ntb:
+ current_node: 256-259 262-267 270-274 277-283 286-289 292-298 301-305 308-314 317-320 323-328
+ cont: 258-259 262-267 270-274 277-280 283 286-289 292-298 301-305 308-311 314 317-320 323-328
+ t.2: 263-264
+ key_aux: 265
+ t.3: 266
+ t.4: 271-272
+ t.5: 273
+ t.6: 278-279
+ t.7: 287-288
+ t.8: 293-294
+ t.9: 302-303
+ t.10: 304
+ t.11: 309-310
+ t.12: 318-319
+ t.13: 324-325
+Linear Range:
+ this: 245-255 (cross call)
+ v_key: 245-328 (cross call)
+ t.0: 246-248
+ new_node: 248-328 (cross call)
+ t.1: 252-254
+ current_node: 255-328 (cross call)
+ cont: 256-328 (cross call)
+ t.2: 262-264
+ key_aux: 264-265
+ t.3: 265-266
+ t.4: 270-272
+ t.5: 272-273
+ t.6: 277-279
+ t.7: 286-288
+ t.8: 292-294
+ t.9: 301-303
+ t.10: 303-304
+ t.11: 308-310
+ t.12: 317-319
+ t.13: 323-325
+Allocation:
+ this: s0
+ v_key: s1
+ t.0: t0
+ new_node: s2
+ t.1: t0
+ current_node: s0
+ cont: s3
+ t.2: t0
+ key_aux: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+
+func Tree.Delete
+ in 0, out 0, callee-saves 7, spills 0
+Live In:
+ this: 333-340 343-348 351-356 359-370 373-378 381-391 394-399 402-429
+ v_key: 333-340 343-348 351-356 359-370 373-378 381-391 394-399 402-429
+ current_node: 334-340 343-348 351-356 359-370 373-378 381-391 394-399 402-429
+ parent_node: 335-340 343-348 351-354 356 359-370 373-376 378 381-391 394-399 402-429
+ cont: 336-340 343-348 351-356 359-362 366-370 373-378 381-384 388 428-429
+ found: 337-340 343-348 351-356 359-370 373-378 381-388 425-431
+ is_root: 339-340 343-347 368-369 390 429
+ t.0: 344-345
+ key_aux: 346-347 368
+ t.1: 347
+ t.2: 352-353
+ t.3: 354
+ t.4: 360-361
+ t.5: 369
+ t.6: 374-375
+ t.7: 376
+ t.8: 382-383
+ t.10: 395-396
+ t.11: 397
+ t.12: 398
+ t.13: 403-404
+ t.14: 405
+ t.9: 406 410
+ ntb:
+ t.15: 415-416
+ t.16: 421-422
+Linear Range:
+ this: 332-429 (cross call)
+ v_key: 332-429 (cross call)
+ current_node: 333-429 (cross call)
+ parent_node: 334-429 (cross call)
+ cont: 335-429 (cross call)
+ found: 336-431 (cross call)
+ is_root: 337-429 (cross call)
+ t.0: 343-345
+ key_aux: 345-368
+ t.1: 346-347
+ t.2: 351-353
+ t.3: 353-354
+ t.4: 359-361
+ t.5: 368-369
+ t.6: 373-375
+ t.7: 375-376
+ t.8: 381-383
+ t.10: 394-396
+ t.11: 396-397
+ t.12: 397-398
+ t.13: 402-404
+ t.14: 404-405
+ t.9: 405-410
+ t.15: 414-416
+ t.16: 420-422
+Allocation:
+ this: s0
+ v_key: s1
+ current_node: s2
+ parent_node: s3
+ cont: s4
+ found: s5
+ is_root: s6
+ t.0: t0
+ key_aux: t0
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t0
+ t.14: t0
+ t.9: t0
+ t.15: t0
+ t.16: t0
+
+func Tree.Remove
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 434 437-443 446 449-455 458 461-464 467-470 473-480 483-485 495 498-500
+ p_node: 434 437-443 446 449-455 458 461-464 467-470 473-480 483-487 490-492 495 498-502 505-507
+ c_node: 434 437-443 446 449-455 458 461-463
+ t.0: 438-439
+ t.1: 440
+ t.2: 442-443
+ ntb:
+ t.3: 450-451
+ t.4: 452
+ t.5: 454-455
+ t.6: 462-463
+ auxkey1: 464 467-470 473-478
+ t.7: 468-469
+ t.8: 470 473-475
+ t.9: 474-475
+ auxkey2: 476-478
+ t.10: 477-478
+ t.11: 479
+ t.12: 484-486
+ t.13: 486
+ t.14: 491-492
+ t.15: 499-501
+ t.16: 501
+ t.17: 506-507
+Linear Range:
+ this: 433-500 (cross call)
+ p_node: 433-507 (cross call)
+ c_node: 433-463 (cross call)
+ t.0: 437-439
+ t.1: 439-440
+ t.2: 441-443
+ t.3: 449-451
+ t.4: 451-452
+ t.5: 453-455
+ t.6: 461-463
+ auxkey1: 463-478 (cross call)
+ t.7: 467-469
+ t.8: 469-475
+ t.9: 473-475
+ auxkey2: 475-478
+ t.10: 476-478
+ t.11: 478-479
+ t.12: 483-486
+ t.13: 485-486
+ t.14: 490-492
+ t.15: 498-501
+ t.16: 500-501
+ t.17: 505-507
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ auxkey1: s2
+ t.7: t0
+ t.8: t0
+ t.9: t1
+ auxkey2: t1
+ t.10: t0
+ t.11: t0
+ t.12: t0
+ t.13: t1
+ t.14: t1
+ t.15: t1
+ t.16: t0
+ t.17: t0
+
+func Tree.RemoveRight
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 515 518-522 525-527 530-533 536-541 544-549 552-554
+ p_node: 515 518-521 541 544-549 552-556 559-561
+ c_node: 515 518-522 525-527 530-533 536-541 544-547
+ t.0: 519-520
+ t.1: 521
+ t.2: 526-527 530-533 536-539
+ t.3: 531-532
+ t.4: 533 536-538
+ t.5: 537-538
+ t.6: 539
+ ntb:
+ t.7: 545-546
+ t.8: 553-555
+ t.9: 555
+ t.10: 560-561
+Linear Range:
+ this: 513-554 (cross call)
+ p_node: 513-561 (cross call)
+ c_node: 513-547 (cross call)
+ t.0: 518-520
+ t.1: 520-521
+ t.2: 525-539 (cross call)
+ t.3: 530-532
+ t.4: 532-538
+ t.5: 536-538
+ t.6: 538-539
+ t.7: 544-546
+ t.8: 552-555
+ t.9: 554-555
+ t.10: 559-561
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: s3
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t0
+ t.10: t0
+
+func Tree.RemoveLeft
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 566 569-573 576-578 581-584 587-592 595-600 603-605
+ p_node: 566 569-572 592 595-600 603-607 610-612
+ c_node: 566 569-573 576-578 581-584 587-592 595-598
+ t.0: 570-571
+ t.1: 572
+ t.2: 577-578 581-584 587-590
+ t.3: 582-583
+ t.4: 584 587-589
+ t.5: 588-589
+ t.6: 590
+ ntb:
+ t.7: 596-597
+ t.8: 604-606
+ t.9: 606
+ t.10: 611-612
+Linear Range:
+ this: 564-605 (cross call)
+ p_node: 564-612 (cross call)
+ c_node: 564-598 (cross call)
+ t.0: 569-571
+ t.1: 571-572
+ t.2: 576-590 (cross call)
+ t.3: 581-583
+ t.4: 583-589
+ t.5: 587-589
+ t.6: 589-590
+ t.7: 595-597
+ t.8: 603-606
+ t.9: 605-606
+ t.10: 610-612
+Allocation:
+ this: s0
+ p_node: s1
+ c_node: s2
+ t.0: t0
+ t.1: t0
+ t.2: s3
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t0
+ t.10: t0
+
+func Tree.Search
+ in 0, out 0, callee-saves 4, spills 0
+Live In:
+ this: 616
+ v_key: 616-621 624-629 632-636 639-650 653-657 660-673
+ current_node: 617-621 624-629 632-636 639-650 653-657 660-673
+ cont: 618-621 624-629 632-636 639-642 646-650 653-657 660-663 667 673
+ ifound: 620-621 624-629 632-636 639-650 653-657 660-667 670-675
+ t.0: 625-626
+ key_aux: 627-628 648
+ t.1: 628
+ t.2: 633-634
+ t.3: 635
+ t.4: 640-641
+ t.5: 649
+ t.6: 654-655
+ t.7: 656
+ t.8: 661-662
+Linear Range:
+ this: 615-616
+ v_key: 615-673 (cross call)
+ current_node: 616-673 (cross call)
+ cont: 617-673 (cross call)
+ ifound: 618-675 (cross call)
+ t.0: 624-626
+ key_aux: 626-648
+ t.1: 627-628
+ t.2: 632-634
+ t.3: 634-635
+ t.4: 639-641
+ t.5: 648-649
+ t.6: 653-655
+ t.7: 655-656
+ t.8: 660-662
+Allocation:
+ this: t0
+ v_key: s0
+ current_node: s1
+ cont: s2
+ ifound: s3
+ t.0: t0
+ key_aux: t0
+ t.1: t1
+ t.2: t1
+ t.3: t1
+ t.4: t1
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+
+func Tree.Print
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 678-681
+ current_node: 679-681
+ t.0: 680-681
+ ntb:
+Linear Range:
+ this: 677-681
+ current_node: 678-681
+ t.0: 679-681
+Allocation:
+ this: t0
+ current_node: t1
+ t.0: t2
+
+func Tree.RecPrint
+ in 0, out 0, callee-saves 3, spills 0
+Live In:
+ this: 685 688-694 697-705 708-712 715-721 724-727
+ node: 685 688-694 697-705 708-712 715-721 724-726
+ t.0: 689-690
+ t.1: 691
+ t.2: 693-694 697-700
+ t.3: 698-699
+ t.4: 700
+ ntb:
+ t.5: 709-710
+ t.6: 711
+ t.7: 716-717
+ t.8: 718
+ t.9: 720-721 724-727
+ t.10: 725-726
+ t.11: 727
+Linear Range:
+ this: 684-727 (cross call)
+ node: 684-726 (cross call)
+ t.0: 688-690
+ t.1: 690-691
+ t.2: 692-700 (cross call)
+ t.3: 697-699
+ t.4: 699-700
+ t.5: 708-710
+ t.6: 710-711
+ t.7: 715-717
+ t.8: 717-718
+ t.9: 719-727 (cross call)
+ t.10: 724-726
+ t.11: 726-727
+Allocation:
+ this: s0
+ node: s1
+ t.0: t0
+ t.1: t0
+ t.2: s2
+ t.3: t0
+ t.4: t0
+ t.5: t0
+ t.6: t0
+ t.7: t0
+ t.8: t0
+ t.9: s2
+ t.10: t0
+ t.11: t0
+
+func Tree.accept
+ in 0, out 0, callee-saves 0, spills 0
+Live In:
+ this: 735-736 739-741
+ v: 735-736 739-741
+ t.0: 740-741
+ nti:
+Linear Range:
+ this: 734-741
+ v: 734-741
+ t.0: 739-741
+Allocation:
+ this: t0
+ v: t1
+ t.0: t2
+
+func Visitor.visit
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 745 748-752 755-760 763-770 773-777 780-785 788-790
+ n: 745 748-752 755-760 763-770 773-777 780-782
+ t.0: 749-750
+ t.1: 751
+ t.2: 756-757
+ t.3: 758
+ t.4: 760 763-765
+ t.5: 764-765
+ nti:
+ t.6: 774-775
+ t.7: 776
+ t.8: 781-782
+ t.9: 783
+ t.10: 785 788-790
+ t.11: 789-790
+Linear Range:
+ this: 744-790 (cross call)
+ n: 744-782 (cross call)
+ t.0: 748-750
+ t.1: 750-751
+ t.2: 755-757
+ t.3: 757-758
+ t.4: 759-765
+ t.5: 763-765
+ t.6: 773-775
+ t.7: 775-776
+ t.8: 780-782
+ t.9: 782-783
+ t.10: 784-790
+ t.11: 788-790
+Allocation:
+ this: s0
+ n: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t1
+ t.10: t1
+ t.11: t0
+
+func MyVisitor.visit
+ in 0, out 0, callee-saves 2, spills 0
+Live In:
+ this: 798 801-805 808-813 816-823 826-830 833-837 840-845 848-850
+ n: 798 801-805 808-813 816-823 826-830 833-837 840-842
+ t.0: 802-803
+ t.1: 804
+ t.2: 809-810
+ t.3: 811
+ t.4: 813 816-818
+ t.5: 817-818
+ nti:
+ t.6: 827-828
+ t.7: 829
+ t.8: 834-835
+ t.9: 836
+ t.10: 841-842
+ t.11: 843
+ t.12: 845 848-850
+ t.13: 849-850
+Linear Range:
+ this: 797-850 (cross call)
+ n: 797-842 (cross call)
+ t.0: 801-803
+ t.1: 803-804
+ t.2: 808-810
+ t.3: 810-811
+ t.4: 812-818
+ t.5: 816-818
+ t.6: 826-828
+ t.7: 828-829
+ t.8: 833-835
+ t.9: 835-836
+ t.10: 840-842
+ t.11: 842-843
+ t.12: 844-850
+ t.13: 848-850
+Allocation:
+ this: s0
+ n: s1
+ t.0: t0
+ t.1: t0
+ t.2: t0
+ t.3: t0
+ t.4: t0
+ t.5: t1
+ t.6: t1
+ t.7: t1
+ t.8: t1
+ t.9: t1
+ t.10: t1
+ t.11: t1
+ t.12: t1
+ t.13: t0
+
diff --git a/vaporize/tests/TreeVisitor.vaporm b/vaporize/tests/TreeVisitor.vaporm
new file mode 100644
index 0000000..392cf0c
--- /dev/null
+++ b/vaporize/tests/TreeVisitor.vaporm
@@ -0,0 +1,1174 @@
+const vmt_TV
+ :TV.Start
+
+const vmt_Tree
+ :Tree.Init
+ :Tree.SetRight
+ :Tree.SetLeft
+ :Tree.GetRight
+ :Tree.GetLeft
+ :Tree.GetKey
+ :Tree.SetKey
+ :Tree.GetHas_Right
+ :Tree.GetHas_Left
+ :Tree.SetHas_Left
+ :Tree.SetHas_Right
+ :Tree.Compare
+ :Tree.Insert
+ :Tree.Delete
+ :Tree.Remove
+ :Tree.RemoveRight
+ :Tree.RemoveLeft
+ :Tree.Search
+ :Tree.Print
+ :Tree.RecPrint
+ :Tree.accept
+
+const vmt_Visitor
+ :Visitor.visit
+
+const vmt_MyVisitor
+ :MyVisitor.visit
+
+func Main [in 0, out 0, local 0]
+ $t0 = HeapAllocZ(4)
+ [$t0] = :vmt_TV
+ if $t0 goto :null1
+ Error("null pointer")
+null1:
+ $t1 = [$t0]
+ $t1 = [$t1]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ ret
+
+func TV.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0 = HeapAllocZ(28)
+ [$t0] = :vmt_Tree
+ $s0 = $t0
+ if $s0 goto :null2
+ Error("null pointer")
+null2:
+ $t0 = [$s0]
+ $t0 = [$t0]
+ $a0 = $s0
+ $a1 = 16
+ call $t0
+ if $s0 goto :null3
+ Error("null pointer")
+null3:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ PrintIntS(100000000)
+ if $s0 goto :null4
+ Error("null pointer")
+null4:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 8
+ call $t0
+ if $s0 goto :null5
+ Error("null pointer")
+null5:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 24
+ call $t0
+ if $s0 goto :null6
+ Error("null pointer")
+null6:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 4
+ call $t0
+ if $s0 goto :null7
+ Error("null pointer")
+null7:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 12
+ call $t0
+ if $s0 goto :null8
+ Error("null pointer")
+null8:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 20
+ call $t0
+ if $s0 goto :null9
+ Error("null pointer")
+null9:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 28
+ call $t0
+ if $s0 goto :null10
+ Error("null pointer")
+null10:
+ $t0 = [$s0]
+ $t0 = [$t0+48]
+ $a0 = $s0
+ $a1 = 14
+ call $t0
+ if $s0 goto :null11
+ Error("null pointer")
+null11:
+ $t0 = [$s0]
+ $t0 = [$t0+72]
+ $a0 = $s0
+ call $t0
+ PrintIntS(100000000)
+ $t0 = HeapAllocZ(12)
+ [$t0] = :vmt_MyVisitor
+ $t0 = $t0
+ PrintIntS(50000000)
+ if $s0 goto :null12
+ Error("null pointer")
+null12:
+ $t1 = [$s0]
+ $t1 = [$t1+80]
+ $a0 = $s0
+ $a1 = $t0
+ call $t1
+ PrintIntS(100000000)
+ if $s0 goto :null13
+ Error("null pointer")
+null13:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 24
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null14
+ Error("null pointer")
+null14:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null15
+ Error("null pointer")
+null15:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 16
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null16
+ Error("null pointer")
+null16:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 50
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null17
+ Error("null pointer")
+null17:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s0 goto :null18
+ Error("null pointer")
+null18:
+ $t1 = [$s0]
+ $t1 = [$t1+52]
+ $a0 = $s0
+ $a1 = 12
+ call $t1
+ if $s0 goto :null19
+ Error("null pointer")
+null19:
+ $t1 = [$s0]
+ $t1 = [$t1+72]
+ $a0 = $s0
+ call $t1
+ if $s0 goto :null20
+ Error("null pointer")
+null20:
+ $t1 = [$s0]
+ $t1 = [$t1+68]
+ $a0 = $s0
+ $a1 = 12
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func Tree.Init [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ [$t0+16] = 0
+ [$t0+20] = 0
+ $v0 = 1
+ ret
+
+func Tree.SetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+8] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+4] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetRight [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+8]
+ $v0 = $t0
+ ret
+
+func Tree.GetLeft [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+4]
+ $v0 = $t0
+ ret
+
+func Tree.GetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+12]
+ $v0 = $t0
+ ret
+
+func Tree.SetKey [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+12] = $t1
+ $v0 = 1
+ ret
+
+func Tree.GetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+20]
+ $v0 = $t0
+ ret
+
+func Tree.GetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t0 = [$t0+16]
+ $v0 = $t0
+ ret
+
+func Tree.SetHas_Left [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+16] = $t1
+ $v0 = 1
+ ret
+
+func Tree.SetHas_Right [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ [$t0+20] = $t1
+ $v0 = 1
+ ret
+
+func Tree.Compare [in 0, out 0, local 0]
+ $t0 = $a1
+ $t1 = $a2
+ $t2 = Add($t1 1)
+ $t1 = LtS($t0 $t1)
+ if0 $t1 goto :if1_else
+ $t1 = 0
+ goto :if1_end
+if1_else:
+ $t2 = LtS($t0 $t2)
+ $t2 = Sub(1 $t2)
+ if0 $t2 goto :if2_else
+ $t1 = 0
+ goto :if2_end
+if2_else:
+ $t1 = 1
+if2_end:
+if1_end:
+ $v0 = $t1
+ ret
+
+func Tree.Insert [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $t0 = HeapAllocZ(28)
+ [$t0] = :vmt_Tree
+ $s2 = $t0
+ if $s2 goto :null21
+ Error("null pointer")
+null21:
+ $t0 = [$s2]
+ $t0 = [$t0]
+ $a0 = $s2
+ $a1 = $s1
+ call $t0
+ $s0 = $s0
+ $s3 = 1
+while1_top:
+ if0 $s3 goto :while1_end
+ if $s0 goto :null22
+ Error("null pointer")
+null22:
+ $t0 = [$s0]
+ $t0 = [$t0+20]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ $t0 = LtS($s1 $t0)
+ if0 $t0 goto :if3_else
+ if $s0 goto :null23
+ Error("null pointer")
+null23:
+ $t0 = [$s0]
+ $t0 = [$t0+32]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if4_else
+ if $s0 goto :null24
+ Error("null pointer")
+null24:
+ $t0 = [$s0]
+ $t0 = [$t0+16]
+ $a0 = $s0
+ call $t0
+ $s0 = $v0
+ goto :if4_end
+if4_else:
+ $s3 = 0
+ if $s0 goto :null25
+ Error("null pointer")
+null25:
+ $t0 = [$s0]
+ $t0 = [$t0+36]
+ $a0 = $s0
+ $a1 = 1
+ call $t0
+ if $s0 goto :null26
+ Error("null pointer")
+null26:
+ $t0 = [$s0]
+ $t0 = [$t0+8]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+if4_end:
+ goto :if3_end
+if3_else:
+ if $s0 goto :null27
+ Error("null pointer")
+null27:
+ $t0 = [$s0]
+ $t0 = [$t0+28]
+ $a0 = $s0
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if5_else
+ if $s0 goto :null28
+ Error("null pointer")
+null28:
+ $t0 = [$s0]
+ $t0 = [$t0+12]
+ $a0 = $s0
+ call $t0
+ $s0 = $v0
+ goto :if5_end
+if5_else:
+ $s3 = 0
+ if $s0 goto :null29
+ Error("null pointer")
+null29:
+ $t0 = [$s0]
+ $t0 = [$t0+40]
+ $a0 = $s0
+ $a1 = 1
+ call $t0
+ if $s0 goto :null30
+ Error("null pointer")
+null30:
+ $t0 = [$s0]
+ $t0 = [$t0+4]
+ $a0 = $s0
+ $a1 = $s2
+ call $t0
+if5_end:
+if3_end:
+ goto :while1_top
+while1_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Delete [in 0, out 0, local 7]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $s0
+ $s3 = $s0
+ $s4 = 1
+ $s5 = 0
+ $s6 = 1
+while2_top:
+ if0 $s4 goto :while2_end
+ if $s2 goto :null31
+ Error("null pointer")
+null31:
+ $t0 = [$s2]
+ $t0 = [$t0+20]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t1 = LtS($s1 $t0)
+ if0 $t1 goto :if6_else
+ if $s2 goto :null32
+ Error("null pointer")
+null32:
+ $t1 = [$s2]
+ $t1 = [$t1+32]
+ $a0 = $s2
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if7_else
+ $s3 = $s2
+ if $s2 goto :null33
+ Error("null pointer")
+null33:
+ $t1 = [$s2]
+ $t1 = [$t1+16]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :if7_end
+if7_else:
+ $s4 = 0
+if7_end:
+ goto :if6_end
+if6_else:
+ $t0 = LtS($t0 $s1)
+ if0 $t0 goto :if8_else
+ if $s2 goto :null34
+ Error("null pointer")
+null34:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if9_else
+ $s3 = $s2
+ if $s2 goto :null35
+ Error("null pointer")
+null35:
+ $t0 = [$s2]
+ $t0 = [$t0+12]
+ $a0 = $s2
+ call $t0
+ $s2 = $v0
+ goto :if9_end
+if9_else:
+ $s4 = 0
+if9_end:
+ goto :if8_end
+if8_else:
+ if0 $s6 goto :if10_else
+ if $s2 goto :null36
+ Error("null pointer")
+null36:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ if0 $t0 goto :ss1_else
+ if $s2 goto :null37
+ Error("null pointer")
+null37:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ $t0 = Sub(1 $t0)
+ goto :ss1_end
+ss1_else:
+ $t0 = 0
+ss1_end:
+ if0 $t0 goto :if11_else
+ goto :if11_end
+if11_else:
+ $t0 = [$s0]
+ $t0 = [$t0+56]
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call $t0
+if11_end:
+ goto :if10_end
+if10_else:
+ $t0 = [$s0]
+ $t0 = [$t0+56]
+ $a0 = $s0
+ $a1 = $s3
+ $a2 = $s2
+ call $t0
+if10_end:
+ $s5 = 1
+ $s4 = 0
+if8_end:
+if6_end:
+ $s6 = 0
+ goto :while2_top
+while2_end:
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ ret
+
+func Tree.Remove [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+ if $s2 goto :null38
+ Error("null pointer")
+null38:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if12_else
+ $t0 = [$s0]
+ $t0 = [$t0+64]
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call $t0
+ goto :if12_end
+if12_else:
+ if $s2 goto :null39
+ Error("null pointer")
+null39:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if13_else
+ $t0 = [$s0]
+ $t0 = [$t0+60]
+ $a0 = $s0
+ $a1 = $s1
+ $a2 = $s2
+ call $t0
+ goto :if13_end
+if13_else:
+ if $s2 goto :null40
+ Error("null pointer")
+null40:
+ $t0 = [$s2]
+ $t0 = [$t0+20]
+ $a0 = $s2
+ call $t0
+ $s2 = $v0
+ if $s1 goto :null41
+ Error("null pointer")
+null41:
+ $t0 = [$s1]
+ $t0 = [$t0+16]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null42
+ Error("null pointer")
+null42:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $t0 = [$s0]
+ $t0 = [$t0+44]
+ $a0 = $s0
+ $a1 = $s2
+ $a2 = $t1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if14_else
+ if $s1 goto :null43
+ Error("null pointer")
+null43:
+ $t0 = [$s1]
+ $t0 = [$t0+8]
+ $t1 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t1
+ call $t0
+ if $s1 goto :null44
+ Error("null pointer")
+null44:
+ $t1 = [$s1]
+ $t1 = [$t1+36]
+ $a0 = $s1
+ $a1 = 0
+ call $t1
+ goto :if14_end
+if14_else:
+ if $s1 goto :null45
+ Error("null pointer")
+null45:
+ $t1 = [$s1]
+ $t1 = [$t1+4]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null46
+ Error("null pointer")
+null46:
+ $t0 = [$s1]
+ $t0 = [$t0+40]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+if14_end:
+if13_end:
+if12_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.RemoveRight [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while3_top:
+ if $s2 goto :null47
+ Error("null pointer")
+null47:
+ $t0 = [$s2]
+ $t0 = [$t0+28]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :while3_end
+ if $s2 goto :null48
+ Error("null pointer")
+null48:
+ $s3 = [$s2]
+ $s3 = [$s3+24]
+ if $s2 goto :null49
+ Error("null pointer")
+null49:
+ $t0 = [$s2]
+ $t0 = [$t0+12]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null50
+ Error("null pointer")
+null50:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $a0 = $s2
+ $a1 = $t1
+ call $s3
+ $s1 = $s2
+ if $s2 goto :null51
+ Error("null pointer")
+null51:
+ $t1 = [$s2]
+ $t1 = [$t1+12]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :while3_top
+while3_end:
+ if $s1 goto :null52
+ Error("null pointer")
+null52:
+ $t1 = [$s1]
+ $t1 = [$t1+4]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null53
+ Error("null pointer")
+null53:
+ $t0 = [$s1]
+ $t0 = [$t0+40]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.RemoveLeft [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $s0 = $a0
+ $s1 = $a1
+ $s2 = $a2
+while4_top:
+ if $s2 goto :null54
+ Error("null pointer")
+null54:
+ $t0 = [$s2]
+ $t0 = [$t0+32]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :while4_end
+ if $s2 goto :null55
+ Error("null pointer")
+null55:
+ $s3 = [$s2]
+ $s3 = [$s3+24]
+ if $s2 goto :null56
+ Error("null pointer")
+null56:
+ $t0 = [$s2]
+ $t0 = [$t0+16]
+ $a0 = $s2
+ call $t0
+ $t0 = $v0
+ if $t0 goto :null57
+ Error("null pointer")
+null57:
+ $t1 = [$t0]
+ $t1 = [$t1+20]
+ $a0 = $t0
+ call $t1
+ $t1 = $v0
+ $a0 = $s2
+ $a1 = $t1
+ call $s3
+ $s1 = $s2
+ if $s2 goto :null58
+ Error("null pointer")
+null58:
+ $t1 = [$s2]
+ $t1 = [$t1+16]
+ $a0 = $s2
+ call $t1
+ $s2 = $v0
+ goto :while4_top
+while4_end:
+ if $s1 goto :null59
+ Error("null pointer")
+null59:
+ $t1 = [$s1]
+ $t1 = [$t1+8]
+ $t0 = [$s0+24]
+ $a0 = $s1
+ $a1 = $t0
+ call $t1
+ if $s1 goto :null60
+ Error("null pointer")
+null60:
+ $t0 = [$s1]
+ $t0 = [$t0+36]
+ $a0 = $s1
+ $a1 = 0
+ call $t0
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Search [in 0, out 0, local 4]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ $t0 = $a0
+ $s0 = $a1
+ $s1 = $t0
+ $s2 = 1
+ $s3 = 0
+while5_top:
+ if0 $s2 goto :while5_end
+ if $s1 goto :null61
+ Error("null pointer")
+null61:
+ $t0 = [$s1]
+ $t0 = [$t0+20]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $t1 = LtS($s0 $t0)
+ if0 $t1 goto :if15_else
+ if $s1 goto :null62
+ Error("null pointer")
+null62:
+ $t1 = [$s1]
+ $t1 = [$t1+32]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if16_else
+ if $s1 goto :null63
+ Error("null pointer")
+null63:
+ $t1 = [$s1]
+ $t1 = [$t1+16]
+ $a0 = $s1
+ call $t1
+ $s1 = $v0
+ goto :if16_end
+if16_else:
+ $s2 = 0
+if16_end:
+ goto :if15_end
+if15_else:
+ $t0 = LtS($t0 $s0)
+ if0 $t0 goto :if17_else
+ if $s1 goto :null64
+ Error("null pointer")
+null64:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if18_else
+ if $s1 goto :null65
+ Error("null pointer")
+null65:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $s1 = $v0
+ goto :if18_end
+if18_else:
+ $s2 = 0
+if18_end:
+ goto :if17_end
+if17_else:
+ $s3 = 1
+ $s2 = 0
+if17_end:
+if15_end:
+ goto :while5_top
+while5_end:
+ $v0 = $s3
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ ret
+
+func Tree.Print [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $t0
+ $t2 = [$t0]
+ $t2 = [$t2+76]
+ $a0 = $t0
+ $a1 = $t1
+ call $t2
+ $v0 = 1
+ ret
+
+func Tree.RecPrint [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null66
+ Error("null pointer")
+null66:
+ $t0 = [$s1]
+ $t0 = [$t0+32]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if19_else
+ $s2 = [$s0]
+ $s2 = [$s2+76]
+ if $s1 goto :null67
+ Error("null pointer")
+null67:
+ $t0 = [$s1]
+ $t0 = [$t0+16]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call $s2
+ goto :if19_end
+if19_else:
+if19_end:
+ if $s1 goto :null68
+ Error("null pointer")
+null68:
+ $t0 = [$s1]
+ $t0 = [$t0+20]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ PrintIntS($t0)
+ if $s1 goto :null69
+ Error("null pointer")
+null69:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if20_else
+ $s2 = [$s0]
+ $s2 = [$s2+76]
+ if $s1 goto :null70
+ Error("null pointer")
+null70:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ $a0 = $s0
+ $a1 = $t0
+ call $s2
+ goto :if20_end
+if20_else:
+if20_end:
+ $v0 = 1
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func Tree.accept [in 0, out 0, local 0]
+ $t0 = $a0
+ $t1 = $a1
+ PrintIntS(333)
+ if $t1 goto :null71
+ Error("null pointer")
+null71:
+ $t2 = [$t1]
+ $t2 = [$t2]
+ $a0 = $t1
+ $a1 = $t0
+ call $t2
+ $v0 = 0
+ ret
+
+func Visitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null72
+ Error("null pointer")
+null72:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if21_else
+ if $s1 goto :null73
+ Error("null pointer")
+null73:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ [$s0+8] = $t0
+ $t0 = [$s0+8]
+ if $t0 goto :null74
+ Error("null pointer")
+null74:
+ $t1 = [$t0]
+ $t1 = [$t1+80]
+ $a0 = $t0
+ $a1 = $s0
+ call $t1
+ goto :if21_end
+if21_else:
+if21_end:
+ if $s1 goto :null75
+ Error("null pointer")
+null75:
+ $t1 = [$s1]
+ $t1 = [$t1+32]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if22_else
+ if $s1 goto :null76
+ Error("null pointer")
+null76:
+ $t1 = [$s1]
+ $t1 = [$t1+16]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ [$s0+4] = $t1
+ $t1 = [$s0+4]
+ if $t1 goto :null77
+ Error("null pointer")
+null77:
+ $t0 = [$t1]
+ $t0 = [$t0+80]
+ $a0 = $t1
+ $a1 = $s0
+ call $t0
+ goto :if22_end
+if22_else:
+if22_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+
+func MyVisitor.visit [in 0, out 0, local 2]
+ local[0] = $s0
+ local[1] = $s1
+ $s0 = $a0
+ $s1 = $a1
+ if $s1 goto :null78
+ Error("null pointer")
+null78:
+ $t0 = [$s1]
+ $t0 = [$t0+28]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ if0 $t0 goto :if23_else
+ if $s1 goto :null79
+ Error("null pointer")
+null79:
+ $t0 = [$s1]
+ $t0 = [$t0+12]
+ $a0 = $s1
+ call $t0
+ $t0 = $v0
+ [$s0+8] = $t0
+ $t0 = [$s0+8]
+ if $t0 goto :null80
+ Error("null pointer")
+null80:
+ $t1 = [$t0]
+ $t1 = [$t1+80]
+ $a0 = $t0
+ $a1 = $s0
+ call $t1
+ goto :if23_end
+if23_else:
+if23_end:
+ if $s1 goto :null81
+ Error("null pointer")
+null81:
+ $t1 = [$s1]
+ $t1 = [$t1+20]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ PrintIntS($t1)
+ if $s1 goto :null82
+ Error("null pointer")
+null82:
+ $t1 = [$s1]
+ $t1 = [$t1+32]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ if0 $t1 goto :if24_else
+ if $s1 goto :null83
+ Error("null pointer")
+null83:
+ $t1 = [$s1]
+ $t1 = [$t1+16]
+ $a0 = $s1
+ call $t1
+ $t1 = $v0
+ [$s0+4] = $t1
+ $t1 = [$s0+4]
+ if $t1 goto :null84
+ Error("null pointer")
+null84:
+ $t0 = [$t1]
+ $t0 = [$t0+80]
+ $a0 = $t1
+ $a1 = $s0
+ call $t0
+ goto :if24_end
+if24_else:
+if24_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ ret
+