source: Deliverables/D2.2/8051/tests/tmp_tests/Frontend/quicksort.RTLabs @ 1525

Last change on this file since 1525 was 1525, checked in by ayache, 9 years ago

D2.2: function pointers using JMP.

File size: 10.4 KB
Line 
1program:
2
3
4  globals:
5
6
7  extern "print_sint": int4s -> void
8
9
10  extern "newline": void
11
12
13  extern "space": void
14
15
16  "swap"(ptr %0, int4s %1, int4s %2)
17    locals: int4s %3, ptr %5, int4s %6, int4s %7, ptr %8, int4s %9, ptr %10, int4s %11, int4s %12, int4s %13, int4s %14, ptr %15, int4s %16, int4s %17
18    result: void %4
19    stacksize: struct {}
20    entry: swap17
21    exit: swap0
22
23    swap9: imm %12, imm_sizeof (int32) --> swap8
24    swap8: mul %11, %2, %12 --> swap7
25    swap7: addp %10, %0, %11 --> swap6
26    swap6: load int32, %10, %9 --> swap5
27    swap5: store int32, %8, %9 --> swap4
28    swap4: imm %7, imm_sizeof (int32) --> swap3
29    swap3: mul %6, %2, %7 --> swap2
30    swap2: addp %5, %0, %6 --> swap1
31    swap17: emit _cost0 --> swap16
32    swap16: imm %17, imm_sizeof (int32) --> swap15
33    swap15: mul %16, %1, %17 --> swap14
34    swap14: addp %15, %0, %16 --> swap13
35    swap13: load int32, %15, %3 --> swap12
36    swap12: imm %14, imm_sizeof (int32) --> swap11
37    swap11: mul %13, %1, %14 --> swap10
38    swap10: addp %8, %0, %13 --> swap9
39    swap1: store int32, %5, %3 --> swap0
40    swap0: return
41
42
43  "partition"(ptr %0, int4s %1, int4s %2)
44    locals: int4s %3, int4s %4, int4s %5, int1u %7, int1u %8, int4s %9, int4s %10, int4s %11, int4s %12, ptr %13, int4s %14, int4s %15, int4s %16, int4s %17, int4s %18, int4s %19, int4s %20, int4s %21, ptr %22, int4s %23, int4s %24, int4s %25, int1s %26, int1s %27, int4s %28, ptr %29, int4s %30, int4s %31
45    result: int4s %6
46    stacksize: struct {}
47    entry: partition55
48    exit: partition0
49
50    partition9: ge %9, %3, %4 --> partition8
51    partition8: %9? --> partition7, partition6
52    partition7: emit _cost1 --> partition3
53    partition6: emit _cost2 --> partition5
54    partition55: emit _cost13 --> partition54
55    partition54: imm %31, imm_sizeof (int32) --> partition53
56    partition53: mul %30, %1, %31 --> partition52
57    partition52: addp %29, %0, %30 --> partition51
58    partition51: load int32, %29, %5 --> partition50
59    partition50: id %3, %1 --> partition49
60    partition5: call "swap", [%0, %3, %4], %8: ptr -> int4s -> int4s -> void --> partition4
61    partition49: imm %28, imm_int 1 --> partition48
62    partition48: add %4, %2, %28 --> partition4
63    partition47: imm %27, imm_int 1 --> partition46
64    partition46: notbool %26, %27 --> partition45
65    partition45: %26? --> partition3, partition44
66    partition44: emit _cost11 --> partition23
67    partition43: le %25, %3, %2 --> partition42
68    partition42: %25? --> partition41, partition30
69    partition41: emit _cost8 --> partition40
70    partition40: imm %24, imm_sizeof (int32) --> partition39
71    partition4: --> partition47
72    partition39: mul %23, %3, %24 --> partition38
73    partition38: addp %22, %0, %23 --> partition37
74    partition37: load int32, %22, %21 --> partition36
75    partition36: le %20, %21, %5 --> partition35
76    partition35: %20? --> partition34, partition32
77    partition34: emit _cost6 --> partition33
78    partition33: imm %19, imm_int 1 --> partition28
79    partition32: emit _cost7 --> partition31
80    partition31: imm %19, imm_int 0 --> partition28
81    partition30: emit _cost9 --> partition29
82    partition3: emit _cost12 --> partition2
83    partition29: imm %19, imm_int 0 --> partition28
84    partition28: notbool %18, %19 --> partition27
85    partition27: %18? --> partition22, partition26
86    partition26: emit _cost5 --> partition25
87    partition25: imm %17, imm_int 1 --> partition24
88    partition24: add %3, %3, %17 --> partition23
89    partition23: --> partition43
90    partition22: emit _cost10 --> partition11
91    partition21: emit _cost3 --> partition20
92    partition20: imm %16, imm_int 1 --> partition19
93    partition2: call "swap", [%0, %1, %4], %7: ptr -> int4s -> int4s -> void --> partition1
94    partition19: sub %4, %4, %16 --> partition18
95    partition18: imm %15, imm_sizeof (int32) --> partition17
96    partition17: mul %14, %4, %15 --> partition16
97    partition16: addp %13, %0, %14 --> partition15
98    partition15: load int32, %13, %12 --> partition14
99    partition14: gt %11, %12, %5 --> partition13
100    partition13: notbool %10, %11 --> partition12
101    partition12: %10? --> partition10, partition11
102    partition11: --> partition21
103    partition10: emit _cost4 --> partition9
104    partition1: id %6, %4 --> partition0
105    partition0: return %6
106
107
108  "quicksort"(ptr %0, int4s %1, int4s %2)
109    locals: int4s %3, int4s %4, int4s %6, int1u %7, int4s %8, int4s %9, int1u %10, int4s %11, int4s %12
110    result: void %5
111    stacksize: struct {}
112    entry: quicksort13
113    exit: quicksort0
114
115    quicksort9: call "partition", [%0, %1, %2], %4: ptr -> int4s -> int4s -> int4s --> quicksort8
116    quicksort8: id %3, %4 --> quicksort7
117    quicksort7: imm %11, imm_int 1 --> quicksort6
118    quicksort6: sub %9, %3, %11 --> quicksort5
119    quicksort5: call "quicksort", [%0, %1, %9], %10: ptr -> int4s -> int4s -> void --> quicksort4
120    quicksort4: imm %8, imm_int 1 --> quicksort3
121    quicksort3: add %6, %3, %8 --> quicksort2
122    quicksort2: call "quicksort", [%0, %6, %2], %7: ptr -> int4s -> int4s -> void --> quicksort0
123    quicksort13: emit _cost16 --> quicksort12
124    quicksort12: lt %12, %1, %2 --> quicksort11
125    quicksort11: %12? --> quicksort10, quicksort1
126    quicksort10: emit _cost14 --> quicksort9
127    quicksort1: emit _cost15 --> quicksort0
128    quicksort0: return
129
130
131  "print_tab"(ptr %0, int4s %1)
132    locals: int4s %2, int1u %4, int4s %5, int1u %6, int4s %7, int1u %8, ptr %9, int4s %10, int4s %11, int4s %12, int4s %13, int1s %14
133    result: void %3
134    stacksize: struct {}
135    entry: print_tab18
136    exit: print_tab0
137
138    print_tab9: addp %9, %0, %10 --> print_tab8
139    print_tab8: load int32, %9, %7 --> print_tab7
140    print_tab7: call "print_sint", [%7], %8: int4s -> void --> print_tab6
141    print_tab6: call "space", [], %6: void --> print_tab5
142    print_tab5: imm %5, imm_int 1 --> print_tab4
143    print_tab4: add %2, %2, %5 --> print_tab3
144    print_tab3: --> print_tab15
145    print_tab2: emit _cost18 --> print_tab1
146    print_tab18: emit _cost19 --> print_tab17
147    print_tab17: imm %14, imm_int 0 --> print_tab16
148    print_tab16: int1sto4 %2, %14 --> print_tab3
149    print_tab15: lt %13, %2, %1 --> print_tab14
150    print_tab14: notbool %12, %13 --> print_tab13
151    print_tab13: %12? --> print_tab2, print_tab12
152    print_tab12: emit _cost17 --> print_tab11
153    print_tab11: imm %11, imm_sizeof (int32) --> print_tab10
154    print_tab10: mul %10, %2, %11 --> print_tab9
155    print_tab1: call "newline", [], %4: void --> print_tab0
156    print_tab0: return
157
158
159  "main"()
160    locals: int1s %1, ptr %2, int4s %3, int1u %4, int1s %5, ptr %6, offset %7, ptr %8, int4s %9, int4s %10, int1u %11, int1s %12, int1s %13, int1s %14, int1s %15, ptr %16, offset %17, ptr %18, int4s %19, int1s %20, ptr %21, int1s %22, int1s %23, int1s %24, ptr %25, offset %26, ptr %27, int4s %28, int1s %29, int1s %30, ptr %31, int1s %32, int1s %33, int1s %34, ptr %35, offset %36, ptr %37, int4s %38, int1s %39, ptr %40, int1s %41, int1s %42, int1s %43, ptr %44, offset %45, ptr %46, int4s %47, int1s %48, int1s %49, ptr %50, int1s %51, int1s %52, int1s %53, ptr %54, offset %55, ptr %56, int4s %57, int1s %58, ptr %59, int1s %60, int1s %61, int1s %62, ptr %63, offset %64
161    result: int4s %0
162    stacksize: struct {int32[5]}
163    entry: main71
164    exit: main0
165
166    main9: call "quicksort", [%8, %9, %10], %11: ptr -> int4s -> int4s -> void --> main8
167    main8: imm %6, imm_addr STACK --> main7
168    main71: emit _cost20 --> main70
169    main70: imm %63, imm_addr STACK --> main69
170    main7: imm %7, imm_offset { struct {int32[5]}, 0 } --> main6
171    main69: imm %64, imm_offset { struct {int32[5]}, 0 } --> main68
172    main68: addp %59, %63, %64 --> main67
173    main67: imm %61, imm_int 0 --> main66
174    main66: imm %62, imm_sizeof (int32) --> main65
175    main65: mul %60, %61, %62 --> main64
176    main64: addp %56, %59, %60 --> main63
177    main63: imm %58, imm_int 26 --> main62
178    main62: int1sto4 %57, %58 --> main61
179    main61: store int32, %56, %57 --> main60
180    main60: imm %54, imm_addr STACK --> main59
181    main6: addp %2, %6, %7 --> main5
182    main59: imm %55, imm_offset { struct {int32[5]}, 0 } --> main58
183    main58: addp %50, %54, %55 --> main57
184    main57: imm %52, imm_int 1 --> main56
185    main56: imm %53, imm_sizeof (int32) --> main55
186    main55: mul %51, %52, %53 --> main54
187    main54: addp %46, %50, %51 --> main53
188    main53: imm %49, imm_int 21 --> main52
189    main52: negint %48, %49 --> main51
190    main51: int1sto4 %47, %48 --> main50
191    main50: store int32, %46, %47 --> main49
192    main5: imm %5, imm_int 5 --> main4
193    main49: imm %44, imm_addr STACK --> main48
194    main48: imm %45, imm_offset { struct {int32[5]}, 0 } --> main47
195    main47: addp %40, %44, %45 --> main46
196    main46: imm %42, imm_int 2 --> main45
197    main45: imm %43, imm_sizeof (int32) --> main44
198    main44: mul %41, %42, %43 --> main43
199    main43: addp %37, %40, %41 --> main42
200    main42: imm %39, imm_int 43 --> main41
201    main41: int1sto4 %38, %39 --> main40
202    main40: store int32, %37, %38 --> main39
203    main4: int1sto4 %3, %5 --> main3
204    main39: imm %35, imm_addr STACK --> main38
205    main38: imm %36, imm_offset { struct {int32[5]}, 0 } --> main37
206    main37: addp %31, %35, %36 --> main36
207    main36: imm %33, imm_int 3 --> main35
208    main35: imm %34, imm_sizeof (int32) --> main34
209    main34: mul %32, %33, %34 --> main33
210    main33: addp %27, %31, %32 --> main32
211    main32: imm %30, imm_int 62 --> main31
212    main31: negint %29, %30 --> main30
213    main30: int1sto4 %28, %29 --> main29
214    main3: call "print_tab", [%2, %3], %4: ptr -> int4s -> void --> main2
215    main29: store int32, %27, %28 --> main28
216    main28: imm %25, imm_addr STACK --> main27
217    main27: imm %26, imm_offset { struct {int32[5]}, 0 } --> main26
218    main26: addp %21, %25, %26 --> main25
219    main25: imm %23, imm_int 4 --> main24
220    main24: imm %24, imm_sizeof (int32) --> main23
221    main23: mul %22, %23, %24 --> main22
222    main22: addp %18, %21, %22 --> main21
223    main21: imm %20, imm_int 8 --> main20
224    main20: int1sto4 %19, %20 --> main19
225    main2: imm %1, imm_int 0 --> main1
226    main19: store int32, %18, %19 --> main18
227    main18: imm %16, imm_addr STACK --> main17
228    main17: imm %17, imm_offset { struct {int32[5]}, 0 } --> main16
229    main16: addp %8, %16, %17 --> main15
230    main15: imm %15, imm_int 0 --> main14
231    main14: int1sto4 %9, %15 --> main13
232    main13: imm %13, imm_int 5 --> main12
233    main12: imm %14, imm_int 1 --> main11
234    main11: sub %12, %13, %14 --> main10
235    main10: int1sto4 %10, %12 --> main9
236    main1: int1sto4 %0, %1 --> main0
237    main0: return %0
238
239
Note: See TracBrowser for help on using the repository browser.