diff options
Diffstat (limited to 'vaporize/tests/QuickSort.opt.vaporm')
-rw-r--r-- | vaporize/tests/QuickSort.opt.vaporm | 418 |
1 files changed, 0 insertions, 418 deletions
diff --git a/vaporize/tests/QuickSort.opt.vaporm b/vaporize/tests/QuickSort.opt.vaporm deleted file mode 100644 index 61f1151..0000000 --- a/vaporize/tests/QuickSort.opt.vaporm +++ /dev/null @@ -1,418 +0,0 @@ -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 - |