source: Deliverables/D2.2/8051/tests/tmp_tests/Frontend/search.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: 7.7 KB
Line 
1program:
2
3
4  globals:
5    "to_find" { int32[2] }
6
7
8  extern "print_sint": int4s -> void
9
10
11  extern "newline": void
12
13
14  extern "space": void
15
16
17  "search"(ptr %0, int4s %1, int4s %2)
18    locals: int4s %3, int4s %4, int4s %5, int1s %7, int1s %8, int4s %9, int4s %10, int4s %11, ptr %12, int4s %13, int4s %14, int4s %15, int4s %16, int4s %17, ptr %18, int4s %19, int4s %20, int4s %21, int4s %22, ptr %23, int4s %24, int4s %25, int4s %26, int4s %27, int4s %28, int4s %29, int4s %30, int1s %31
19    result: int4s %6
20    stacksize: struct {}
21    entry: search46
22    exit: search0
23
24    search9: emit _cost0 --> search8
25    search8: imm %9, imm_int 1 --> search7
26    search7: add %5, %4, %9 --> search5
27    search6: emit _cost1 --> search5
28    search5: --> search41
29    search46: emit _cost8 --> search45
30    search45: imm %31, imm_int 0 --> search44
31    search44: int1sto4 %5, %31 --> search43
32    search43: imm %30, imm_int 1 --> search42
33    search42: sub %3, %1, %30 --> search5
34    search41: ge %29, %3, %5 --> search40
35    search40: notbool %28, %29 --> search39
36    search4: emit _cost7 --> search3
37    search39: %28? --> search4, search38
38    search38: emit _cost6 --> search37
39    search37: add %26, %3, %5 --> search36
40    search36: imm %27, imm_int 2 --> search35
41    search35: div %4, %26, %27 --> search34
42    search34: imm %25, imm_sizeof (int32) --> search33
43    search33: mul %24, %4, %25 --> search32
44    search32: addp %23, %0, %24 --> search31
45    search31: load int32, %23, %22 --> search30
46    search30: eq %21, %22, %2 --> search29
47    search3: imm %8, imm_int 1 --> search2
48    search29: %21? --> search28, search26
49    search28: emit _cost4 --> search27
50    search27: id %6, %4 --> search0
51    search26: emit _cost5 --> search25
52    search25: imm %20, imm_sizeof (int32) --> search24
53    search24: mul %19, %4, %20 --> search23
54    search23: addp %18, %0, %19 --> search22
55    search22: load int32, %18, %17 --> search21
56    search21: gt %16, %17, %2 --> search20
57    search20: %16? --> search19, search16
58    search2: negint %7, %8 --> search1
59    search19: emit _cost2 --> search18
60    search18: imm %15, imm_int 1 --> search17
61    search17: sub %3, %4, %15 --> search15
62    search16: emit _cost3 --> search15
63    search15: imm %14, imm_sizeof (int32) --> search14
64    search14: mul %13, %4, %14 --> search13
65    search13: addp %12, %0, %13 --> search12
66    search12: load int32, %12, %11 --> search11
67    search11: lt %10, %11, %2 --> search10
68    search10: %10? --> search9, search6
69    search1: int1sto4 %6, %7 --> search0
70    search0: return %6
71
72
73  "main"()
74    locals: int4s %0, int4s %1, int4s %2, int4s %3, int1s %5, int1u %6, int4s %7, int1u %8, int1u %9, ptr %10, int4s %11, int4s %12, ptr %13, ptr %14, int4s %15, int4s %16, int1s %17, ptr %18, offset %19, int4s %20, int4s %21, int4s %22, int1s %23, ptr %24, int4s %25, int1s %26, ptr %27, int1s %28, int1s %29, int1s %30, ptr %31, offset %32, ptr %33, int4s %34, int1s %35, ptr %36, int1s %37, int1s %38, int1s %39, ptr %40, offset %41, ptr %42, int4s %43, int1s %44, ptr %45, int1s %46, int1s %47, int1s %48, ptr %49, offset %50, ptr %51, int4s %52, int1s %53, int1s %54, ptr %55, int1s %56, int1s %57, int1s %58, ptr %59, offset %60, ptr %61, int4s %62, int1s %63, int1s %64, ptr %65, int1s %66, int1s %67, int1s %68, ptr %69, offset %70, ptr %71, int4u %72, ptr %73, offset %74, offset %75, offset %76, ptr %77, int4u %78, ptr %79, offset %80, offset %81, offset %82
75    result: int4s %4
76    stacksize: struct {int32[5]}
77    entry: main95
78    exit: main0
79
80    main95: imm %79, imm_addr "to_find" --> main94
81    main94: imm %81, imm_int 0 --> main93
82    main93: imm %82, imm_offset { int32[2], 0 } --> main92
83    main92: add %80, %81, %82 --> main91
84    main91: addp %77, %79, %80 --> main90
85    main90: imm %78, imm_int 57 --> main89
86    main9: call "print_sint", [%2], %9: int4s -> void --> main8
87    main89: store int32, %77, %78 --> main88
88    main88: imm %73, imm_addr "to_find" --> main87
89    main87: imm %75, imm_int 0 --> main86
90    main86: imm %76, imm_offset { int32[2], 1 } --> main85
91    main85: add %74, %75, %76 --> main84
92    main84: addp %71, %73, %74 --> main83
93    main83: imm %72, imm_int -1 --> main82
94    main82: store int32, %71, %72 --> main81
95    main81: emit _cost11 --> main80
96    main80: imm %69, imm_addr STACK --> main79
97    main8: call "space", [], %8: void --> main7
98    main79: imm %70, imm_offset { struct {int32[5]}, 0 } --> main78
99    main78: addp %65, %69, %70 --> main77
100    main77: imm %67, imm_int 0 --> main76
101    main76: imm %68, imm_sizeof (int32) --> main75
102    main75: mul %66, %67, %68 --> main74
103    main74: addp %61, %65, %66 --> main73
104    main73: imm %64, imm_int 30 --> main72
105    main72: negint %63, %64 --> main71
106    main71: int1sto4 %62, %63 --> main70
107    main70: store int32, %61, %62 --> main69
108    main7: imm %7, imm_int 1 --> main6
109    main69: imm %59, imm_addr STACK --> main68
110    main68: imm %60, imm_offset { struct {int32[5]}, 0 } --> main67
111    main67: addp %55, %59, %60 --> main66
112    main66: imm %57, imm_int 1 --> main65
113    main65: imm %58, imm_sizeof (int32) --> main64
114    main64: mul %56, %57, %58 --> main63
115    main63: addp %51, %55, %56 --> main62
116    main62: imm %54, imm_int 18 --> main61
117    main61: negint %53, %54 --> main60
118    main60: int1sto4 %52, %53 --> main59
119    main6: add %0, %0, %7 --> main5
120    main59: store int32, %51, %52 --> main58
121    main58: imm %49, imm_addr STACK --> main57
122    main57: imm %50, imm_offset { struct {int32[5]}, 0 } --> main56
123    main56: addp %45, %49, %50 --> main55
124    main55: imm %47, imm_int 2 --> main54
125    main54: imm %48, imm_sizeof (int32) --> main53
126    main53: mul %46, %47, %48 --> main52
127    main52: addp %42, %45, %46 --> main51
128    main51: imm %44, imm_int 23 --> main50
129    main50: int1sto4 %43, %44 --> main49
130    main5: --> main26
131    main49: store int32, %42, %43 --> main48
132    main48: imm %40, imm_addr STACK --> main47
133    main47: imm %41, imm_offset { struct {int32[5]}, 0 } --> main46
134    main46: addp %36, %40, %41 --> main45
135    main45: imm %38, imm_int 3 --> main44
136    main44: imm %39, imm_sizeof (int32) --> main43
137    main43: mul %37, %38, %39 --> main42
138    main42: addp %33, %36, %37 --> main41
139    main41: imm %35, imm_int 57 --> main40
140    main40: int1sto4 %34, %35 --> main39
141    main4: emit _cost10 --> main3
142    main39: store int32, %33, %34 --> main38
143    main38: imm %31, imm_addr STACK --> main37
144    main37: imm %32, imm_offset { struct {int32[5]}, 0 } --> main36
145    main36: addp %27, %31, %32 --> main35
146    main35: imm %29, imm_int 4 --> main34
147    main34: imm %30, imm_sizeof (int32) --> main33
148    main33: mul %28, %29, %30 --> main32
149    main32: addp %24, %27, %28 --> main31
150    main31: imm %26, imm_int 120 --> main30
151    main30: int1sto4 %25, %26 --> main29
152    main3: call "newline", [], %6: void --> main2
153    main29: store int32, %24, %25 --> main28
154    main28: imm %23, imm_int 0 --> main27
155    main27: int1sto4 %0, %23 --> main5
156    main26: imm %22, imm_int 2 --> main25
157    main25: lt %21, %0, %22 --> main24
158    main24: notbool %20, %21 --> main23
159    main23: %20? --> main4, main22
160    main22: emit _cost9 --> main21
161    main21: imm %18, imm_addr STACK --> main20
162    main20: imm %19, imm_offset { struct {int32[5]}, 0 } --> main19
163    main2: imm %5, imm_int 0 --> main1
164    main19: addp %10, %18, %19 --> main18
165    main18: imm %17, imm_int 5 --> main17
166    main17: int1sto4 %11, %17 --> main16
167    main16: imm %14, imm_addr "to_find" --> main15
168    main15: imm %16, imm_sizeof (int32) --> main14
169    main14: mul %15, %0, %16 --> main13
170    main13: addp %13, %14, %15 --> main12
171    main12: load int32, %13, %12 --> main11
172    main11: call "search", [%10, %11, %12], %3: ptr -> int4s -> int4s -> int4s --> main10
173    main10: id %2, %3 --> main9
174    main1: int1sto4 %4, %5 --> main0
175    main0: return %4
176
177
Note: See TracBrowser for help on using the repository browser.