https://github.com/akkartik/mu/blob/master/apps/mu.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241 == data
242
243 Program:
244 _Program-functions:
245 0/imm32
246 _Program-types:
247 0/imm32
248
249
250
251
252
253
254
255
256
257
258
259
260 Function-name:
261 0/imm32
262 Function-subx-name:
263 4/imm32
264 Function-inouts:
265 8/imm32
266 Function-outputs:
267 0xc/imm32
268 Function-body:
269 0x10/imm32
270 Function-next:
271 0x14/imm32
272 Function-size:
273 0x18/imm32/24
274
275 Primitive-name:
276 0/imm32
277 Primitive-inouts:
278 4/imm32
279 Primitive-outputs:
280 8/imm32
281 Primitive-subx-name:
282 0xc/imm32
283 Primitive-subx-rm32:
284 0x10/imm32
285 Primitive-subx-r32:
286 0x14/imm32
287 Primitive-subx-imm32:
288 0x18/imm32
289 Primitive-subx-disp32:
290 0x1c/imm32
291 Primitive-output-is-write-only:
292 0x20/imm32
293 Primitive-next:
294 0x24/imm32
295 Primitive-size:
296 0x28/imm32/36
297
298 Stmt-tag:
299 0/imm32
300
301 Block-stmts:
302 4/imm32
303 Block-var:
304 8/imm32
305
306 Stmt1-operation:
307 4/imm32
308 Stmt1-inouts:
309 8/imm32
310 Stmt1-outputs:
311 0xc/imm32
312
313 Vardef-var:
314 4/imm32
315
316 Regvardef-operation:
317 4/imm32
318 Regvardef-inouts:
319 8/imm32
320 Regvardef-outputs:
321 0xc/imm32
322
323 Stmt-size:
324 0x10/imm32
325
326 Var-name:
327 0/imm32
328 Var-type:
329 4/imm32
330 Var-block-depth:
331 8/imm32
332 Var-offset:
333 0xc/imm32
334 Var-register:
335 0x10/imm32
336 Var-size:
337 0x14/imm32
338
339 Any-register:
340
341 1/imm32
342
343 2a/asterisk
344
345 List-value:
346 0/imm32
347 List-next:
348 4/imm32
349 List-size:
350 8/imm32
351
352
353 Stmt-var-value:
354 0/imm32
355 Stmt-var-next:
356 4/imm32
357 Stmt-var-is-deref:
358 8/imm32
359 Stmt-var-size:
360 0xc/imm32
361
362
363
364
365
366
367
368 Tree-left:
369 0/imm32
370 Tree-right:
371 4/imm32
372 Tree-size:
373 8/imm32
374
375
376
377 Max-type-id:
378 0x10000/imm32
379
380 Type-id:
381 0x1c/imm32/write
382 0/imm32/read
383 0x100/imm32/length
384
385 "literal"/imm32
386 "int"/imm32
387 "addr"/imm32
388 "array"/imm32
389 "handle"/imm32
390 "boolean"/imm32
391 "constant"/imm32
392 "offset"/imm32
393 0/imm32
394
395 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
396 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
397 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
398 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
399 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
400 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
401 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
402
403
404
405 Typeinfo-id:
406 0/imm32
407 Typeinfo-fields:
408 4/imm32
409
410
411
412
413
414 Typeinfo-total-size-in-bytes:
415 8/imm32
416 Typeinfo-next:
417 0xc/imm32
418 Typeinfo-size:
419 0x10/imm32
420
421
422
423 Typeinfo-fields-row-size:
424 8/imm32
425
426
427
428
429
430
431
432
433 Typeinfo-entry-input-var:
434 0/imm32
435 Typeinfo-entry-index:
436 4/imm32
437 Typeinfo-entry-output-var:
438 8/imm32
439 Typeinfo-entry-size:
440 0xc/imm32
441
442 == code
443
444 Entry:
445
446 89/<- %ebp 4/r32/esp
447 (new-segment *Heap-size Heap)
448
449 {
450
451 81 7/subop/compare *ebp 1/imm32
452 7e/jump-if-<= break/disp8
453
454 (kernel-string-equal? *(ebp+8) "test")
455 3d/compare-eax-and 0/imm32/false
456 74/jump-if-= break/disp8
457
458 (run-tests)
459
460 8b/-> *Num-test-failures 3/r32/ebx
461 eb/jump $mu-main:end/disp8
462 }
463
464 (convert-mu Stdin Stdout)
465 (flush Stdout)
466
467 bb/copy-to-ebx 0/imm32
468 $mu-main:end:
469 b8/copy-to-eax 1/imm32/exit
470 cd/syscall 0x80/imm8
471
472 convert-mu:
473
474 55/push-ebp
475 89/<- %ebp 4/r32/esp
476
477 c7 0/subop/copy *Next-block-index 1/imm32
478 c7 0/subop/copy *Type-id 0x1c/imm32
479 c7 0/subop/copy *_Program-functions 0/imm32
480 c7 0/subop/copy *_Program-types 0/imm32
481
482 (parse-mu *(ebp+8))
483 (populate-mu-type-sizes)
484 (check-mu-types)
485 (emit-subx *(ebp+0xc))
486 $convert-mu:end:
487
488 89/<- %esp 5/r32/ebp
489 5d/pop-to-ebp
490 c3/return
491
492 test-convert-empty-input:
493
494
495 55/push-ebp
496 89/<- %ebp 4/r32/esp
497
498 (clear-stream _test-input-stream)
499 (clear-stream $_test-input-buffered-file->buffer)
500 (clear-stream _test-output-stream)
501 (clear-stream $_test-output-buffered-file->buffer)
502
503 (convert-mu _test-input-buffered-file _test-output-buffered-file)
504 (flush _test-output-buffered-file)
505 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
506
507 89/<- %esp 5/r32/ebp
508 5d/pop-to-ebp
509 c3/return
510
511 test-convert-function-skeleton:
512
513 55/push-ebp
514 89/<- %ebp 4/r32/esp
515
516 (clear-stream _test-input-stream)
517 (clear-stream $_test-input-buffered-file->buffer)
518 (clear-stream _test-output-stream)
519 (clear-stream $_test-output-buffered-file->buffer)
520
521 (write _test-input-stream "fn foo {\n")
522 (write _test-input-stream "}\n")
523
524 (convert-mu _test-input-buffered-file _test-output-buffered-file)
525 (flush _test-output-buffered-file)
526 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
532
533 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
534 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1")
535 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2")
536 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
537 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4")
538 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
539 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
540 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7")
541
542 89/<- %esp 5/r32/ebp
543 5d/pop-to-ebp
544 c3/return
545
546 test-convert-multiple-function-skeletons:
547
548 55/push-ebp
549 89/<- %ebp 4/r32/esp
550
551 (clear-stream _test-input-stream)
552 (clear-stream $_test-input-buffered-file->buffer)
553 (clear-stream _test-output-stream)
554 (clear-stream $_test-output-buffered-file->buffer)
555
556 (write _test-input-stream "fn foo {\n")
557 (write _test-input-stream "}\n")
558 (write _test-input-stream "fn bar {\n")
559 (write _test-input-stream "}\n")
560
561 (convert-mu _test-input-buffered-file _test-output-buffered-file)
562 (flush _test-output-buffered-file)
563 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
569
570 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
571 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1")
572 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
573 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
574 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4")
575 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
576 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
577 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7")
578
579 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11")
581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
583 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14")
584 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
585 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
586 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17")
587
588 89/<- %esp 5/r32/ebp
589 5d/pop-to-ebp
590 c3/return
591
592 test-convert-function-with-arg:
593
594 55/push-ebp
595 89/<- %ebp 4/r32/esp
596
597 (clear-stream _test-input-stream)
598 (clear-stream $_test-input-buffered-file->buffer)
599 (clear-stream _test-output-stream)
600 (clear-stream $_test-output-buffered-file->buffer)
601
602 (write _test-input-stream "fn foo n: int {\n")
603 (write _test-input-stream "}\n")
604
605 (convert-mu _test-input-buffered-file _test-output-buffered-file)
606 (flush _test-output-buffered-file)
607 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
613
614 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
615 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1")
616 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2")
617 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
618 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4")
619 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
620 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
621 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7")
622
623 89/<- %esp 5/r32/ebp
624 5d/pop-to-ebp
625 c3/return
626
627 test-convert-function-with-arg-and-body:
628
629 55/push-ebp
630 89/<- %ebp 4/r32/esp
631
632 (clear-stream _test-input-stream)
633 (clear-stream $_test-input-buffered-file->buffer)
634 (clear-stream _test-output-stream)
635 (clear-stream $_test-output-buffered-file->buffer)
636
637 (write _test-input-stream "fn foo n: int {\n")
638 (write _test-input-stream " increment n\n")
639 (write _test-input-stream "}\n")
640
641 (convert-mu _test-input-buffered-file _test-output-buffered-file)
642 (flush _test-output-buffered-file)
643 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
649
650 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
651 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1")
652 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
653 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
654 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4")
655 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5")
656 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6")
657 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7")
658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8")
659 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9")
660 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10")
661 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11")
662 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12")
663
664 89/<- %esp 5/r32/ebp
665 5d/pop-to-ebp
666 c3/return
667
668 test-convert-function-distinguishes-args:
669
670 55/push-ebp
671 89/<- %ebp 4/r32/esp
672
673 (clear-stream _test-input-stream)
674 (clear-stream $_test-input-buffered-file->buffer)
675 (clear-stream _test-output-stream)
676 (clear-stream $_test-output-buffered-file->buffer)
677
678 (write _test-input-stream "fn foo a: int, b: int {\n")
679 (write _test-input-stream " increment b\n")
680 (write _test-input-stream "}\n")
681
682 (convert-mu _test-input-buffered-file _test-output-buffered-file)
683 (flush _test-output-buffered-file)
684 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
690
691 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
692 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1")
693 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2")
694 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
695 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4")
696 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5")
697 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6")
698 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7")
699 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8")
700 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9")
701 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10")
702 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11")
703 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12")
704
705 89/<- %esp 5/r32/ebp
706 5d/pop-to-ebp
707 c3/return
708
709 test-convert-function-returns-result:
710
711 55/push-ebp
712 89/<- %ebp 4/r32/esp
713
714 (clear-stream _test-input-stream)
715 (clear-stream $_test-input-buffered-file->buffer)
716 (clear-stream _test-output-stream)
717 (clear-stream $_test-output-buffered-file->buffer)
718
719 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
720 (write _test-input-stream " result <- copy a\n")
721 (write _test-input-stream " result <- increment\n")
722 (write _test-input-stream "}\n")
723
724 (convert-mu _test-input-buffered-file _test-output-buffered-file)
725 (flush _test-output-buffered-file)
726 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
732
733 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
734 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1")
735 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2")
736 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
737 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4")
738 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5")
739 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6")
740 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7")
741 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8")
742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9")
743 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10")
744 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11")
745 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12")
746 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13")
747
748 89/<- %esp 5/r32/ebp
749 5d/pop-to-ebp
750 c3/return
751
752 test-convert-function-with-literal-arg:
753
754 55/push-ebp
755 89/<- %ebp 4/r32/esp
756
757 (clear-stream _test-input-stream)
758 (clear-stream $_test-input-buffered-file->buffer)
759 (clear-stream _test-output-stream)
760 (clear-stream $_test-output-buffered-file->buffer)
761
762 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
763 (write _test-input-stream " result <- copy a\n")
764 (write _test-input-stream " result <- add 1\n")
765 (write _test-input-stream "}\n")
766
767 (convert-mu _test-input-buffered-file _test-output-buffered-file)
768 (flush _test-output-buffered-file)
769 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
775
776 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0")
777 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1")
778 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2")
779 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3")
780 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4")
781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5")
782 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/6")
783 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/7")
784 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/8")
785 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/9")
786 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/10")
787 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/11")
788 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/12")
789 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/13")
790
791 89/<- %esp 5/r32/ebp
792 5d/pop-to-ebp
793 c3/return
794
795 test-convert-function-with-literal-arg-2:
796
797 55/push-ebp
798 89/<- %ebp 4/r32/esp
799
800 (clear-stream _test-input-stream)
801 (clear-stream $_test-input-buffered-file->buffer)
802 (clear-stream _test-output-stream)
803 (clear-stream $_test-output-buffered-file->buffer)
804
805 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
806 (write _test-input-stream " result <- copy a\n")
807 (write _test-input-stream " result <- add 1\n")
808 (write _test-input-stream "}\n")
809
810 (convert-mu _test-input-buffered-file _test-output-buffered-file)
811 (flush _test-output-buffered-file)
812 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
818
819 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0")
820 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1")
821 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2")
822 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3")
823 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4")
824 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5")
825 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/6")
826 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/7")
827 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/8")
828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/9")
829 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/10")
830 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/11")
831 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/12")
832 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/13")
833
834 89/<- %esp 5/r32/ebp
835 5d/pop-to-ebp
836 c3/return
837
838 test-convert-function-call-with-literal-arg:
839
840 55/push-ebp
841 89/<- %ebp 4/r32/esp
842
843 (clear-stream _test-input-stream)
844 (clear-stream $_test-input-buffered-file->buffer)
845 (clear-stream _test-output-stream)
846 (clear-stream $_test-output-buffered-file->buffer)
847
848 (write _test-input-stream "fn main -> result/ebx: int {\n")
849 (write _test-input-stream " result <- do-add 3 4\n")
850 (write _test-input-stream "}\n")
851 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
852 (write _test-input-stream " result <- copy a\n")
853 (write _test-input-stream " result <- add b\n")
854 (write _test-input-stream "}\n")
855
856 (convert-mu _test-input-buffered-file _test-output-buffered-file)
857 (flush _test-output-buffered-file)
858 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
864
865 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
866 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1")
867 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
868 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
869 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4")
870 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5")
871 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6")
872 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7")
873 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8")
874 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9")
875 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10")
876 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11")
877 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12")
878 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13")
879 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14")
880 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15")
881 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16")
882 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17")
883 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18")
884 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19")
885 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20")
886 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21")
887 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22")
888 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23")
889 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24")
890 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25")
891 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26")
892
893 89/<- %esp 5/r32/ebp
894 5d/pop-to-ebp
895 c3/return
896
897 test-convert-function-with-local-var-in-mem:
898
899 55/push-ebp
900 89/<- %ebp 4/r32/esp
901
902 (clear-stream _test-input-stream)
903 (clear-stream $_test-input-buffered-file->buffer)
904 (clear-stream _test-output-stream)
905 (clear-stream $_test-output-buffered-file->buffer)
906
907 (write _test-input-stream "fn foo {\n")
908 (write _test-input-stream " var x: int\n")
909 (write _test-input-stream " increment x\n")
910 (write _test-input-stream "}\n")
911
912 (convert-mu _test-input-buffered-file _test-output-buffered-file)
913 (flush _test-output-buffered-file)
914 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
920
921 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0")
922 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1")
923 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2")
924 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3")
925 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4")
926 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5")
927 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6")
928 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7")
929 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/8")
930 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9")
931 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10")
932 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11")
933 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12")
934 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13")
935 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14")
936
937 89/<- %esp 5/r32/ebp
938 5d/pop-to-ebp
939 c3/return
940
941 test-convert-function-with-local-var-with-compound-type-in-mem:
942
943 55/push-ebp
944 89/<- %ebp 4/r32/esp
945
946 (clear-stream _test-input-stream)
947 (clear-stream $_test-input-buffered-file->buffer)
948 (clear-stream _test-output-stream)
949 (clear-stream $_test-output-buffered-file->buffer)
950
951 (write _test-input-stream "fn foo {\n")
952 (write _test-input-stream " var x: (addr int)\n")
953 (write _test-input-stream " copy-to x, 0\n")
954 (write _test-input-stream "}\n")
955
956 (convert-mu _test-input-buffered-file _test-output-buffered-file)
957 (flush _test-output-buffered-file)
958 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
964
965 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0")
966 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1")
967 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2")
968 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/3")
969 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4")
970 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5")
971 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/6")
972 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy *(ebp+0xfffffffc) 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/7")
973 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/8")
974 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9")
975 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10")
976 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11")
977 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/12")
978 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/13")
979 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14")
980
981 89/<- %esp 5/r32/ebp
982 5d/pop-to-ebp
983 c3/return
984
985 test-convert-function-with-local-var-in-reg:
986
987 55/push-ebp
988 89/<- %ebp 4/r32/esp
989
990 (clear-stream _test-input-stream)
991 (clear-stream $_test-input-buffered-file->buffer)
992 (clear-stream _test-output-stream)
993 (clear-stream $_test-output-buffered-file->buffer)
994
995 (write _test-input-stream "fn foo {\n")
996 (write _test-input-stream " var x/ecx: int <- copy 3\n")
997 (write _test-input-stream " x <- increment\n")
998 (write _test-input-stream "}\n")
999
1000 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1001 (flush _test-output-buffered-file)
1002 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1008
1009 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0")
1010 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1")
1011 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2")
1012 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3")
1013 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4")
1014 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5")
1015 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6")
1016 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7")
1017 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8")
1018 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9")
1019 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10")
1020 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11")
1021 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12")
1022 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13")
1023 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14")
1024 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15")
1025
1026 89/<- %esp 5/r32/ebp
1027 5d/pop-to-ebp
1028 c3/return
1029
1030 test-convert-function-with-second-local-var-in-same-reg:
1031
1032 55/push-ebp
1033 89/<- %ebp 4/r32/esp
1034
1035 (clear-stream _test-input-stream)
1036 (clear-stream $_test-input-buffered-file->buffer)
1037 (clear-stream _test-output-stream)
1038 (clear-stream $_test-output-buffered-file->buffer)
1039
1040 (write _test-input-stream "fn foo {\n")
1041 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1042 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1043 (write _test-input-stream " y <- increment\n")
1044 (write _test-input-stream "}\n")
1045
1046 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1047 (flush _test-output-buffered-file)
1048 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1054
1055 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0")
1056 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1")
1057 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2")
1058 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-second-local-var-in-same-reg/3")
1059 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4")
1060 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5")
1061 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/6")
1062 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/7")
1063 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/8")
1064 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9")
1065 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/10")
1066 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11")
1067 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12")
1068 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13")
1069 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-second-local-var-in-same-reg/14")
1070 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15")
1071 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16")
1072
1073 89/<- %esp 5/r32/ebp
1074 5d/pop-to-ebp
1075 c3/return
1076
1077 test-convert-function-with-local-var-dereferenced:
1078
1079 55/push-ebp
1080 89/<- %ebp 4/r32/esp
1081
1082 (clear-stream _test-input-stream)
1083 (clear-stream $_test-input-buffered-file->buffer)
1084 (clear-stream _test-output-stream)
1085 (clear-stream $_test-output-buffered-file->buffer)
1086
1087 (write _test-input-stream "fn foo {\n")
1088 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n")
1089 (write _test-input-stream " increment *x\n")
1090 (write _test-input-stream "}\n")
1091
1092 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1093 (flush _test-output-buffered-file)
1094 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1100
1101 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0")
1102 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1")
1103 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2")
1104 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3")
1105 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4")
1106 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5")
1107 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6")
1108 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7")
1109 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8")
1110 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9")
1111 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10")
1112 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11")
1113 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12")
1114 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13")
1115 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14")
1116 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15")
1117
1118 89/<- %esp 5/r32/ebp
1119 5d/pop-to-ebp
1120 c3/return
1121
1122 test-convert-compare-register-with-literal:
1123
1124 55/push-ebp
1125 89/<- %ebp 4/r32/esp
1126
1127 (clear-stream _test-input-stream)
1128 (clear-stream $_test-input-buffered-file->buffer)
1129 (clear-stream _test-output-stream)
1130 (clear-stream $_test-output-buffered-file->buffer)
1131
1132 (write _test-input-stream "fn foo {\n")
1133 (write _test-input-stream " var x/ecx: int <- copy 0\n")
1134 (write _test-input-stream " compare x, 0\n")
1135 (write _test-input-stream "}\n")
1136
1137 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1138 (flush _test-output-buffered-file)
1139 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1145
1146 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0")
1147 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1")
1148 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2")
1149 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3")
1150 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4")
1151 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5")
1152 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1153 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7")
1154 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8")
1155 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1156 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10")
1157 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11")
1158 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12")
1159 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13")
1160 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14")
1161 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15")
1162
1163 89/<- %esp 5/r32/ebp
1164 5d/pop-to-ebp
1165 c3/return
1166
1167 test-convert-function-with-local-var-in-block:
1168
1169 55/push-ebp
1170 89/<- %ebp 4/r32/esp
1171
1172 (clear-stream _test-input-stream)
1173 (clear-stream $_test-input-buffered-file->buffer)
1174 (clear-stream _test-output-stream)
1175 (clear-stream $_test-output-buffered-file->buffer)
1176
1177 (write _test-input-stream "fn foo {\n")
1178 (write _test-input-stream " {\n")
1179 (write _test-input-stream " var x: int\n")
1180 (write _test-input-stream " increment x\n")
1181 (write _test-input-stream " }\n")
1182 (write _test-input-stream "}\n")
1183
1184 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1185 (flush _test-output-buffered-file)
1186 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1192
1193 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0")
1194 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1")
1195 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2")
1196 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3")
1197 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4")
1198 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5")
1199 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6")
1200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7")
1201 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8")
1202 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9")
1203 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/10")
1204 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11")
1205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12")
1206 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13")
1207 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14")
1208 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15")
1209 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16")
1210 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17")
1211 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18")
1212
1213 89/<- %esp 5/r32/ebp
1214 5d/pop-to-ebp
1215 c3/return
1216
1217 test-convert-function-with-local-var-in-named-block:
1218
1219 55/push-ebp
1220 89/<- %ebp 4/r32/esp
1221
1222 (clear-stream _test-input-stream)
1223 (clear-stream $_test-input-buffered-file->buffer)
1224 (clear-stream _test-output-stream)
1225 (clear-stream $_test-output-buffered-file->buffer)
1226
1227 (write _test-input-stream "fn foo {\n")
1228 (write _test-input-stream " $bar: {\n")
1229 (write _test-input-stream " var x: int\n")
1230 (write _test-input-stream " increment x\n")
1231 (write _test-input-stream " }\n")
1232 (write _test-input-stream "}\n")
1233
1234 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1235 (flush _test-output-buffered-file)
1236 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1242
1243 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0")
1244 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1")
1245 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2")
1246 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3")
1247 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4")
1248 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5")
1249 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6")
1250 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7")
1251 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8")
1252 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/9")
1253 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-named-block/10")
1254 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11")
1255 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12")
1256 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13")
1257 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14")
1258 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15")
1259 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16")
1260 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17")
1261 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18")
1262
1263 89/<- %esp 5/r32/ebp
1264 5d/pop-to-ebp
1265 c3/return
1266
1267 test-always-shadow-outermost-reg-vars-in-function:
1268
1269 55/push-ebp
1270 89/<- %ebp 4/r32/esp
1271
1272 (clear-stream _test-input-stream)
1273 (clear-stream $_test-input-buffered-file->buffer)
1274 (clear-stream _test-output-stream)
1275 (clear-stream $_test-output-buffered-file->buffer)
1276
1277 (write _test-input-stream "fn foo {\n")
1278 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1279 (write _test-input-stream "}\n")
1280
1281 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1282 (flush _test-output-buffered-file)
1283 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1289
1290 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0")
1291 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1")
1292 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2")
1293 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3")
1294 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4")
1295 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5")
1296 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1297 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8")
1298 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1299 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12")
1300 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13")
1301 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14")
1302 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15")
1303 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16")
1304 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17")
1305
1306 89/<- %esp 5/r32/ebp
1307 5d/pop-to-ebp
1308 c3/return
1309
1310 _pending-test-clobber-dead-local:
1311
1312 55/push-ebp
1313 89/<- %ebp 4/r32/esp
1314
1315 (clear-stream _test-input-stream)
1316 (clear-stream $_test-input-buffered-file->buffer)
1317 (clear-stream _test-output-stream)
1318 (clear-stream $_test-output-buffered-file->buffer)
1319
1320 (write _test-input-stream "fn foo {\n")
1321 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1322 (write _test-input-stream " {\n")
1323 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1324 (write _test-input-stream " }\n")
1325 (write _test-input-stream "}\n")
1326
1327 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1328 (flush _test-output-buffered-file)
1329 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1335
1336 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0")
1337 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1")
1338 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2")
1339 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3")
1340 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4")
1341 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5")
1342 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6")
1343 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7")
1344 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8")
1345 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9")
1346 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10")
1347 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11")
1348 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12")
1349 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13")
1350 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14")
1351 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15")
1352 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16")
1353 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17")
1354 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18")
1355 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19")
1356
1357 89/<- %esp 5/r32/ebp
1358 5d/pop-to-ebp
1359 c3/return
1360
1361 test-shadow-live-local:
1362
1363 55/push-ebp
1364 89/<- %ebp 4/r32/esp
1365
1366 (clear-stream _test-input-stream)
1367 (clear-stream $_test-input-buffered-file->buffer)
1368 (clear-stream _test-output-stream)
1369 (clear-stream $_test-output-buffered-file->buffer)
1370
1371 (write _test-input-stream "fn foo {\n")
1372 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1373 (write _test-input-stream " {\n")
1374 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1375 (write _test-input-stream " }\n")
1376 (write _test-input-stream " x <- increment\n")
1377 (write _test-input-stream "}\n")
1378
1379 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1380 (flush _test-output-buffered-file)
1381 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1387
1388 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0")
1389 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1")
1390 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2")
1391 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3")
1392 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4")
1393 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5")
1394 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6")
1395 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7")
1396 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8")
1397 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9")
1398 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10")
1399 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11")
1400 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12")
1401 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13")
1402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14")
1403 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15")
1404 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16")
1405 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17")
1406 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18")
1407 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19")
1408 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20")
1409 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21")
1410 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21")
1411
1412 89/<- %esp 5/r32/ebp
1413 5d/pop-to-ebp
1414 c3/return
1415
1416 test-shadow-live-output:
1417
1418 55/push-ebp
1419 89/<- %ebp 4/r32/esp
1420
1421 (clear-stream _test-input-stream)
1422 (clear-stream $_test-input-buffered-file->buffer)
1423 (clear-stream _test-output-stream)
1424 (clear-stream $_test-output-buffered-file->buffer)
1425
1426 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1427 (write _test-input-stream " x <- copy 3\n")
1428 (write _test-input-stream " {\n")
1429 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1430 (write _test-input-stream " }\n")
1431 (write _test-input-stream " x <- increment\n")
1432 (write _test-input-stream "}\n")
1433
1434 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1435 (flush _test-output-buffered-file)
1436 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1442
1443 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0")
1444 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1")
1445 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2")
1446 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3")
1447 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4")
1448 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5")
1449 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-output/7")
1450 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8")
1451 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9")
1452 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10")
1453 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11")
1454 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12")
1455 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13")
1456 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14")
1457 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15")
1458 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17")
1459 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18")
1460 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19")
1461 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20")
1462 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21")
1463 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21")
1464
1465 89/<- %esp 5/r32/ebp
1466 5d/pop-to-ebp
1467 c3/return
1468
1469 _pending-test-local-clobbered-by-output:
1470
1471
1472 55/push-ebp
1473 89/<- %ebp 4/r32/esp
1474
1475 (clear-stream _test-input-stream)
1476 (clear-stream $_test-input-buffered-file->buffer)
1477 (clear-stream _test-output-stream)
1478 (clear-stream $_test-output-buffered-file->buffer)
1479
1480 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1481 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1482 (write _test-input-stream " x <- copy y\n")
1483 (write _test-input-stream "}\n")
1484
1485 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1486 (flush _test-output-buffered-file)
1487 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1493
1494 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0")
1495 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1")
1496 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2")
1497 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3")
1498 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4")
1499 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5")
1500 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6")
1501 (check-next-stream-line-equal _test-output-stream " 89/copy-to %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7")
1502 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8")
1503 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9")
1504 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10")
1505 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11")
1506 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12")
1507 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13")
1508
1509 89/<- %esp 5/r32/ebp
1510 5d/pop-to-ebp
1511 c3/return
1512
1513 test-convert-function-with-branches-in-block:
1514
1515 55/push-ebp
1516 89/<- %ebp 4/r32/esp
1517
1518 (clear-stream _test-input-stream)
1519 (clear-stream $_test-input-buffered-file->buffer)
1520 (clear-stream _test-output-stream)
1521 (clear-stream $_test-output-buffered-file->buffer)
1522
1523 (write _test-input-stream "fn foo x: int {\n")
1524 (write _test-input-stream " {\n")
1525 (write _test-input-stream " break-if->=\n")
1526 (write _test-input-stream " loop-if-addr<\n")
1527 (write _test-input-stream " increment x\n")
1528 (write _test-input-stream " loop\n")
1529 (write _test-input-stream " }\n")
1530 (write _test-input-stream "}\n")
1531
1532 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1533 (flush _test-output-buffered-file)
1534 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1540
1541 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0")
1542 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1")
1543 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2")
1544 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3")
1545 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4")
1546 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5")
1547 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6")
1548 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7")
1549 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/8")
1550 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/9")
1551 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/10")
1552 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/11")
1553 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12")
1554 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/13")
1555 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/14")
1556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/15")
1557 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/16")
1558 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/17")
1559 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/18")
1560 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/19")
1561
1562 89/<- %esp 5/r32/ebp
1563 5d/pop-to-ebp
1564 c3/return
1565
1566 test-convert-function-with-branches-in-named-block:
1567
1568 55/push-ebp
1569 89/<- %ebp 4/r32/esp
1570
1571 (clear-stream _test-input-stream)
1572 (clear-stream $_test-input-buffered-file->buffer)
1573 (clear-stream _test-output-stream)
1574 (clear-stream $_test-output-buffered-file->buffer)
1575
1576 (write _test-input-stream "fn foo x: int {\n")
1577 (write _test-input-stream " $bar: {\n")
1578 (write _test-input-stream " break-if->= $bar\n")
1579 (write _test-input-stream " loop-if-addr< $bar\n")
1580 (write _test-input-stream " increment x\n")
1581 (write _test-input-stream " loop\n")
1582 (write _test-input-stream " }\n")
1583 (write _test-input-stream "}\n")
1584
1585 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1586 (flush _test-output-buffered-file)
1587 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1593
1594 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0")
1595 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1")
1596 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2")
1597 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3")
1598 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4")
1599 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5")
1600 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6")
1601 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7")
1602 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/8")
1603 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/9")
1604 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/10")
1605 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/11")
1606 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/12")
1607 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/13")
1608 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/14")
1609 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/15")
1610 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/16")
1611 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/17")
1612 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/18")
1613 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/19")
1614
1615 89/<- %esp 5/r32/ebp
1616 5d/pop-to-ebp
1617 c3/return
1618
1619 test-convert-function-with-var-in-nested-block:
1620
1621 55/push-ebp
1622 89/<- %ebp 4/r32/esp
1623
1624 (clear-stream _test-input-stream)
1625 (clear-stream $_test-input-buffered-file->buffer)
1626 (clear-stream _test-output-stream)
1627 (clear-stream $_test-output-buffered-file->buffer)
1628
1629 (write _test-input-stream "fn foo x: int {\n")
1630 (write _test-input-stream " {\n")
1631 (write _test-input-stream " {\n")
1632 (write _test-input-stream " var x: int\n")
1633 (write _test-input-stream " increment x\n")
1634 (write _test-input-stream " }\n")
1635 (write _test-input-stream " }\n")
1636 (write _test-input-stream "}\n")
1637
1638 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1639 (flush _test-output-buffered-file)
1640 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1646
1647 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0")
1648 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1")
1649 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2")
1650 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3")
1651 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4")
1652 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5")
1653 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6")
1654 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7")
1655 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8")
1656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9")
1657 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10")
1658 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11")
1659 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/12")
1660 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13")
1661 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14")
1662 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15")
1663 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16")
1664 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17")
1665 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18")
1666 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19")
1667 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20")
1668 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21")
1669 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22")
1670
1671 89/<- %esp 5/r32/ebp
1672 5d/pop-to-ebp
1673 c3/return
1674
1675 test-convert-function-with-multiple-vars-in-nested-blocks:
1676
1677 55/push-ebp
1678 89/<- %ebp 4/r32/esp
1679
1680 (clear-stream _test-input-stream)
1681 (clear-stream $_test-input-buffered-file->buffer)
1682 (clear-stream _test-output-stream)
1683 (clear-stream $_test-output-buffered-file->buffer)
1684
1685 (write _test-input-stream "fn foo x: int {\n")
1686 (write _test-input-stream " {\n")
1687 (write _test-input-stream " var x/eax: int <- copy 0\n")
1688 (write _test-input-stream " {\n")
1689 (write _test-input-stream " var y: int\n")
1690 (write _test-input-stream " x <- add y\n")
1691 (write _test-input-stream " }\n")
1692 (write _test-input-stream " }\n")
1693 (write _test-input-stream "}\n")
1694
1695 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1696 (flush _test-output-buffered-file)
1697 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1703
1704 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0")
1705 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1")
1706 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2")
1707 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3")
1708 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4")
1709 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5")
1710 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6")
1711 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7")
1712 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8")
1713 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/9")
1714 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10")
1715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11")
1716 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12")
1717 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/13")
1718 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/14")
1719 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15")
1720 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16")
1721 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17")
1722 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18")
1723 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19")
1724 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20")
1725 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21")
1726 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22")
1727 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23")
1728 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24")
1729 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25")
1730
1731 89/<- %esp 5/r32/ebp
1732 5d/pop-to-ebp
1733 c3/return
1734
1735 test-convert-function-with-branches-and-local-vars:
1736
1737
1738
1739
1740 55/push-ebp
1741 89/<- %ebp 4/r32/esp
1742
1743 (clear-stream _test-input-stream)
1744 (clear-stream $_test-input-buffered-file->buffer)
1745 (clear-stream _test-output-stream)
1746 (clear-stream $_test-output-buffered-file->buffer)
1747
1748 (write _test-input-stream "fn foo {\n")
1749 (write _test-input-stream " {\n")
1750 (write _test-input-stream " var x: int\n")
1751 (write _test-input-stream " break-if->=\n")
1752 (write _test-input-stream " increment x\n")
1753 (write _test-input-stream " }\n")
1754 (write _test-input-stream "}\n")
1755
1756 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1757 (flush _test-output-buffered-file)
1758 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1764
1765 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0")
1766 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1")
1767 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2")
1768 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3")
1769 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4")
1770 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5")
1771 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6")
1772 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7")
1773 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8")
1774 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9")
1775 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10")
1776 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/11")
1777 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12")
1778 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13")
1779 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14")
1780 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/15")
1781 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16")
1782 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17")
1783 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18")
1784 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19")
1785 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20")
1786 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21")
1787 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22")
1788 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23")
1789
1790 89/<- %esp 5/r32/ebp
1791 5d/pop-to-ebp
1792 c3/return
1793
1794 test-convert-function-with-conditional-loops-and-local-vars:
1795
1796
1797
1798
1799 55/push-ebp
1800 89/<- %ebp 4/r32/esp
1801
1802 (clear-stream _test-input-stream)
1803 (clear-stream $_test-input-buffered-file->buffer)
1804 (clear-stream _test-output-stream)
1805 (clear-stream $_test-output-buffered-file->buffer)
1806
1807 (write _test-input-stream "fn foo {\n")
1808 (write _test-input-stream " {\n")
1809 (write _test-input-stream " var x: int\n")
1810 (write _test-input-stream " loop-if->=\n")
1811 (write _test-input-stream " increment x\n")
1812 (write _test-input-stream " }\n")
1813 (write _test-input-stream "}\n")
1814
1815 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1816 (flush _test-output-buffered-file)
1817 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1823
1824 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0")
1825 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1")
1826 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2")
1827 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3")
1828 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4")
1829 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5")
1830 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6")
1831 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7")
1832 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8")
1833 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9")
1834 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/10")
1835 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/11")
1836 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/12")
1837 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13")
1838 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-conditional-loops-and-local-vars/14")
1839 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/15")
1840 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16")
1841 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17")
1842 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18")
1843 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19")
1844 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20")
1845 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21")
1846 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22")
1847 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23")
1848
1849 89/<- %esp 5/r32/ebp
1850 5d/pop-to-ebp
1851 c3/return
1852
1853 test-convert-function-with-unconditional-loops-and-local-vars:
1854
1855
1856
1857
1858 55/push-ebp
1859 89/<- %ebp 4/r32/esp
1860
1861 (clear-stream _test-input-stream)
1862 (clear-stream $_test-input-buffered-file->buffer)
1863 (clear-stream _test-output-stream)
1864 (clear-stream $_test-output-buffered-file->buffer)
1865
1866 (write _test-input-stream "fn foo {\n")
1867 (write _test-input-stream " {\n")
1868 (write _test-input-stream " var x: int\n")
1869 (write _test-input-stream " loop\n")
1870 (write _test-input-stream " increment x\n")
1871 (write _test-input-stream " }\n")
1872 (write _test-input-stream "}\n")
1873
1874 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1875 (flush _test-output-buffered-file)
1876 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1882
1883 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0")
1884 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1")
1885 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2")
1886 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3")
1887 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4")
1888 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5")
1889 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6")
1890 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7")
1891 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8")
1892 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/9")
1893 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10")
1894
1895 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11")
1896 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12")
1897 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13")
1898 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14")
1899 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15")
1900 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16")
1901 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17")
1902 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18")
1903
1904 89/<- %esp 5/r32/ebp
1905 5d/pop-to-ebp
1906 c3/return
1907
1908 test-convert-function-with-branches-and-loops-and-local-vars:
1909
1910 55/push-ebp
1911 89/<- %ebp 4/r32/esp
1912
1913 (clear-stream _test-input-stream)
1914 (clear-stream $_test-input-buffered-file->buffer)
1915 (clear-stream _test-output-stream)
1916 (clear-stream $_test-output-buffered-file->buffer)
1917
1918 (write _test-input-stream "fn foo {\n")
1919 (write _test-input-stream " {\n")
1920 (write _test-input-stream " var x: int\n")
1921 (write _test-input-stream " break-if->=\n")
1922 (write _test-input-stream " increment x\n")
1923 (write _test-input-stream " loop\n")
1924 (write _test-input-stream " }\n")
1925 (write _test-input-stream "}\n")
1926
1927 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1928 (flush _test-output-buffered-file)
1929 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1935
1936 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0")
1937 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1")
1938 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2")
1939 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-loops-and-local-vars/3")
1940 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4")
1941 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5")
1942 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6")
1943 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7")
1944 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8")
1945 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9")
1946 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/10")
1947 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/11")
1948 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/12")
1949 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13")
1950 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-loops-and-local-vars/14")
1951 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/15")
1952 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16")
1953 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17")
1954 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18")
1955 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19")
1956 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20")
1957 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21")
1958 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/22")
1959 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23")
1960 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24")
1961
1962 89/<- %esp 5/r32/ebp
1963 5d/pop-to-ebp
1964 c3/return
1965
1966 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars:
1967
1968 55/push-ebp
1969 89/<- %ebp 4/r32/esp
1970
1971 (clear-stream _test-input-stream)
1972 (clear-stream $_test-input-buffered-file->buffer)
1973 (clear-stream _test-output-stream)
1974 (clear-stream $_test-output-buffered-file->buffer)
1975
1976 (write _test-input-stream "fn foo {\n")
1977 (write _test-input-stream " a: {\n")
1978 (write _test-input-stream " var x: int\n")
1979 (write _test-input-stream " {\n")
1980 (write _test-input-stream " var y: int\n")
1981 (write _test-input-stream " break-if->= a\n")
1982 (write _test-input-stream " increment x\n")
1983 (write _test-input-stream " loop\n")
1984 (write _test-input-stream " }\n")
1985 (write _test-input-stream " }\n")
1986 (write _test-input-stream "}\n")
1987
1988 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1989 (flush _test-output-buffered-file)
1990 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
1996
1997 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0")
1998 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1")
1999 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2")
2000 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/3")
2001 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4")
2002 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5")
2003 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6")
2004 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7")
2005 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/8")
2006 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9")
2007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10")
2008 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/11")
2009 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12")
2010 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/13")
2011 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/14")
2012 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/15")
2013 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/16")
2014 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17")
2015 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/18")
2016 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/19")
2017 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/20")
2018 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21")
2019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22")
2020 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/23")
2021 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24")
2022 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25")
2023 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26")
2024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27")
2025 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28")
2026 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/29")
2027 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/30")
2028 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31")
2029
2030 89/<- %esp 5/r32/ebp
2031 5d/pop-to-ebp
2032 c3/return
2033
2034 test-convert-function-with-nonlocal-unconditional-break-and-local-vars:
2035
2036 55/push-ebp
2037 89/<- %ebp 4/r32/esp
2038
2039 (clear-stream _test-input-stream)
2040 (clear-stream $_test-input-buffered-file->buffer)
2041 (clear-stream _test-output-stream)
2042 (clear-stream $_test-output-buffered-file->buffer)
2043
2044 (write _test-input-stream "fn foo {\n")
2045 (write _test-input-stream " a: {\n")
2046 (write _test-input-stream " var x: int\n")
2047 (write _test-input-stream " {\n")
2048 (write _test-input-stream " var y: int\n")
2049 (write _test-input-stream " break a\n")
2050 (write _test-input-stream " increment x\n")
2051 (write _test-input-stream " }\n")
2052 (write _test-input-stream " }\n")
2053 (write _test-input-stream "}\n")
2054
2055 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2056 (flush _test-output-buffered-file)
2057 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2063
2064 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0")
2065 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1")
2066 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2")
2067 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/3")
2068 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4")
2069 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5")
2070 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6")
2071 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7")
2072 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8")
2073 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9")
2074 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10")
2075 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11")
2076 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/12")
2077 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/13")
2078 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/14")
2079 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15")
2080 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16")
2081 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/17")
2082 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18")
2083 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19")
2084 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20")
2085 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21")
2086 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22")
2087 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/23")
2088 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24")
2089 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25")
2090
2091 89/<- %esp 5/r32/ebp
2092 5d/pop-to-ebp
2093 c3/return
2094
2095 test-convert-function-with-unconditional-break-and-local-vars:
2096
2097 55/push-ebp
2098 89/<- %ebp 4/r32/esp
2099
2100 (clear-stream _test-input-stream)
2101 (clear-stream $_test-input-buffered-file->buffer)
2102 (clear-stream _test-output-stream)
2103 (clear-stream $_test-output-buffered-file->buffer)
2104
2105 (write _test-input-stream "fn foo {\n")
2106 (write _test-input-stream " {\n")
2107 (write _test-input-stream " var x: int\n")
2108 (write _test-input-stream " {\n")
2109 (write _test-input-stream " var y: int\n")
2110 (write _test-input-stream " break\n")
2111 (write _test-input-stream " increment x\n")
2112 (write _test-input-stream " }\n")
2113 (write _test-input-stream " }\n")
2114 (write _test-input-stream "}\n")
2115
2116 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2117 (flush _test-output-buffered-file)
2118 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2124
2125 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0")
2126 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1")
2127 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2")
2128 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3")
2129 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4")
2130 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5")
2131 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6")
2132 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7")
2133 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8")
2134 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9")
2135 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10")
2136 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11")
2137 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/12")
2138 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13")
2139 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14")
2140 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/15")
2141 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16")
2142 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17")
2143 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18")
2144 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19")
2145 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20")
2146 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21")
2147 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22")
2148 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23")
2149
2150 89/<- %esp 5/r32/ebp
2151 5d/pop-to-ebp
2152 c3/return
2153
2154 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars:
2155
2156 55/push-ebp
2157 89/<- %ebp 4/r32/esp
2158
2159 (clear-stream _test-input-stream)
2160 (clear-stream $_test-input-buffered-file->buffer)
2161 (clear-stream _test-output-stream)
2162 (clear-stream $_test-output-buffered-file->buffer)
2163
2164 (write _test-input-stream "fn foo {\n")
2165 (write _test-input-stream " a: {\n")
2166 (write _test-input-stream " var x: int\n")
2167 (write _test-input-stream " {\n")
2168 (write _test-input-stream " var y: int\n")
2169 (write _test-input-stream " loop a\n")
2170 (write _test-input-stream " increment x\n")
2171 (write _test-input-stream " }\n")
2172 (write _test-input-stream " }\n")
2173 (write _test-input-stream "}\n")
2174
2175 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2176 (flush _test-output-buffered-file)
2177 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2183
2184 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0")
2185 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1")
2186 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2")
2187 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/3")
2188 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4")
2189 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5")
2190 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6")
2191 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7")
2192 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8")
2193 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9")
2194 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10")
2195 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11")
2196 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/12")
2197 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/13")
2198 (check-next-stream-line-equal _test-output-stream " e9/jump a:loop/disp32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/14")
2199 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15")
2200 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16")
2201 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/17")
2202 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18")
2203 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19")
2204 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20")
2205 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21")
2206 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22")
2207 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/23")
2208 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24")
2209 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25")
2210
2211 89/<- %esp 5/r32/ebp
2212 5d/pop-to-ebp
2213 c3/return
2214
2215 test-convert-function-with-local-array-var-in-mem:
2216
2217 55/push-ebp
2218 89/<- %ebp 4/r32/esp
2219
2220 (clear-stream _test-input-stream)
2221 (clear-stream $_test-input-buffered-file->buffer)
2222 (clear-stream _test-output-stream)
2223 (clear-stream $_test-output-buffered-file->buffer)
2224
2225 (write _test-input-stream "fn foo {\n")
2226 (write _test-input-stream " var x: (array int 3)\n")
2227 (write _test-input-stream "}\n")
2228
2229 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2230 (flush _test-output-buffered-file)
2231 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2237
2238 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0")
2239 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1")
2240 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2")
2241 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3")
2242 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4")
2243 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5")
2244
2245 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7")
2246 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8")
2247
2248 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-function-with-local-array-var-in-mem/9")
2249
2250 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10")
2251 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11")
2252 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12")
2253 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13")
2254 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14")
2255 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15")
2256
2257 89/<- %esp 5/r32/ebp
2258 5d/pop-to-ebp
2259 c3/return
2260
2261 test-convert-address:
2262
2263 55/push-ebp
2264 89/<- %ebp 4/r32/esp
2265
2266 (clear-stream _test-input-stream)
2267 (clear-stream $_test-input-buffered-file->buffer)
2268 (clear-stream _test-output-stream)
2269 (clear-stream $_test-output-buffered-file->buffer)
2270
2271 (write _test-input-stream "fn foo {\n")
2272 (write _test-input-stream " var a: int\n")
2273 (write _test-input-stream " var b/eax: (addr int) <- address a\n")
2274 (write _test-input-stream "}\n")
2275
2276 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2277 (flush _test-output-buffered-file)
2278 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2284
2285 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0")
2286 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1")
2287 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2")
2288 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3")
2289 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4")
2290 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5")
2291 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6")
2292 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7")
2293 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8")
2294 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9")
2295 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10")
2296 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11")
2297 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12")
2298 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13")
2299 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14")
2300 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15")
2301 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16")
2302
2303 89/<- %esp 5/r32/ebp
2304 5d/pop-to-ebp
2305 c3/return
2306
2307 test-convert-length-of-array:
2308
2309 55/push-ebp
2310 89/<- %ebp 4/r32/esp
2311
2312 (clear-stream _test-input-stream)
2313 (clear-stream $_test-input-buffered-file->buffer)
2314 (clear-stream _test-output-stream)
2315 (clear-stream $_test-output-buffered-file->buffer)
2316
2317 (write _test-input-stream "fn foo a: (addr array int) {\n")
2318 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n")
2319 (write _test-input-stream " var c/eax: int <- length b\n")
2320 (write _test-input-stream "}\n")
2321
2322 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2323 (flush _test-output-buffered-file)
2324 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2330
2331 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0")
2332 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1")
2333 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2")
2334 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3")
2335 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4")
2336 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5")
2337 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6")
2338 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7")
2339 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *eax 0x00000000/r32" "F - test-convert-length-of-array/9")
2340 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/11")
2341 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/12")
2342 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/13")
2343 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/14")
2344 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/15")
2345 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/16")
2346 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/17")
2347
2348 89/<- %esp 5/r32/ebp
2349 5d/pop-to-ebp
2350 c3/return
2351
2352 test-convert-length-of-array-on-stack:
2353
2354 55/push-ebp
2355 89/<- %ebp 4/r32/esp
2356
2357 (clear-stream _test-input-stream)
2358 (clear-stream $_test-input-buffered-file->buffer)
2359 (clear-stream _test-output-stream)
2360 (clear-stream $_test-output-buffered-file->buffer)
2361
2362 (write _test-input-stream "fn foo {\n")
2363 (write _test-input-stream " var a: (array int 3)\n")
2364 (write _test-input-stream " var b/eax: int <- length a\n")
2365 (write _test-input-stream "}\n")
2366
2367 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2368 (flush _test-output-buffered-file)
2369 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2375
2376 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0")
2377 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1")
2378 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2")
2379 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3")
2380 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4")
2381 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5")
2382
2383 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6")
2384 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7")
2385 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8")
2386 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9")
2387 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/10")
2388 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/11")
2389 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/12")
2390 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/13")
2391 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/14")
2392 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/15")
2393 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/16")
2394 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/17")
2395
2396 89/<- %esp 5/r32/ebp
2397 5d/pop-to-ebp
2398 c3/return
2399
2400 test-convert-index-into-array:
2401
2402 55/push-ebp
2403 89/<- %ebp 4/r32/esp
2404
2405 (clear-stream _test-input-stream)
2406 (clear-stream $_test-input-buffered-file->buffer)
2407 (clear-stream _test-output-stream)
2408 (clear-stream $_test-output-buffered-file->buffer)
2409
2410 (write _test-input-stream "fn foo {\n")
2411 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2412 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2413 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2414 (write _test-input-stream "}\n")
2415
2416 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2417 (flush _test-output-buffered-file)
2418 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2424
2425 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0")
2426 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1")
2427 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2")
2428 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3")
2429 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4")
2430 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5")
2431 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6")
2432 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7")
2433 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8")
2434 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9")
2435 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11")
2436 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13")
2437 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14")
2438 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15")
2439 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16")
2440 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17")
2441 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18")
2442 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19")
2443 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20")
2444
2445 89/<- %esp 5/r32/ebp
2446 5d/pop-to-ebp
2447 c3/return
2448
2449 test-convert-index-into-array-with-literal:
2450
2451 55/push-ebp
2452 89/<- %ebp 4/r32/esp
2453
2454 (clear-stream _test-input-stream)
2455 (clear-stream $_test-input-buffered-file->buffer)
2456 (clear-stream _test-output-stream)
2457 (clear-stream $_test-output-buffered-file->buffer)
2458
2459 (write _test-input-stream "fn foo {\n")
2460 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2461 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2462 (write _test-input-stream "}\n")
2463
2464 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2465 (flush _test-output-buffered-file)
2466 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2472
2473 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0")
2474 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1")
2475 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2")
2476 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3")
2477 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4")
2478 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5")
2479 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6")
2480 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7")
2481
2482 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8")
2483 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9")
2484 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10")
2485 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11")
2486 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12")
2487 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13")
2488 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14")
2489 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15")
2490
2491 89/<- %esp 5/r32/ebp
2492 5d/pop-to-ebp
2493 c3/return
2494
2495 test-convert-index-into-array-on-stack:
2496
2497 55/push-ebp
2498 89/<- %ebp 4/r32/esp
2499
2500 (clear-stream _test-input-stream)
2501 (clear-stream $_test-input-buffered-file->buffer)
2502 (clear-stream _test-output-stream)
2503 (clear-stream $_test-output-buffered-file->buffer)
2504
2505 (write _test-input-stream "fn foo {\n")
2506 (write _test-input-stream " var arr: (array int 3)\n")
2507 (write _test-input-stream " var idx/eax: int <- copy 2\n")
2508 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2509 (write _test-input-stream "}\n")
2510
2511 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2512 (flush _test-output-buffered-file)
2513 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2519
2520 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0")
2521 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1")
2522 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2")
2523 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3")
2524 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4")
2525 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5")
2526
2527 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6")
2528 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7")
2529
2530 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8")
2531 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9")
2532
2533 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + eax<<0x00000002 + 0xfffffff4) 0x00000000/r32" "F - test-convert-index-into-array-on-stack/10")
2534
2535 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11")
2536
2537 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12")
2538
2539 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13")
2540 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14")
2541 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15")
2542 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16")
2543 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17")
2544 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18")
2545
2546 89/<- %esp 5/r32/ebp
2547 5d/pop-to-ebp
2548 c3/return
2549
2550 test-convert-index-into-array-on-stack-with-literal:
2551
2552 55/push-ebp
2553 89/<- %ebp 4/r32/esp
2554
2555 (clear-stream _test-input-stream)
2556 (clear-stream $_test-input-buffered-file->buffer)
2557 (clear-stream _test-output-stream)
2558 (clear-stream $_test-output-buffered-file->buffer)
2559
2560 (write _test-input-stream "fn foo {\n")
2561 (write _test-input-stream " var arr: (array int 3)\n")
2562 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2563 (write _test-input-stream "}\n")
2564
2565 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2566 (flush _test-output-buffered-file)
2567 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2573
2574 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0")
2575 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1")
2576 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2")
2577 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3")
2578 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4")
2579 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5")
2580
2581 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6")
2582 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7")
2583
2584 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8")
2585
2586 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xfffffffc) 0x00000000/r32" "F - test-convert-index-into-array-on-stack-with-literal/9")
2587
2588 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10")
2589
2590 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack-with-literal/11")
2591
2592 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12")
2593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13")
2594 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14")
2595 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15")
2596 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16")
2597 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17")
2598
2599 89/<- %esp 5/r32/ebp
2600 5d/pop-to-ebp
2601 c3/return
2602
2603 test-convert-index-into-array-using-offset:
2604
2605 55/push-ebp
2606 89/<- %ebp 4/r32/esp
2607
2608 (clear-stream _test-input-stream)
2609 (clear-stream $_test-input-buffered-file->buffer)
2610 (clear-stream _test-output-stream)
2611 (clear-stream $_test-output-buffered-file->buffer)
2612
2613 (write _test-input-stream "fn foo {\n")
2614 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2615 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2616 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2617 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2618 (write _test-input-stream "}\n")
2619
2620 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2621 (flush _test-output-buffered-file)
2622 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2628
2629 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0")
2630 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1")
2631 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2")
2632 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3")
2633 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4")
2634 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5")
2635 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6")
2636 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7")
2637 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8")
2638 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9")
2639 (check-next-stream-line-equal _test-output-stream " 69/multiply 0x00000004/imm32 %ecx 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10")
2640 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/11")
2641 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12")
2642 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13")
2643 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14")
2644 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15")
2645 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16")
2646 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17")
2647 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18")
2648 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19")
2649
2650 89/<- %esp 5/r32/ebp
2651 5d/pop-to-ebp
2652 c3/return
2653
2654 test-convert-index-into-array-using-offset-on-stack:
2655
2656 55/push-ebp
2657 89/<- %ebp 4/r32/esp
2658
2659 (clear-stream _test-input-stream)
2660 (clear-stream $_test-input-buffered-file->buffer)
2661 (clear-stream _test-output-stream)
2662 (clear-stream $_test-output-buffered-file->buffer)
2663
2664 (write _test-input-stream "fn foo {\n")
2665 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2666 (write _test-input-stream " var idx: int\n")
2667 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2668 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2669 (write _test-input-stream "}\n")
2670
2671 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2672 (flush _test-output-buffered-file)
2673 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2679
2680 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0")
2681 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1")
2682 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2")
2683 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3")
2684 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4")
2685 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5")
2686 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6")
2687 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/7")
2688 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8")
2689 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9")
2690 (check-next-stream-line-equal _test-output-stream " 69/multiply 0x00000004/imm32 *(ebp+0xfffffff8) 0x00000001/r32" "F - test-convert-index-into-array-using-offset-on-stack/10")
2691 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset-on-stack/11")
2692 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12")
2693 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-using-offset-on-stack/13")
2694 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14")
2695 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15")
2696 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16")
2697 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17")
2698 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18")
2699 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19")
2700 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20")
2701
2702 89/<- %esp 5/r32/ebp
2703 5d/pop-to-ebp
2704 c3/return
2705
2706 test-convert-function-and-type-definition:
2707
2708 55/push-ebp
2709 89/<- %ebp 4/r32/esp
2710
2711 (clear-stream _test-input-stream)
2712 (clear-stream $_test-input-buffered-file->buffer)
2713 (clear-stream _test-output-stream)
2714 (clear-stream $_test-output-buffered-file->buffer)
2715
2716 (write _test-input-stream "fn foo a: (addr t) {\n")
2717 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n")
2718 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n")
2719 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n")
2720 (write _test-input-stream "}\n")
2721 (write _test-input-stream "type t {\n")
2722 (write _test-input-stream " x: int\n")
2723 (write _test-input-stream " y: int\n")
2724 (write _test-input-stream "}\n")
2725
2726 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2727 (flush _test-output-buffered-file)
2728 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2734
2735 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0")
2736 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1")
2737 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2")
2738 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3")
2739 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4")
2740 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5")
2741 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6")
2742 (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7")
2743 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8")
2744 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9")
2745 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11")
2746 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13")
2747 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14")
2748 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15")
2749 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16")
2750 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17")
2751 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18")
2752 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19")
2753 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20")
2754
2755 89/<- %esp 5/r32/ebp
2756 5d/pop-to-ebp
2757 c3/return
2758
2759 test-convert-function-with-local-var-with-user-defined-type:
2760
2761 55/push-ebp
2762 89/<- %ebp 4/r32/esp
2763
2764 (clear-stream _test-input-stream)
2765 (clear-stream $_test-input-buffered-file->buffer)
2766 (clear-stream _test-output-stream)
2767 (clear-stream $_test-output-buffered-file->buffer)
2768
2769 (write _test-input-stream "fn foo {\n")
2770 (write _test-input-stream " var a: t\n")
2771 (write _test-input-stream "}\n")
2772 (write _test-input-stream "type t {\n")
2773 (write _test-input-stream " x: int\n")
2774 (write _test-input-stream " y: int\n")
2775 (write _test-input-stream "}\n")
2776
2777 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2778 (flush _test-output-buffered-file)
2779 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2785
2786 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0")
2787 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1")
2788 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2")
2789 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type/3")
2790 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4")
2791 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5")
2792 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6")
2793 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7")
2794 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/8")
2795 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9")
2796 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10")
2797 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11")
2798 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type/12")
2799 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13")
2800 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14")
2801
2802 89/<- %esp 5/r32/ebp
2803 5d/pop-to-ebp
2804 c3/return
2805
2806 test-convert-get-of-type-on-stack:
2807
2808 55/push-ebp
2809 89/<- %ebp 4/r32/esp
2810
2811 (clear-stream _test-input-stream)
2812 (clear-stream $_test-input-buffered-file->buffer)
2813 (clear-stream _test-output-stream)
2814 (clear-stream $_test-output-buffered-file->buffer)
2815
2816 (write _test-input-stream "fn foo {\n")
2817 (write _test-input-stream " var a: t\n")
2818 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n")
2819 (write _test-input-stream "}\n")
2820 (write _test-input-stream "type t {\n")
2821 (write _test-input-stream " x: int\n")
2822 (write _test-input-stream " y: int\n")
2823 (write _test-input-stream "}\n")
2824
2825 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2826 (flush _test-output-buffered-file)
2827 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2833
2834 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-of-type-on-stack/0")
2835 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-of-type-on-stack/1")
2836 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-of-type-on-stack/2")
2837 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-of-type-on-stack/3")
2838 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-of-type-on-stack/4")
2839 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-of-type-on-stack/5")
2840
2841 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/6")
2842 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/7")
2843
2844 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-of-type-on-stack/8")
2845
2846 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-of-type-on-stack/9")
2847
2848 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-of-type-on-stack/10")
2849
2850 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-of-type-on-stack/11")
2851 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-of-type-on-stack/12")
2852 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-of-type-on-stack/13")
2853 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-of-type-on-stack/14")
2854 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-of-type-on-stack/15")
2855 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-of-type-on-stack/16")
2856 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-of-type-on-stack/17")
2857
2858 89/<- %esp 5/r32/ebp
2859 5d/pop-to-ebp
2860 c3/return
2861
2862 test-convert-array-of-user-defined-types:
2863
2864 55/push-ebp
2865 89/<- %ebp 4/r32/esp
2866
2867 (clear-stream _test-input-stream)
2868 (clear-stream $_test-input-buffered-file->buffer)
2869 (clear-stream _test-output-stream)
2870 (clear-stream $_test-output-buffered-file->buffer)
2871
2872 (write _test-input-stream "type t {\n")
2873 (write _test-input-stream " x: int\n")
2874 (write _test-input-stream " y: int\n")
2875 (write _test-input-stream "}\n")
2876 (write _test-input-stream "fn foo {\n")
2877 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n")
2878 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2879 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2880 (write _test-input-stream "}\n")
2881
2882 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2883 (flush _test-output-buffered-file)
2884 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
2890
2891 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0")
2892 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1")
2893 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2")
2894 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3")
2895 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4")
2896 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5")
2897 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6")
2898 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7")
2899 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8")
2900 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9")
2901 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000003 + 4) 0x00000000/r32" "F - test-convert-array-of-user-defined-types/11")
2902 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13")
2903 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14")
2904 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15")
2905 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16")
2906 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17")
2907 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18")
2908 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19")
2909 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20")
2910
2911 89/<- %esp 5/r32/ebp
2912 5d/pop-to-ebp
2913 c3/return
2914
2915
2916
2917
2918
2919 parse-mu:
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952 55/push-ebp
2953 89/<- %ebp 4/r32/esp
2954
2955 50/push-eax
2956 51/push-ecx
2957 52/push-edx
2958 53/push-ebx
2959 56/push-esi
2960 57/push-edi
2961
2962 81 5/subop/subtract %esp 0x200/imm32
2963 68/push 0x200/imm32/length
2964 68/push 0/imm32/read
2965 68/push 0/imm32/write
2966 89/<- %ecx 4/r32/esp
2967
2968 68/push 0/imm32/end
2969 68/push 0/imm32/start
2970 89/<- %edx 4/r32/esp
2971
2972 bf/copy-to-edi _Program-functions/imm32
2973
2974 be/copy-to-esi _Program-types/imm32
2975
2976 81 5/subop/subtract %esp 0x400/imm32
2977 68/push 0x400/imm32/length
2978 68/push 0/imm32/top
2979 89/<- %ebx 4/r32/esp
2980 {
2981 $parse-mu:line-loop:
2982 (clear-stream %ecx)
2983 (read-line-buffered *(ebp+8) %ecx)
2984
2985 81 7/subop/compare *ecx 0/imm32
2986 0f 84/jump-if-= break/disp32
2987 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
2993 (next-mu-token %ecx %edx)
2994
2995 (slice-empty? %edx)
2996 3d/compare-eax-and 0/imm32/false
2997 0f 85/jump-if-!= loop/disp32
2998
2999
3000 8b/-> *edx 0/r32/eax
3001 8a/copy-byte *eax 0/r32/AL
3002 81 4/subop/and %eax 0xff/imm32
3003
3004 3d/compare-eax-and 0x23/imm32/hash
3005 0f 84/jump-if-= loop/disp32
3006
3007 {
3008 $parse-mu:fn:
3009 (slice-equal? %edx "fn")
3010 3d/compare-eax-and 0/imm32/false
3011 0f 84/jump-if-= break/disp32
3012
3013 (allocate Heap *Function-size)
3014 (zero-out %eax *Function-size)
3015 (clear-stack %ebx)
3016 (populate-mu-function-header %ecx %eax %ebx)
3017 (populate-mu-function-body *(ebp+8) %eax %ebx)
3018
3019 89/<- *edi 0/r32/eax
3020
3021 8d/address-> *(eax+0x14) 7/r32/edi
3022 e9/jump $parse-mu:line-loop/disp32
3023 }
3024
3025 {
3026 $parse-mu:type:
3027 (slice-equal? %edx "type")
3028 3d/compare-eax-and 0/imm32
3029 0f 84/jump-if-= break/disp32
3030 (next-mu-token %ecx %edx)
3031
3032 (pos-or-insert-slice Type-id %edx)
3033
3034 (find-or-create-typeinfo %eax)
3035
3036 (populate-mu-type *(ebp+8) %eax)
3037 e9/jump $parse-mu:line-loop/disp32
3038 }
3039
3040 e9/jump $parse-mu:error1/disp32
3041 }
3042 $parse-mu:end:
3043
3044 81 0/subop/add %esp 0x630/imm32
3045
3046 5f/pop-to-edi
3047 5e/pop-to-esi
3048 5b/pop-to-ebx
3049 5a/pop-to-edx
3050 59/pop-to-ecx
3051 58/pop-to-eax
3052
3053 89/<- %esp 5/r32/ebp
3054 5d/pop-to-ebp
3055 c3/return
3056
3057 $parse-mu:error1:
3058
3059 (write-buffered Stderr "unexpected top-level command: ")
3060 (write-slice-buffered Stderr %edx)
3061 (write-buffered Stderr "\n")
3062 (flush Stderr)
3063
3064 bb/copy-to-ebx 1/imm32
3065 b8/copy-to-eax 1/imm32/exit
3066 cd/syscall 0x80/imm8
3067
3068
3069 $parse-mu:error2:
3070
3071 (print-int32-buffered Stderr *ebx)
3072 (write-buffered Stderr " vars not reclaimed after fn '")
3073 (write-slice-buffered Stderr *eax)
3074 (write-buffered Stderr "'\n")
3075 (flush Stderr)
3076
3077 bb/copy-to-ebx 1/imm32
3078 b8/copy-to-eax 1/imm32/exit
3079 cd/syscall 0x80/imm8
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093 populate-mu-function-header:
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122 55/push-ebp
3123 89/<- %ebp 4/r32/esp
3124
3125 50/push-eax
3126 51/push-ecx
3127 52/push-edx
3128 53/push-ebx
3129 57/push-edi
3130
3131 8b/-> *(ebp+0xc) 7/r32/edi
3132
3133 68/push 0/imm32/end
3134 68/push 0/imm32/start
3135 89/<- %ecx 4/r32/esp
3136
3137 (next-mu-token *(ebp+8) %ecx)
3138
3139
3140
3141 (slice-equal? %ecx "{")
3142 3d/compare-eax-and 0/imm32/false
3143 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3144
3145 (slice-equal? %ecx "->")
3146 3d/compare-eax-and 0/imm32/false
3147 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3148
3149 (slice-equal? %ecx "}")
3150 3d/compare-eax-and 0/imm32/false
3151 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3152
3153 (slice-to-string Heap %ecx)
3154 89/<- *edi 0/r32/eax
3155
3156 89/<- *(edi+4) 0/r32/eax
3157
3158 {
3159 $populate-mu-function-header:check-for-inout:
3160 (next-mu-token *(ebp+8) %ecx)
3161
3162 (slice-equal? %ecx "{")
3163 3d/compare-eax-and 0/imm32/false
3164 0f 85/jump-if-!= $populate-mu-function-header:done/disp32
3165
3166 (slice-equal? %ecx "->")
3167 3d/compare-eax-and 0/imm32/false
3168 0f 85/jump-if-!= break/disp32
3169
3170 (slice-equal? %ecx "}")
3171 3d/compare-eax-and 0/imm32/false
3172 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3173
3174 (parse-var-with-type %ecx *(ebp+8))
3175 89/<- %ebx 0/r32/eax
3176
3177 81 7/subop/compare *(ebx+0x10) 0/imm32
3178 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32
3179
3180
3181
3182 (append-list Heap %ebx *(edi+8))
3183 89/<- *(edi+8) 0/r32/eax
3184
3185 (push *(ebp+0x10) %ebx)
3186
3187 e9/jump loop/disp32
3188 }
3189
3190 {
3191 $populate-mu-function-header:check-for-out:
3192 (next-mu-token *(ebp+8) %ecx)
3193
3194 (slice-equal? %ecx "{")
3195 3d/compare-eax-and 0/imm32/false
3196 0f 85/jump-if-!= break/disp32
3197
3198 (slice-equal? %ecx "->")
3199 3d/compare-eax-and 0/imm32/false
3200 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3201
3202 (slice-equal? %ecx "}")
3203 3d/compare-eax-and 0/imm32/false
3204 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3205
3206 (parse-var-with-type %ecx *(ebp+8))
3207 89/<- %ebx 0/r32/eax
3208
3209 81 7/subop/compare *(ebx+0x10) 0/imm32
3210 0f 84/jump-if-= $populate-mu-function-header:error3/disp32
3211 (append-list Heap %ebx *(edi+0xc))
3212 89/<- *(edi+0xc) 0/r32/eax
3213 e9/jump loop/disp32
3214 }
3215 $populate-mu-function-header:done:
3216 (check-no-tokens-left *(ebp+8))
3217 $populate-mu-function-header:end:
3218
3219 81 0/subop/add %esp 8/imm32
3220
3221 5f/pop-to-edi
3222 5b/pop-to-ebx
3223 5a/pop-to-edx
3224 59/pop-to-ecx
3225 58/pop-to-eax
3226
3227 89/<- %esp 5/r32/ebp
3228 5d/pop-to-ebp
3229 c3/return
3230
3231 $populate-mu-function-header:error1:
3232
3233 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
3234 (flush Stderr)
3235 (rewind-stream *(ebp+8))
3236 (write-stream 2 *(ebp+8))
3237 (write-buffered Stderr "'\n")
3238 (flush Stderr)
3239
3240 bb/copy-to-ebx 1/imm32
3241 b8/copy-to-eax 1/imm32/exit
3242 cd/syscall 0x80/imm8
3243
3244
3245 $populate-mu-function-header:error2:
3246
3247 (write-buffered Stderr "function input '")
3248 (write-buffered Stderr *ebx)
3249 (write-buffered Stderr "' cannot be in a register")
3250 (flush Stderr)
3251
3252 bb/copy-to-ebx 1/imm32
3253 b8/copy-to-eax 1/imm32/exit
3254 cd/syscall 0x80/imm8
3255
3256
3257 $populate-mu-function-header:error3:
3258
3259 (write-buffered Stderr "function input '")
3260 (write-buffered Stderr *eax)
3261 (write-buffered Stderr " must be in a register'")
3262 (flush Stderr)
3263 (rewind-stream *(ebp+8))
3264 (write-stream 2 *(ebp+8))
3265 (write-buffered Stderr "'\n")
3266 (flush Stderr)
3267
3268 bb/copy-to-ebx 1/imm32
3269 b8/copy-to-eax 1/imm32/exit
3270 cd/syscall 0x80/imm8
3271
3272
3273 test-function-header-with-arg:
3274
3275 55/push-ebp
3276 89/<- %ebp 4/r32/esp
3277
3278 (clear-stream _test-input-stream)
3279 (write _test-input-stream "foo n: int {\n")
3280
3281 2b/subtract-> *Function-size 4/r32/esp
3282 89/<- %ecx 4/r32/esp
3283 (zero-out %ecx *Function-size)
3284
3285 81 5/subop/subtract %esp 0x10/imm32
3286 68/push 0x10/imm32/length
3287 68/push 0/imm32/top
3288 89/<- %ebx 4/r32/esp
3289
3290 (populate-mu-function-header _test-input-stream %ecx %ebx)
3291
3292 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
3293
3294 8b/-> *(ecx+8) 2/r32/edx
3295
3296 8b/-> *edx 3/r32/ebx
3297 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
3298 8b/-> *(ebx+4) 3/r32/ebx
3299 (check-ints-equal *ebx 1 "F - test-function-header-with-arg/inout:0/type:0")
3300 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-arg/inout:0/type:1")
3301
3302 89/<- %esp 5/r32/ebp
3303 5d/pop-to-ebp
3304 c3/return
3305
3306 test-function-header-with-multiple-args:
3307
3308 55/push-ebp
3309 89/<- %ebp 4/r32/esp
3310
3311 (clear-stream _test-input-stream)
3312 (write _test-input-stream "foo a: int, b: int c: int {\n")
3313
3314 2b/subtract-> *Function-size 4/r32/esp
3315 89/<- %ecx 4/r32/esp
3316 (zero-out %ecx *Function-size)
3317
3318 81 5/subop/subtract %esp 0x10/imm32
3319 68/push 0x10/imm32/length
3320 68/push 0/imm32/top
3321 89/<- %ebx 4/r32/esp
3322
3323 (populate-mu-function-header _test-input-stream %ecx %ebx)
3324
3325 (check-strings-equal *ecx "foo")
3326
3327 8b/-> *(ecx+8) 2/r32/edx
3328 $test-function-header-with-multiple-args:inout0:
3329
3330 8b/-> *edx 3/r32/ebx
3331 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
3332 8b/-> *(ebx+4) 3/r32/ebx
3333 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:0/type:0")
3334 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:0/type:1")
3335
3336 8b/-> *(edx+4) 2/r32/edx
3337 $test-function-header-with-multiple-args:inout1:
3338
3339 8b/-> *edx 3/r32/ebx
3340 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
3341 8b/-> *(ebx+4) 3/r32/ebx
3342 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:1/type:0")
3343 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:1/type:1")
3344
3345 8b/-> *(edx+4) 2/r32/edx
3346 $test-function-header-with-multiple-args:inout2:
3347
3348 8b/-> *edx 3/r32/ebx
3349 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
3350 8b/-> *(ebx+4) 3/r32/ebx
3351 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:2/type:0")
3352 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args/inout:2/type:1")
3353
3354 89/<- %esp 5/r32/ebp
3355 5d/pop-to-ebp
3356 c3/return
3357
3358 test-function-with-multiple-args-and-outputs:
3359
3360 55/push-ebp
3361 89/<- %ebp 4/r32/esp
3362
3363 (clear-stream _test-input-stream)
3364 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
3365
3366 2b/subtract-> *Function-size 4/r32/esp
3367 89/<- %ecx 4/r32/esp
3368 (zero-out %ecx *Function-size)
3369
3370 81 5/subop/subtract %esp 0x10/imm32
3371 68/push 0x10/imm32/length
3372 68/push 0/imm32/top
3373 89/<- %ebx 4/r32/esp
3374
3375 (populate-mu-function-header _test-input-stream %ecx %ebx)
3376
3377 (check-strings-equal *ecx "foo")
3378
3379 8b/-> *(ecx+8) 2/r32/edx
3380
3381 8b/-> *edx 3/r32/ebx
3382 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0")
3383 8b/-> *(ebx+4) 3/r32/ebx
3384 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0")
3385 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1")
3386
3387 8b/-> *(edx+4) 2/r32/edx
3388
3389 8b/-> *edx 3/r32/ebx
3390 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1")
3391 8b/-> *(ebx+4) 3/r32/ebx
3392 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0")
3393 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1")
3394
3395 8b/-> *(edx+4) 2/r32/edx
3396
3397 8b/-> *edx 3/r32/ebx
3398 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2")
3399 8b/-> *(ebx+4) 3/r32/ebx
3400 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0")
3401 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1")
3402
3403 8b/-> *(ecx+0xc) 2/r32/edx
3404
3405 8b/-> *edx 3/r32/ebx
3406 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0")
3407 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3408 8b/-> *(ebx+4) 3/r32/ebx
3409 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
3410 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
3411
3412 8b/-> *(edx+4) 2/r32/edx
3413
3414 8b/-> *edx 3/r32/ebx
3415 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args-and-outputs/output:1")
3416 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3417 8b/-> *(ebx+4) 3/r32/ebx
3418 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
3419 (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
3420
3421 89/<- %esp 5/r32/ebp
3422 5d/pop-to-ebp
3423 c3/return
3424
3425
3426
3427
3428
3429
3430
3431
3432 parse-var-with-type:
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450 55/push-ebp
3451 89/<- %ebp 4/r32/esp
3452
3453 51/push-ecx
3454 52/push-edx
3455 53/push-ebx
3456 56/push-esi
3457 57/push-edi
3458
3459 8b/-> *(ebp+8) 6/r32/esi
3460
3461 8b/-> *(esi+4) 1/r32/ecx
3462 49/decrement-ecx
3463 8a/copy-byte *ecx 1/r32/CL
3464 81 4/subop/and %ecx 0xff/imm32
3465 81 7/subop/compare %ecx 0x3a/imm32/colon
3466 0f 85/jump-if-!= $parse-var-with-type:abort/disp32
3467
3468 ff 1/subop/decrement *(esi+4)
3469
3470 68/push 0/imm32/end
3471 68/push 0/imm32/start
3472 89/<- %ecx 4/r32/esp
3473 $parse-var-with-type:parse-name:
3474 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
3475 $parse-var-with-type:create-var:
3476
3477 (new-var-from-slice Heap %ecx)
3478 89/<- %edi 0/r32/eax
3479
3480 $parse-var-with-type:save-register:
3481
3482 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx)
3483
3484 {
3485 $parse-var-with-type:write-register:
3486 (slice-empty? %ecx)
3487 3d/compare-eax-and 0/imm32/false
3488 75/jump-if-!= break/disp8
3489 (slice-to-string Heap %ecx)
3490 89/<- *(edi+0x10) 0/r32/eax
3491 }
3492 $parse-var-with-type:save-type:
3493 (parse-type Heap *(ebp+0xc))
3494
3495
3496
3497
3498 89/<- *(edi+4) 0/r32/eax
3499 $parse-var-with-type:end:
3500
3501 89/<- %eax 7/r32/edi
3502
3503 81 0/subop/add %esp 8/imm32
3504
3505 5f/pop-to-edi
3506 5e/pop-to-esi
3507 5b/pop-to-ebx
3508 5a/pop-to-edx
3509 59/pop-to-ecx
3510
3511 89/<- %esp 5/r32/ebp
3512 5d/pop-to-ebp
3513 c3/return
3514
3515 $parse-var-with-type:abort:
3516
3517 (write-buffered Stderr "var should have form 'name: type' in '")
3518 (flush Stderr)
3519 (rewind-stream *(ebp+0xc))
3520 (write-stream 2 *(ebp+0xc))
3521 (write-buffered Stderr "'\n")
3522 (flush Stderr)
3523
3524 bb/copy-to-ebx 1/imm32
3525 b8/copy-to-eax 1/imm32/exit
3526 cd/syscall 0x80/imm8
3527
3528
3529 parse-type:
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547 55/push-ebp
3548 89/<- %ebp 4/r32/esp
3549
3550 51/push-ecx
3551 52/push-edx
3552
3553 68/push 0/imm32
3554 68/push 0/imm32
3555 89/<- %ecx 4/r32/esp
3556
3557 (next-mu-token *(ebp+0xc) %ecx)
3558
3559
3560
3561
3562
3563 (slice-equal? %ecx "")
3564 3d/compare-eax-and 0/imm32/false
3565 0f 85/jump-if-!= $parse-type:abort/disp32
3566
3567 (slice-equal? %ecx "{")
3568 3d/compare-eax-and 0/imm32/false
3569 0f 85/jump-if-!= $parse-type:abort/disp32
3570
3571 (slice-equal? %ecx "}")
3572 3d/compare-eax-and 0/imm32/false
3573 0f 85/jump-if-!= $parse-type:abort/disp32
3574
3575 (slice-equal? %ecx "->")
3576 3d/compare-eax-and 0/imm32/false
3577 0f 85/jump-if-!= $parse-type:abort/disp32
3578
3579 (slice-equal? %ecx ")")
3580 3d/compare-eax-and 0/imm32/false
3581 b8/copy-to-eax 0/imm32
3582 0f 85/jump-if-!= $parse-type:end/disp32
3583
3584 (allocate *(ebp+8) *Tree-size)
3585 (zero-out %eax *Tree-size)
3586 89/<- %edx 0/r32/eax
3587 {
3588
3589 (slice-equal? %ecx "(")
3590 3d/compare-eax-and 0/imm32/false
3591 75/jump-if-!= break/disp8
3592
3593 {
3594 (is-hex-int? %ecx)
3595 3d/compare-eax-and 0/imm32/false
3596 74/jump-if-= break/disp8
3597 (parse-hex-int-from-slice %ecx)
3598 89/<- *edx 0/r32/eax
3599 e9/jump $parse-type:return-edx/disp32
3600 }
3601
3602 (pos-or-insert-slice Type-id %ecx)
3603
3604
3605
3606
3607 89/<- *edx 0/r32/eax
3608 e9/jump $parse-type:return-edx/disp32
3609 }
3610
3611
3612 (parse-type *(ebp+8) *(ebp+0xc))
3613
3614
3615 89/<- *edx 0/r32/eax
3616
3617 (parse-type-tree *(ebp+8) *(ebp+0xc))
3618
3619
3620
3621
3622 89/<- *(edx+4) 0/r32/eax
3623 $parse-type:return-edx:
3624 89/<- %eax 2/r32/edx
3625 $parse-type:end:
3626
3627 81 0/subop/add %esp 8/imm32
3628
3629 5a/pop-to-edx
3630 59/pop-to-ecx
3631
3632 89/<- %esp 5/r32/ebp
3633 5d/pop-to-ebp
3634 c3/return
3635
3636 $parse-type:abort:
3637
3638 (write-buffered Stderr "unexpected token when parsing type: '")
3639 (write-slice-buffered Stderr %ecx)
3640 (write-buffered Stderr "'\n")
3641 (flush Stderr)
3642
3643 bb/copy-to-ebx 1/imm32
3644 b8/copy-to-eax 1/imm32/exit
3645 cd/syscall 0x80/imm8
3646
3647
3648 parse-type-tree:
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659 55/push-ebp
3660 89/<- %ebp 4/r32/esp
3661
3662 51/push-ecx
3663 52/push-edx
3664
3665 (parse-type *(ebp+8) *(ebp+0xc))
3666
3667 3d/compare-eax-and 0/imm32
3668 74/jump-if-= $parse-type-tree:end/disp8
3669
3670 89/<- %ecx 0/r32/eax
3671
3672 (allocate *(ebp+8) *Tree-size)
3673 (zero-out %eax *Tree-size)
3674 89/<- %edx 0/r32/eax
3675
3676 89/<- *edx 1/r32/ecx
3677
3678 (parse-type-tree *(ebp+8) *(ebp+0xc))
3679 89/<- *(edx+4) 0/r32/eax
3680 $parse-type-tree:return-edx:
3681 89/<- %eax 2/r32/edx
3682 $parse-type-tree:end:
3683
3684 5a/pop-to-edx
3685 59/pop-to-ecx
3686
3687 89/<- %esp 5/r32/ebp
3688 5d/pop-to-ebp
3689 c3/return
3690
3691 next-mu-token:
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736 55/push-ebp
3737 89/<- %ebp 4/r32/esp
3738
3739 50/push-eax
3740 51/push-ecx
3741 56/push-esi
3742 57/push-edi
3743
3744 8b/-> *(ebp+8) 6/r32/esi
3745
3746 8b/-> *(ebp+0xc) 7/r32/edi
3747 $next-mu-token:start:
3748 (skip-chars-matching-whitespace %esi)
3749 $next-mu-token:check0:
3750
3751
3752 8b/-> *(esi+4) 1/r32/ecx
3753
3754 3b/compare 1/r32/ecx *esi
3755 c7 0/subop/copy *edi 0/imm32
3756 c7 0/subop/copy *(edi+4) 0/imm32
3757 0f 8d/jump-if->= $next-mu-token:end/disp32
3758
3759 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3760 89/<- *edi 0/r32/eax
3761
3762 31/xor %eax 0/r32/eax
3763 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
3764 {
3765 $next-mu-token:check-for-comma:
3766
3767 3d/compare-eax-and 0x2c/imm32/comma
3768 75/jump-if-!= break/disp8
3769
3770 ff 0/subop/increment *(esi+4)
3771
3772 e9/jump $next-mu-token:start/disp32
3773 }
3774 {
3775 $next-mu-token:check-for-comment:
3776
3777 3d/compare-eax-and 0x23/imm32/pound
3778 75/jump-if-!= break/disp8
3779
3780 e9/jump $next-mu-token:done/disp32
3781 }
3782 {
3783 $next-mu-token:check-for-string-literal:
3784
3785 3d/compare-eax-and 0x22/imm32/dquote
3786 75/jump-if-!= break/disp8
3787 (skip-string %esi)
3788
3789 e9/jump $next-mu-token:done/disp32
3790 }
3791 {
3792 $next-mu-token:check-for-open-paren:
3793
3794 3d/compare-eax-and 0x28/imm32/open-paren
3795 75/jump-if-!= break/disp8
3796
3797 ff 0/subop/increment *(esi+4)
3798
3799 e9/jump $next-mu-token:done/disp32
3800 }
3801 {
3802 $next-mu-token:check-for-close-paren:
3803
3804 3d/compare-eax-and 0x29/imm32/close-paren
3805 75/jump-if-!= break/disp8
3806
3807 ff 0/subop/increment *(esi+4)
3808
3809 e9/jump $next-mu-token:done/disp32
3810 }
3811 {
3812 $next-mu-token:regular-word-without-metadata:
3813
3814
3815 8b/-> *(esi+4) 1/r32/ecx
3816
3817 3b/compare *esi 1/r32/ecx
3818 7d/jump-if->= break/disp8
3819
3820 31/xor %eax 0/r32/eax
3821 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
3822
3823 3d/compare-eax-and 0x20/imm32/space
3824 74/jump-if-= break/disp8
3825
3826 3d/compare-eax-and 0xd/imm32/carriage-return
3827 74/jump-if-= break/disp8
3828
3829 3d/compare-eax-and 0xa/imm32/newline
3830 74/jump-if-= break/disp8
3831
3832 3d/compare-eax-and 0x28/imm32/open-paren
3833 0f 84/jump-if-= break/disp32
3834
3835 3d/compare-eax-and 0x29/imm32/close-paren
3836 0f 84/jump-if-= break/disp32
3837
3838 3d/compare-eax-and 0x2c/imm32/comma
3839 0f 84/jump-if-= break/disp32
3840
3841 ff 0/subop/increment *(esi+4)
3842
3843 e9/jump loop/disp32
3844 }
3845 $next-mu-token:done:
3846
3847 8b/-> *(esi+4) 1/r32/ecx
3848 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3849 89/<- *(edi+4) 0/r32/eax
3850 $next-mu-token:end:
3851
3852 5f/pop-to-edi
3853 5e/pop-to-esi
3854 59/pop-to-ecx
3855 58/pop-to-eax
3856
3857 89/<- %esp 5/r32/ebp
3858 5d/pop-to-ebp
3859 c3/return
3860
3861 pos-or-insert-slice:
3862
3863 55/push-ebp
3864 89/<- %ebp 4/r32/esp
3865
3866 (pos-slice *(ebp+8) *(ebp+0xc))
3867 3d/compare-eax-and -1/imm32
3868 75/jump-if-!= $pos-or-insert-slice:end/disp8
3869 $pos-or-insert-slice:insert:
3870 (slice-to-string Heap *(ebp+0xc))
3871 (write-int *(ebp+8) %eax)
3872 (pos-slice *(ebp+8) *(ebp+0xc))
3873 $pos-or-insert-slice:end:
3874
3875 89/<- %esp 5/r32/ebp
3876 5d/pop-to-ebp
3877 c3/return
3878
3879
3880
3881 pos-slice:
3882
3883 55/push-ebp
3884 89/<- %ebp 4/r32/esp
3885
3886 51/push-ecx
3887 52/push-edx
3888 53/push-ebx
3889 56/push-esi
3890
3891
3892
3893
3894
3895 8b/-> *(ebp+8) 6/r32/esi
3896
3897 b9/copy-to-ecx 0/imm32
3898
3899 8d/copy-address *(esi+0xc) 2/r32/edx
3900
3901 8b/-> *esi 3/r32/ebx
3902 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx
3903 {
3904
3905
3906
3907
3908
3909 39/compare %edx 3/r32/ebx
3910 b8/copy-to-eax -1/imm32
3911 73/jump-if-addr>= $pos-slice:end/disp8
3912
3913 (slice-equal? *(ebp+0xc) *edx)
3914 3d/compare-eax-and 0/imm32/false
3915 75/jump-if-!= break/disp8
3916
3917 41/increment-ecx
3918
3919 81 0/subop/add %edx 4/imm32
3920
3921 eb/jump loop/disp8
3922 }
3923
3924 89/<- %eax 1/r32/ecx
3925 $pos-slice:end:
3926
3927
3928
3929
3930 5e/pop-to-esi
3931 5b/pop-to-ebx
3932 5a/pop-to-edx
3933 59/pop-to-ecx
3934
3935 89/<- %esp 5/r32/ebp
3936 5d/pop-to-ebp
3937 c3/return
3938
3939 test-parse-var-with-type:
3940
3941 55/push-ebp
3942 89/<- %ebp 4/r32/esp
3943
3944 b8/copy-to-eax "x:"/imm32
3945 8b/-> *eax 1/r32/ecx
3946 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3947 05/add-to-eax 4/imm32
3948
3949 51/push-ecx
3950 50/push-eax
3951 89/<- %ecx 4/r32/esp
3952
3953 (clear-stream _test-input-stream)
3954 (write _test-input-stream "int")
3955
3956 (parse-var-with-type %ecx _test-input-stream)
3957 8b/-> *eax 2/r32/edx
3958 (check-strings-equal %edx "x" "F - test-var-with-type/name")
3959 8b/-> *(eax+4) 2/r32/edx
3960 (check-ints-equal *edx 1 "F - test-var-with-type/type")
3961 (check-ints-equal *(edx+4) 0 "F - test-var-with-type/type")
3962
3963 89/<- %esp 5/r32/ebp
3964 5d/pop-to-ebp
3965 c3/return
3966
3967 test-parse-var-with-type-and-register:
3968
3969 55/push-ebp
3970 89/<- %ebp 4/r32/esp
3971
3972 b8/copy-to-eax "x/eax:"/imm32
3973 8b/-> *eax 1/r32/ecx
3974 8d/copy-address *(eax+ecx+4) 1/r32/ecx
3975 05/add-to-eax 4/imm32
3976
3977 51/push-ecx
3978 50/push-eax
3979 89/<- %ecx 4/r32/esp
3980
3981 (clear-stream _test-input-stream)
3982 (write _test-input-stream "int")
3983
3984 (parse-var-with-type %ecx _test-input-stream)
3985 8b/-> *eax 2/r32/edx
3986 (check-strings-equal %edx "x" "F - test-var-with-type-and-register/name")
3987 8b/-> *(eax+0x10) 2/r32/edx
3988 (check-strings-equal %edx "eax" "F - test-var-with-type-and-register/register")
3989 8b/-> *(eax+4) 2/r32/edx
3990 (check-ints-equal *edx 1 "F - test-var-with-type-and-register/type")
3991 (check-ints-equal *(edx+4) 0 "F - test-var-with-type-and-register/type")
3992
3993 89/<- %esp 5/r32/ebp
3994 5d/pop-to-ebp
3995 c3/return
3996
3997 test-parse-var-with-trailing-characters:
3998
3999 55/push-ebp
4000 89/<- %ebp 4/r32/esp
4001
4002 b8/copy-to-eax "x:"/imm32
4003 8b/-> *eax 1/r32/ecx
4004 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4005 05/add-to-eax 4/imm32
4006
4007 51/push-ecx
4008 50/push-eax
4009 89/<- %ecx 4/r32/esp
4010
4011 (clear-stream _test-input-stream)
4012 (write _test-input-stream "int,")
4013
4014 (parse-var-with-type %ecx _test-input-stream)
4015 8b/-> *eax 2/r32/edx
4016 (check-strings-equal %edx "x" "F - test-var-with-trailing-characters/name")
4017 8b/-> *(eax+0x10) 2/r32/edx
4018 (check-ints-equal %edx 0 "F - test-var-with-trailing-characters/register")
4019 8b/-> *(eax+4) 2/r32/edx
4020 (check-ints-equal *edx 1 "F - test-var-with-trailing-characters/type")
4021 (check-ints-equal *(edx+4) 0 "F - test-var-with-trailing-characters/type")
4022
4023 89/<- %esp 5/r32/ebp
4024 5d/pop-to-ebp
4025 c3/return
4026
4027 test-parse-var-with-register-and-trailing-characters:
4028
4029 55/push-ebp
4030 89/<- %ebp 4/r32/esp
4031
4032 b8/copy-to-eax "x/eax:"/imm32
4033 8b/-> *eax 1/r32/ecx
4034 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4035 05/add-to-eax 4/imm32
4036
4037 51/push-ecx
4038 50/push-eax
4039 89/<- %ecx 4/r32/esp
4040
4041 (clear-stream _test-input-stream)
4042 (write _test-input-stream "int,")
4043
4044 (parse-var-with-type %ecx _test-input-stream)
4045 8b/-> *eax 2/r32/edx
4046 (check-strings-equal %edx "x" "F - test-var-with-register-and-trailing-characters/name")
4047 8b/-> *(eax+0x10) 2/r32/edx
4048 (check-strings-equal %edx "eax" "F - test-var-with-register-and-trailing-characters/register")
4049 8b/-> *(eax+4) 2/r32/edx
4050 (check-ints-equal *edx 1 "F - test-var-with-register-and-trailing-characters/type")
4051 (check-ints-equal *(edx+4) 0 "F - test-var-with-register-and-trailing-characters/type")
4052
4053 89/<- %esp 5/r32/ebp
4054 5d/pop-to-ebp
4055 c3/return
4056
4057 test-parse-var-with-compound-type:
4058
4059 55/push-ebp
4060 89/<- %ebp 4/r32/esp
4061
4062 b8/copy-to-eax "x:"/imm32
4063 8b/-> *eax 1/r32/ecx
4064 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4065 05/add-to-eax 4/imm32
4066
4067 51/push-ecx
4068 50/push-eax
4069 89/<- %ecx 4/r32/esp
4070
4071 (clear-stream _test-input-stream)
4072 (write _test-input-stream "(addr int)")
4073
4074 (parse-var-with-type %ecx _test-input-stream)
4075 8b/-> *eax 2/r32/edx
4076 (check-strings-equal %edx "x" "F - test-var-with-compound-type/name")
4077 8b/-> *(eax+0x10) 2/r32/edx
4078 (check-ints-equal %edx 0 "F - test-var-with-compound-type/register")
4079
4080 8b/-> *(eax+4) 2/r32/edx
4081
4082 8b/-> *edx 0/r32/eax
4083 (check-ints-equal *eax 2 "F - test-var-with-compound-type/type:0")
4084
4085 8b/-> *(edx+4) 2/r32/edx
4086 8b/-> *edx 0/r32/eax
4087 (check-ints-equal *eax 1 "F - test-var-with-compound-type/type:1")
4088
4089 (check-ints-equal *(edx+4) 0 "F - test-var-with-compound-type/type:2")
4090
4091 89/<- %esp 5/r32/ebp
4092 5d/pop-to-ebp
4093 c3/return
4094
4095
4096
4097
4098 is-identifier?:
4099
4100 55/push-ebp
4101 89/<- %ebp 4/r32/esp
4102
4103 (slice-empty? *(ebp+8))
4104 3d/compare-eax-and 0/imm32/false
4105 75/jump-if-!= $is-identifier?:false/disp8
4106
4107 8b/-> *(ebp+8) 0/r32/eax
4108 8b/-> *eax 0/r32/eax
4109 8a/copy-byte *eax 0/r32/AL
4110 81 4/subop/and %eax 0xff/imm32
4111
4112 3d/compare-eax-and 0x24/imm32/$
4113 74/jump-if-= $is-identifier?:true/disp8
4114
4115 3d/compare-eax-and 0x5f/imm32/_
4116 74/jump-if-= $is-identifier?:true/disp8
4117
4118 25/and-eax-with 0x5f/imm32
4119
4120 3d/compare-eax-and 0x41/imm32/A
4121 7c/jump-if-< $is-identifier?:false/disp8
4122
4123 3d/compare-eax-and 0x5a/imm32/Z
4124 7f/jump-if-> $is-identifier?:false/disp8
4125
4126 $is-identifier?:true:
4127 b8/copy-to-eax 1/imm32/true
4128 eb/jump $is-identifier?:end/disp8
4129 $is-identifier?:false:
4130 b8/copy-to-eax 0/imm32/false
4131 $is-identifier?:end:
4132
4133 89/<- %esp 5/r32/ebp
4134 5d/pop-to-ebp
4135 c3/return
4136
4137 test-is-identifier-dollar:
4138
4139 55/push-ebp
4140 89/<- %ebp 4/r32/esp
4141
4142 b8/copy-to-eax "$a"/imm32
4143 8b/-> *eax 1/r32/ecx
4144 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4145 05/add-to-eax 4/imm32
4146
4147 51/push-ecx
4148 50/push-eax
4149 89/<- %ecx 4/r32/esp
4150
4151 (is-identifier? %ecx)
4152 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
4153
4154 89/<- %esp 5/r32/ebp
4155 5d/pop-to-ebp
4156 c3/return
4157
4158 test-is-identifier-underscore:
4159
4160 55/push-ebp
4161 89/<- %ebp 4/r32/esp
4162
4163 b8/copy-to-eax "_a"/imm32
4164 8b/-> *eax 1/r32/ecx
4165 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4166 05/add-to-eax 4/imm32
4167
4168 51/push-ecx
4169 50/push-eax
4170 89/<- %ecx 4/r32/esp
4171
4172 (is-identifier? %ecx)
4173 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
4174
4175 89/<- %esp 5/r32/ebp
4176 5d/pop-to-ebp
4177 c3/return
4178
4179 test-is-identifier-a:
4180
4181 55/push-ebp
4182 89/<- %ebp 4/r32/esp
4183
4184 b8/copy-to-eax "a$"/imm32
4185 8b/-> *eax 1/r32/ecx
4186 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4187 05/add-to-eax 4/imm32
4188
4189 51/push-ecx
4190 50/push-eax
4191 89/<- %ecx 4/r32/esp
4192
4193 (is-identifier? %ecx)
4194 (check-ints-equal %eax 1 "F - test-is-identifier-a")
4195
4196 89/<- %esp 5/r32/ebp
4197 5d/pop-to-ebp
4198 c3/return
4199
4200 test-is-identifier-z:
4201
4202 55/push-ebp
4203 89/<- %ebp 4/r32/esp
4204
4205 b8/copy-to-eax "z$"/imm32
4206 8b/-> *eax 1/r32/ecx
4207 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4208 05/add-to-eax 4/imm32
4209
4210 51/push-ecx
4211 50/push-eax
4212 89/<- %ecx 4/r32/esp
4213
4214 (is-identifier? %ecx)
4215 (check-ints-equal %eax 1 "F - test-is-identifier-z")
4216
4217 89/<- %esp 5/r32/ebp
4218 5d/pop-to-ebp
4219 c3/return
4220
4221 test-is-identifier-A:
4222
4223 55/push-ebp
4224 89/<- %ebp 4/r32/esp
4225
4226 b8/copy-to-eax "A$"/imm32
4227 8b/-> *eax 1/r32/ecx
4228 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4229 05/add-to-eax 4/imm32
4230
4231 51/push-ecx
4232 50/push-eax
4233 89/<- %ecx 4/r32/esp
4234
4235 (is-identifier? %ecx)
4236 (check-ints-equal %eax 1 "F - test-is-identifier-A")
4237
4238 89/<- %esp 5/r32/ebp
4239 5d/pop-to-ebp
4240 c3/return
4241
4242 test-is-identifier-Z:
4243
4244 55/push-ebp
4245 89/<- %ebp 4/r32/esp
4246
4247 b8/copy-to-eax "Z$"/imm32
4248 8b/-> *eax 1/r32/ecx
4249 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4250 05/add-to-eax 4/imm32
4251
4252 51/push-ecx
4253 50/push-eax
4254 89/<- %ecx 4/r32/esp
4255
4256 (is-identifier? %ecx)
4257 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
4258
4259 89/<- %esp 5/r32/ebp
4260 5d/pop-to-ebp
4261 c3/return
4262
4263 test-is-identifier-@:
4264
4265
4266 55/push-ebp
4267 89/<- %ebp 4/r32/esp
4268
4269 b8/copy-to-eax "@a"/imm32
4270 8b/-> *eax 1/r32/ecx
4271 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4272 05/add-to-eax 4/imm32
4273
4274 51/push-ecx
4275 50/push-eax
4276 89/<- %ecx 4/r32/esp
4277
4278 (is-identifier? %ecx)
4279 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4280
4281 89/<- %esp 5/r32/ebp
4282 5d/pop-to-ebp
4283 c3/return
4284
4285 test-is-identifier-square-bracket:
4286
4287
4288 55/push-ebp
4289 89/<- %ebp 4/r32/esp
4290
4291 b8/copy-to-eax "[a"/imm32
4292 8b/-> *eax 1/r32/ecx
4293 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4294 05/add-to-eax 4/imm32
4295
4296 51/push-ecx
4297 50/push-eax
4298 89/<- %ecx 4/r32/esp
4299
4300 (is-identifier? %ecx)
4301 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4302
4303 89/<- %esp 5/r32/ebp
4304 5d/pop-to-ebp
4305 c3/return
4306
4307 test-is-identifier-backtick:
4308
4309
4310 55/push-ebp
4311 89/<- %ebp 4/r32/esp
4312
4313 b8/copy-to-eax "`a"/imm32
4314 8b/-> *eax 1/r32/ecx
4315 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4316 05/add-to-eax 4/imm32
4317
4318 51/push-ecx
4319 50/push-eax
4320 89/<- %ecx 4/r32/esp
4321
4322 (is-identifier? %ecx)
4323 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
4324
4325 89/<- %esp 5/r32/ebp
4326 5d/pop-to-ebp
4327 c3/return
4328
4329 test-is-identifier-curly-brace-open:
4330
4331
4332 55/push-ebp
4333 89/<- %ebp 4/r32/esp
4334
4335 b8/copy-to-eax "{a"/imm32
4336 8b/-> *eax 1/r32/ecx
4337 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4338 05/add-to-eax 4/imm32
4339
4340 51/push-ecx
4341 50/push-eax
4342 89/<- %ecx 4/r32/esp
4343
4344 (is-identifier? %ecx)
4345 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
4346
4347 89/<- %esp 5/r32/ebp
4348 5d/pop-to-ebp
4349 c3/return
4350
4351 test-is-identifier-curly-brace-close:
4352
4353 55/push-ebp
4354 89/<- %ebp 4/r32/esp
4355
4356 b8/copy-to-eax "}a"/imm32
4357 8b/-> *eax 1/r32/ecx
4358 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4359 05/add-to-eax 4/imm32
4360
4361 51/push-ecx
4362 50/push-eax
4363 89/<- %ecx 4/r32/esp
4364
4365 (is-identifier? %ecx)
4366 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
4367
4368 89/<- %esp 5/r32/ebp
4369 5d/pop-to-ebp
4370 c3/return
4371
4372 test-is-identifier-hyphen:
4373
4374
4375 55/push-ebp
4376 89/<- %ebp 4/r32/esp
4377
4378 b8/copy-to-eax "-a"/imm32
4379 8b/-> *eax 1/r32/ecx
4380 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4381 05/add-to-eax 4/imm32
4382
4383 51/push-ecx
4384 50/push-eax
4385 89/<- %ecx 4/r32/esp
4386
4387 (is-identifier? %ecx)
4388 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
4389
4390 89/<- %esp 5/r32/ebp
4391 5d/pop-to-ebp
4392 c3/return
4393
4394 populate-mu-function-body:
4395
4396 55/push-ebp
4397 89/<- %ebp 4/r32/esp
4398
4399 50/push-eax
4400 56/push-esi
4401 57/push-edi
4402
4403 8b/-> *(ebp+8) 6/r32/esi
4404
4405 8b/-> *(ebp+0xc) 7/r32/edi
4406
4407 (parse-mu-block %esi *(ebp+0x10) %edi)
4408
4409 89/<- *(edi+0x10) 0/r32/eax
4410 $populate-mu-function-body:end:
4411
4412 5f/pop-to-edi
4413 5e/pop-to-esi
4414 58/pop-to-eax
4415
4416 89/<- %esp 5/r32/ebp
4417 5d/pop-to-ebp
4418 c3/return
4419
4420
4421 parse-mu-block:
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457 55/push-ebp
4458 89/<- %ebp 4/r32/esp
4459
4460 51/push-ecx
4461 52/push-edx
4462 53/push-ebx
4463 57/push-edi
4464
4465 81 5/subop/subtract %esp 0x200/imm32
4466 68/push 0x200/imm32/length
4467 68/push 0/imm32/read
4468 68/push 0/imm32/write
4469 89/<- %ecx 4/r32/esp
4470
4471 68/push 0/imm32/end
4472 68/push 0/imm32/start
4473 89/<- %edx 4/r32/esp
4474
4475 (allocate Heap *Stmt-size)
4476 (zero-out %eax *Stmt-size)
4477 89/<- %edi 0/r32/eax
4478
4479 c7 0/subop/copy *edi 0/imm32/block
4480
4481 (new-block-name *(ebp+0x10))
4482 89/<- *(edi+8) 0/r32/eax
4483
4484 (push *(ebp+0xc) %eax)
4485 {
4486 $parse-mu-block:line-loop:
4487
4488 (clear-stream %ecx)
4489 (read-line-buffered *(ebp+8) %ecx)
4490
4491
4492
4493
4494
4495 81 7/subop/compare *ecx 0/imm32
4496 0f 84/jump-if-= break/disp32
4497
4498 (next-mu-token %ecx %edx)
4499
4500
4501
4502
4503
4504 (slice-empty? %edx)
4505 3d/compare-eax-and 0/imm32/false
4506 0f 85/jump-if-!= loop/disp32
4507
4508
4509 8b/-> *edx 0/r32/eax
4510 8a/copy-byte *eax 0/r32/AL
4511 81 4/subop/and %eax 0xff/imm32
4512
4513 3d/compare-eax-and 0x23/imm32/hash
4514 0f 84/jump-if-= loop/disp32
4515
4516 {
4517 $parse-mu-block:check-for-block:
4518 (slice-equal? %edx "{")
4519 3d/compare-eax-and 0/imm32/false
4520 74/jump-if-= break/disp8
4521 (check-no-tokens-left %ecx)
4522
4523 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4524 (append-to-block Heap %edi %eax)
4525 e9/jump $parse-mu-block:line-loop/disp32
4526 }
4527
4528 $parse-mu-block:check-for-end:
4529 (slice-equal? %edx "}")
4530 3d/compare-eax-and 0/imm32/false
4531 0f 85/jump-if-!= break/disp32
4532
4533 {
4534 $parse-mu-block:check-for-named-block:
4535
4536 8b/-> *(edx+4) 0/r32/eax
4537 48/decrement-eax
4538 8a/copy-byte *eax 0/r32/AL
4539 81 4/subop/and %eax 0xff/imm32
4540
4541 3d/compare-eax-and 0x3a/imm32/colon
4542 0f 85/jump-if-!= break/disp32
4543
4544
4545
4546 ff 1/subop/decrement *(edx+4)
4547
4548 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4549 (append-to-block Heap %edi %eax)
4550 e9/jump $parse-mu-block:line-loop/disp32
4551 }
4552
4553 {
4554 $parse-mu-block:check-for-var:
4555 (slice-equal? %edx "var")
4556 3d/compare-eax-and 0/imm32/false
4557 74/jump-if-= break/disp8
4558
4559 (parse-mu-var-def %ecx *(ebp+0xc))
4560 (append-to-block Heap %edi %eax)
4561 e9/jump $parse-mu-block:line-loop/disp32
4562 }
4563 $parse-mu-block:regular-stmt:
4564
4565 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
4566 (append-to-block Heap %edi %eax)
4567 e9/jump loop/disp32
4568 }
4569
4570 (pop *(ebp+0xc))
4571
4572 89/<- %eax 7/r32/edi
4573 $parse-mu-block:end:
4574
4575 81 0/subop/add %esp 0x214/imm32
4576
4577 5f/pop-to-edi
4578 5b/pop-to-ebx
4579 5a/pop-to-edx
4580 59/pop-to-ecx
4581
4582 89/<- %esp 5/r32/ebp
4583 5d/pop-to-ebp
4584 c3/return
4585
4586 $parse-mu-block:abort:
4587
4588 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4589 (rewind-stream %ecx)
4590 (write-stream 2 %ecx)
4591 (write-buffered Stderr "'\n")
4592 (flush Stderr)
4593
4594 bb/copy-to-ebx 1/imm32
4595 b8/copy-to-eax 1/imm32/exit
4596 cd/syscall 0x80/imm8
4597
4598
4599 new-block-name:
4600
4601 55/push-ebp
4602 89/<- %ebp 4/r32/esp
4603
4604 51/push-ecx
4605 52/push-edx
4606
4607 8b/-> *(ebp+8) 0/r32/eax
4608 8b/-> *eax 0/r32/eax
4609 8b/-> *eax 0/r32/eax
4610 05/add-to-eax 0xd/imm32
4611 89/<- %ecx 0/r32/eax
4612
4613 29/subtract %esp 1/r32/ecx
4614 ff 6/subop/push %ecx
4615 68/push 0/imm32/read
4616 68/push 0/imm32/write
4617 89/<- %edx 4/r32/esp
4618 (clear-stream %edx)
4619
4620 8b/-> *(ebp+8) 0/r32/eax
4621 8b/-> *eax 0/r32/eax
4622
4623 (write %edx "$")
4624 (write %edx %eax)
4625 (write %edx ":")
4626 (print-int32 %edx *Next-block-index)
4627 ff 0/subop/increment *Next-block-index
4628
4629
4630 8b/-> *edx 0/r32/eax
4631
4632 8d/copy-address *(edx+0xc) 2/r32/edx
4633
4634 01/add %eax 2/r32/edx
4635
4636 ff 6/subop/push %eax
4637 ff 6/subop/push %edx
4638 89/<- %eax 4/r32/esp
4639
4640 (new-literal Heap %eax)
4641 $new-block-name:end:
4642
4643 81 0/subop/add %ecx 0xc/imm32
4644 81 0/subop/add %ecx 8/imm32
4645 01/add %esp 1/r32/ecx
4646
4647 5a/pop-to-edx
4648 59/pop-to-ecx
4649
4650 89/<- %esp 5/r32/ebp
4651 5d/pop-to-ebp
4652 c3/return
4653
4654 == data
4655
4656
4657 Next-block-index:
4658 1/imm32
4659
4660 == code
4661
4662 check-no-tokens-left:
4663
4664 55/push-ebp
4665 89/<- %ebp 4/r32/esp
4666
4667 50/push-eax
4668 51/push-ecx
4669
4670 68/push 0/imm32/end
4671 68/push 0/imm32/start
4672 89/<- %ecx 4/r32/esp
4673
4674 (next-mu-token *(ebp+8) %ecx)
4675
4676 (slice-empty? %ecx)
4677 3d/compare-eax-and 0/imm32/false
4678 75/jump-if-!= $check-no-tokens-left:end/disp8
4679
4680
4681 8b/-> *edx 0/r32/eax
4682 8a/copy-byte *eax 0/r32/AL
4683 81 4/subop/and %eax 0xff/imm32
4684
4685 3d/compare-eax-and 0x23/imm32/hash
4686 74/jump-if-= $check-no-tokens-left:end/disp8
4687
4688 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4689 (rewind-stream %ecx)
4690 (write-stream 2 %ecx)
4691 (write-buffered Stderr "'\n")
4692 (flush Stderr)
4693
4694 bb/copy-to-ebx 1/imm32
4695 b8/copy-to-eax 1/imm32/exit
4696 cd/syscall 0x80/imm8
4697
4698 $check-no-tokens-left:end:
4699
4700 81 0/subop/add %esp 8/imm32
4701
4702 59/pop-to-ecx
4703 58/pop-to-eax
4704
4705 89/<- %esp 5/r32/ebp
4706 5d/pop-to-ebp
4707 c3/return
4708
4709 parse-mu-named-block:
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719 55/push-ebp
4720 89/<- %ebp 4/r32/esp
4721
4722 51/push-ecx
4723
4724 (new-literal Heap *(ebp+8))
4725 89/<- %ecx 0/r32/eax
4726
4727 (push *(ebp+0x10) %ecx)
4728
4729 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14))
4730
4731 50/push-eax
4732 (pop *(ebp+0x10))
4733 58/pop-to-eax
4734
4735 c7 0/subop/copy *eax 0/imm32/block
4736
4737 89/<- *(eax+8) 1/r32/ecx
4738 $parse-mu-named-block:end:
4739
4740 59/pop-to-ecx
4741
4742 89/<- %esp 5/r32/ebp
4743 5d/pop-to-ebp
4744 c3/return
4745
4746 parse-mu-var-def:
4747
4748 55/push-ebp
4749 89/<- %ebp 4/r32/esp
4750
4751 51/push-ecx
4752 52/push-edx
4753
4754 68/push 0/imm32/end
4755 68/push 0/imm32/start
4756 89/<- %ecx 4/r32/esp
4757
4758 (next-mu-token *(ebp+8) %ecx)
4759 (parse-var-with-type %ecx *(ebp+8))
4760 89/<- %edx 0/r32/eax
4761
4762 (push *(ebp+0xc) %edx)
4763
4764 8b/-> *(edx+0x10) 0/r32/eax
4765 3d/compare-eax-and 0/imm32
4766 {
4767 75/jump-if-!= break/disp8
4768
4769 (new-var-def Heap %edx)
4770 eb/jump $parse-mu-var-def:end/disp8
4771 }
4772
4773 {
4774 74/jump-if-= break/disp8
4775
4776 (next-mu-token *(ebp+8) %ecx)
4777 (slice-equal? %ecx "<-")
4778 3d/compare-eax-and 0/imm32/false
4779 74/jump-if-= $parse-mu-var-def:abort/disp8
4780
4781 (new-reg-var-def Heap %edx)
4782 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc))
4783 }
4784 $parse-mu-var-def:end:
4785
4786 81 0/subop/add %esp 8/imm32
4787
4788 5a/pop-to-edx
4789 59/pop-to-ecx
4790
4791 89/<- %esp 5/r32/ebp
4792 5d/pop-to-ebp
4793 c3/return
4794
4795 $parse-mu-var-def:abort:
4796 (rewind-stream *(ebp+8))
4797
4798 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '")
4799 (flush Stderr)
4800 (write-stream 2 *(ebp+8))
4801 (write-buffered Stderr "'\n")
4802 (flush Stderr)
4803
4804 bb/copy-to-ebx 1/imm32
4805 b8/copy-to-eax 1/imm32/exit
4806 cd/syscall 0x80/imm8
4807
4808
4809 test-parse-mu-var-def:
4810
4811
4812 55/push-ebp
4813 89/<- %ebp 4/r32/esp
4814
4815 (clear-stream _test-input-stream)
4816 (write _test-input-stream "n: int\n")
4817
4818 81 5/subop/subtract %esp 0x10/imm32
4819 68/push 0x10/imm32/length
4820 68/push 0/imm32/top
4821 89/<- %ecx 4/r32/esp
4822 (clear-stack %ecx)
4823
4824 (parse-mu-var-def _test-input-stream %ecx)
4825
4826 (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")
4827 8b/-> *(eax+4) 0/r32/eax
4828 (check-strings-equal *eax "n" "F - test-parse-mu-var-def/var-name")
4829 (check-ints-equal *(eax+0x10) 0 "F - test-parse-mu-var-def/var-register")
4830
4831 8b/-> *(eax+4) 0/r32/eax
4832 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0")
4833 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-var-def/var-type:0")
4834
4835 89/<- %esp 5/r32/ebp
4836 5d/pop-to-ebp
4837 c3/return
4838
4839 test-parse-mu-reg-var-def:
4840
4841
4842 55/push-ebp
4843 89/<- %ebp 4/r32/esp
4844
4845 (clear-stream _test-input-stream)
4846 (write _test-input-stream "n/eax: int <- copy 0\n")
4847
4848 81 5/subop/subtract %esp 0x10/imm32
4849 68/push 0x10/imm32/length
4850 68/push 0/imm32/top
4851 89/<- %ecx 4/r32/esp
4852 (clear-stack %ecx)
4853
4854 (parse-mu-var-def _test-input-stream %ecx)
4855
4856 (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")
4857 8b/-> *(eax+0xc) 0/r32/eax
4858 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/single-output")
4859 8b/-> *eax 0/r32/eax
4860 (check-strings-equal *eax "n" "F - test-parse-mu-reg-var-def/output-name")
4861 (check-strings-equal *(eax+0x10) "eax" "F - test-parse-mu-reg-var-def/output-register")
4862
4863 8b/-> *(eax+4) 0/r32/eax
4864 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0")
4865 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/output-type:0")
4866
4867 89/<- %esp 5/r32/ebp
4868 5d/pop-to-ebp
4869 c3/return
4870
4871 parse-mu-stmt:
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885 55/push-ebp
4886 89/<- %ebp 4/r32/esp
4887
4888 51/push-ecx
4889 52/push-edx
4890 57/push-edi
4891
4892 68/push 0/imm32/end
4893 68/push 0/imm32/start
4894 89/<- %ecx 4/r32/esp
4895
4896 ba/copy-to-edx 0/imm32/false
4897
4898 (allocate Heap *Stmt-size)
4899 (zero-out %eax *Stmt-size)
4900 89/<- %edi 0/r32/eax
4901
4902 c7 0/subop/copy *edi 1/imm32/stmt1
4903 {
4904 (stmt-has-outputs? *(ebp+8))
4905 3d/compare-eax-and 0/imm32/false
4906 0f 84/jump-if-= break/disp32
4907 {
4908 $parse-mu-stmt:read-outputs:
4909
4910 (next-mu-token *(ebp+8) %ecx)
4911
4912 (slice-empty? %ecx)
4913 3d/compare-eax-and 0/imm32/false
4914 0f 85/jump-if-!= break/disp32
4915
4916 (slice-equal? %ecx "<-")
4917 3d/compare-eax-and 0/imm32/false
4918 0f 85/jump-if-!= break/disp32
4919
4920 ba/copy-to-edx 0/imm32/false
4921
4922 8b/-> *ecx 0/r32/eax
4923 8a/copy-byte *eax 0/r32/AL
4924 81 4/subop/and %eax 0xff/imm32
4925 3d/compare-eax-and 0x2a/imm32/asterisk
4926 {
4927 75/jump-if-!= break/disp8
4928 ff 0/subop/increment *ecx
4929 ba/copy-to-edx 1/imm32/true
4930 }
4931
4932 (is-identifier? %ecx)
4933 3d/compare-eax-and 0/imm32/false
4934 0f 84/jump-if-= $parse-mu-stmt:abort/disp32
4935
4936 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
4937 (append-stmt-var Heap %eax *(edi+0xc) %edx)
4938 89/<- *(edi+0xc) 0/r32/eax
4939 e9/jump loop/disp32
4940 }
4941 }
4942 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc))
4943 $parse-mu-stmt:end:
4944
4945 89/<- %eax 7/r32/edi
4946
4947 81 0/subop/add %esp 8/imm32
4948
4949 5f/pop-to-edi
4950 5a/pop-to-edx
4951 59/pop-to-ecx
4952
4953 89/<- %esp 5/r32/ebp
4954 5d/pop-to-ebp
4955 c3/return
4956
4957 $parse-mu-stmt:abort:
4958
4959 (write-buffered Stderr "invalid identifier '")
4960 (write-slice-buffered Stderr %ecx)
4961 (write-buffered Stderr "'\n")
4962 (flush Stderr)
4963
4964 bb/copy-to-ebx 1/imm32
4965 b8/copy-to-eax 1/imm32/exit
4966 cd/syscall 0x80/imm8
4967
4968
4969 add-operation-and-inputs-to-stmt:
4970
4971
4972
4973
4974
4975
4976
4977
4978 55/push-ebp
4979 89/<- %ebp 4/r32/esp
4980
4981 50/push-eax
4982 51/push-ecx
4983 52/push-edx
4984 53/push-ebx
4985 57/push-edi
4986
4987 8b/-> *(ebp+8) 7/r32/edi
4988
4989 68/push 0/imm32/end
4990 68/push 0/imm32/start
4991 89/<- %ecx 4/r32/esp
4992
4993 ba/copy-to-edx 0/imm32/false
4994 $add-operation-and-inputs-to-stmt:read-operation:
4995 (next-mu-token *(ebp+0xc) %ecx)
4996 (slice-to-string Heap %ecx)
4997 89/<- *(edi+4) 0/r32/eax
4998
4999 (slice-equal? %ecx "get")
5000 89/<- %ebx 0/r32/eax
5001 {
5002 $add-operation-and-inputs-to-stmt:read-inouts:
5003
5004 (next-mu-token *(ebp+0xc) %ecx)
5005
5006 (slice-empty? %ecx)
5007 3d/compare-eax-and 0/imm32/false
5008 0f 85/jump-if-!= break/disp32
5009
5010 (slice-equal? %ecx "<-")
5011 3d/compare-eax-and 0/imm32/false
5012 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32
5013
5014 {
5015 81 7/subop/compare %ebx 0/imm32/false
5016 74/jump-if-= break/disp8
5017 81 7/subop/compare *(edi+8) 0/imm32
5018 74/jump-if-= break/disp8
5019 (lookup-or-create-constant *(edi+8) %ecx)
5020
5021
5022
5023
5024
5025
5026 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32
5027 }
5028
5029 ba/copy-to-edx 0/imm32/false
5030
5031 8b/-> *ecx 0/r32/eax
5032 8a/copy-byte *eax 0/r32/AL
5033 81 4/subop/and %eax 0xff/imm32
5034 3d/compare-eax-and 0x2a/imm32/asterisk
5035 {
5036 75/jump-if-!= break/disp8
5037 $add-operation-and-inputs-to-stmt:inout-is-deref:
5038 ff 0/subop/increment *ecx
5039 ba/copy-to-edx 1/imm32/true
5040 }
5041 (lookup-var-or-literal %ecx *(ebp+0x10))
5042 $add-operation-and-inputs-to-stmt:save-var:
5043 (append-stmt-var Heap %eax *(edi+8) %edx)
5044 89/<- *(edi+8) 0/r32/eax
5045 e9/jump loop/disp32
5046 }
5047 $add-operation-and-inputs-to-stmt:end:
5048
5049 81 0/subop/add %esp 8/imm32
5050
5051 5f/pop-to-edi
5052 5b/pop-to-ebx
5053 5a/pop-to-edx
5054 59/pop-to-ecx
5055 58/pop-to-eax
5056
5057 89/<- %esp 5/r32/ebp
5058 5d/pop-to-ebp
5059 c3/return
5060
5061 $add-operation-and-inputs-to-stmt:abort:
5062
5063 (rewind-stream *(ebp+8))
5064 (write-buffered Stderr "invalid identifier '")
5065 (flush Stderr)
5066 (write-stream 2 *(ebp+8))
5067 (write-buffered Stderr "'\n")
5068 (flush Stderr)
5069
5070 bb/copy-to-ebx 1/imm32
5071 b8/copy-to-eax 1/imm32/exit
5072 cd/syscall 0x80/imm8
5073
5074
5075 stmt-has-outputs?:
5076
5077 55/push-ebp
5078 89/<- %ebp 4/r32/esp
5079
5080 51/push-ecx
5081
5082 68/push 0/imm32/end
5083 68/push 0/imm32/start
5084 89/<- %ecx 4/r32/esp
5085
5086 b8/copy-to-eax 0/imm32/false
5087 (rewind-stream *(ebp+8))
5088 {
5089 (next-mu-token *(ebp+8) %ecx)
5090
5091 (slice-empty? %ecx)
5092 3d/compare-eax-and 0/imm32/false
5093 b8/copy-to-eax 0/imm32/false/result
5094 0f 85/jump-if-!= break/disp32
5095
5096
5097 8b/-> *ecx 0/r32/eax
5098 8a/copy-byte *eax 0/r32/AL
5099 81 4/subop/and %eax 0xff/imm32
5100
5101 3d/compare-eax-and 0x23/imm32/hash
5102 b8/copy-to-eax 0/imm32/false/result
5103 0f 84/jump-if-= break/disp32
5104
5105 (slice-equal? %ecx "<-")
5106 3d/compare-eax-and 0/imm32/false
5107 74/jump-if-= loop/disp8
5108 b8/copy-to-eax 1/imm32/true
5109 }
5110 $stmt-has-outputs:end:
5111 (rewind-stream *(ebp+8))
5112
5113 81 0/subop/add %esp 8/imm32
5114
5115 59/pop-to-ecx
5116
5117 89/<- %esp 5/r32/ebp
5118 5d/pop-to-ebp
5119 c3/return
5120
5121
5122
5123 lookup-var-or-literal:
5124
5125 55/push-ebp
5126 89/<- %ebp 4/r32/esp
5127
5128 51/push-ecx
5129 56/push-esi
5130
5131 8b/-> *(ebp+8) 6/r32/esi
5132
5133 (slice-empty? %esi)
5134 3d/compare-eax-and 0/imm32/false
5135 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32
5136
5137 8b/-> *esi 1/r32/ecx
5138 8a/copy-byte *ecx 1/r32/CL
5139 81 4/subop/and %ecx 0xff/imm32
5140
5141 {
5142 (is-decimal-digit? %ecx)
5143 3d/compare-eax-and 0/imm32/false
5144 74/jump-if-= break/disp8
5145 (new-literal-integer Heap %esi)
5146 eb/jump $lookup-var-or-literal:end/disp8
5147 }
5148
5149 {
5150 81 7/subop/compare %ecx 0x22/imm32/dquote
5151 75/jump-if-!= break/disp8
5152 (new-literal Heap %esi)
5153 eb/jump $lookup-var-or-literal:end/disp8
5154 }
5155
5156 {
5157 (lookup-var %esi *(ebp+0xc))
5158 }
5159 $lookup-var-or-literal:end:
5160
5161 5e/pop-to-esi
5162 59/pop-to-ecx
5163
5164 89/<- %esp 5/r32/ebp
5165 5d/pop-to-ebp
5166 c3/return
5167
5168 $lookup-var-or-literal:abort:
5169 (write-buffered Stderr "empty variable!")
5170 (flush Stderr)
5171
5172 bb/copy-to-ebx 1/imm32
5173 b8/copy-to-eax 1/imm32/exit
5174 cd/syscall 0x80/imm8
5175
5176
5177
5178 lookup-var:
5179
5180 55/push-ebp
5181 89/<- %ebp 4/r32/esp
5182
5183 (slice-to-string Heap *(ebp+8))
5184
5185 (lookup-var-helper %eax *(ebp+0xc))
5186
5187 3d/compare-eax-and 0/imm32
5188 74/jump-if-= $lookup-var:abort/disp8
5189 $lookup-var:end:
5190
5191 89/<- %esp 5/r32/ebp
5192 5d/pop-to-ebp
5193 c3/return
5194
5195 $lookup-var:abort:
5196 (write-buffered Stderr "unknown variable '")
5197 (write-slice-buffered Stderr *(ebp+8))
5198 (write-buffered Stderr "'\n")
5199 (flush Stderr)
5200
5201 bb/copy-to-ebx 1/imm32
5202 b8/copy-to-eax 1/imm32/exit
5203 cd/syscall 0x80/imm8
5204
5205
5206
5207 lookup-var-helper:
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218 55/push-ebp
5219 89/<- %ebp 4/r32/esp
5220
5221 52/push-edx
5222 53/push-ebx
5223 56/push-esi
5224
5225 8b/-> *(ebp+0xc) 6/r32/esi
5226
5227 8b/-> *esi 3/r32/ebx
5228
5229 3b/compare 0/r32/eax *(esi+4)
5230 0f 8f/jump-if-> $lookup-var-helper:error1/disp32
5231
5232 8d/copy-address *(esi+8) 2/r32/edx
5233
5234 81 5/subop/subtract %ebx 4/imm32
5235 8d/copy-address *(esi+ebx+8) 3/r32/ebx
5236 {
5237
5238 39/compare %ebx 2/r32/edx
5239 b8/copy-to-eax 0/imm32
5240 0f 82/jump-if-addr< break/disp32
5241
5242 8b/-> *ebx 0/r32/eax
5243
5244 (string-equal? *eax *(ebp+8))
5245 3d/compare-eax-and 0/imm32/false
5246 8b/-> *ebx 0/r32/eax
5247 75/jump-if-!= break/disp8
5248
5249 81 5/subop/subtract %ebx 4/imm32
5250 e9/jump loop/disp32
5251 }
5252 $lookup-var-helper:end:
5253
5254 5e/pop-to-esi
5255 5b/pop-to-ebx
5256 5a/pop-to-edx
5257
5258 89/<- %esp 5/r32/ebp
5259 5d/pop-to-ebp
5260 c3/return
5261
5262 $lookup-var-helper:error1:
5263 (write-buffered Stderr "malformed stack when looking up '")
5264 (write-slice-buffered Stderr *(ebp+8))
5265 (write-buffered Stderr "'\n")
5266 (flush Stderr)
5267
5268 bb/copy-to-ebx 1/imm32
5269 b8/copy-to-eax 1/imm32/exit
5270 cd/syscall 0x80/imm8
5271
5272
5273
5274 lookup-or-define-var:
5275
5276 55/push-ebp
5277 89/<- %ebp 4/r32/esp
5278
5279 51/push-ecx
5280
5281 (slice-to-string Heap *(ebp+8))
5282 89/<- %ecx 0/r32/eax
5283
5284 (lookup-var-helper %ecx *(ebp+0xc))
5285 {
5286
5287 3d/compare-eax-and 0/imm32
5288 75/jump-if-!= break/disp8
5289
5290 {
5291 (find-in-function-outputs *(ebp+0x10) %ecx)
5292 3d/compare-eax-and 0/imm32
5293
5294 0f 84/jump-if-!= $lookup-var:abort/disp32
5295 }
5296 }
5297 $lookup-or-define-var:end:
5298
5299 59/pop-to-ecx
5300
5301 89/<- %esp 5/r32/ebp
5302 5d/pop-to-ebp
5303 c3/return
5304
5305 find-in-function-outputs:
5306
5307 55/push-ebp
5308 89/<- %ebp 4/r32/esp
5309
5310 51/push-ecx
5311
5312 8b/-> *(ebp+8) 1/r32/ecx
5313 8b/-> *(ecx+0xc) 1/r32/ecx
5314
5315 {
5316 81 7/subop/compare %ecx 0/imm32
5317 74/jump-if-= break/disp8
5318
5319 8b/-> *ecx 0/r32/eax
5320
5321 50/push-eax
5322 (string-equal? *eax *(ebp+0xc))
5323 3d/compare-eax-and 0/imm32/false
5324 58/pop-to-eax
5325 75/jump-if-!= $find-in-function-outputs:end/disp8
5326
5327 8b/-> *(ecx+4) 1/r32/ecx
5328 eb/jump loop/disp8
5329 }
5330 b8/copy-to-eax 0/imm32
5331 $find-in-function-outputs:end:
5332
5333 59/pop-to-ecx
5334
5335 89/<- %esp 5/r32/ebp
5336 5d/pop-to-ebp
5337 c3/return
5338
5339 test-parse-mu-stmt:
5340
5341 55/push-ebp
5342 89/<- %ebp 4/r32/esp
5343
5344 (clear-stream _test-input-stream)
5345 (write _test-input-stream "increment n\n")
5346
5347 81 5/subop/subtract %esp 0x10/imm32
5348 68/push 0x10/imm32/length
5349 68/push 0/imm32/top
5350 89/<- %ecx 4/r32/esp
5351 (clear-stack %ecx)
5352
5353 81 5/subop/subtract %esp 0x14/imm32
5354 89/<- %edx 4/r32/esp
5355 (zero-out %edx 0x14)
5356
5357 c7 0/subop/copy *edx "n"/imm32
5358
5359 (push %ecx %edx)
5360
5361 (parse-mu-stmt _test-input-stream %ecx)
5362
5363 (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag")
5364 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
5365
5366 8b/-> *(eax+8) 2/r32/edx
5367
5368 8b/-> *edx 3/r32/ebx
5369 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
5370
5371 89/<- %esp 5/r32/ebp
5372 5d/pop-to-ebp
5373 c3/return
5374
5375 test-parse-mu-stmt-with-comma:
5376
5377 55/push-ebp
5378 89/<- %ebp 4/r32/esp
5379
5380 (clear-stream _test-input-stream)
5381 (write _test-input-stream "copy-to n, 3\n")
5382
5383 81 5/subop/subtract %esp 0x10/imm32
5384 68/push 0x10/imm32/length
5385 68/push 0/imm32/top
5386 89/<- %ecx 4/r32/esp
5387 (clear-stack %ecx)
5388
5389 81 5/subop/subtract %esp 0x14/imm32
5390 89/<- %edx 4/r32/esp
5391 (zero-out %edx 0x14)
5392
5393 c7 0/subop/copy *edx "n"/imm32
5394
5395 (push %ecx %edx)
5396
5397 (parse-mu-stmt _test-input-stream %ecx)
5398
5399 (check-ints-equal *eax 1 "F - test-parse-mu-stmt-with-comma/tag")
5400 (check-strings-equal *(eax+4) "copy-to" "F - test-parse-mu-stmt-with-comma/name")
5401
5402 8b/-> *(eax+8) 2/r32/edx
5403
5404 8b/-> *edx 3/r32/ebx
5405 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt-with-comma/inout:0")
5406
5407 89/<- %esp 5/r32/ebp
5408 5d/pop-to-ebp
5409 c3/return
5410
5411 new-function:
5412
5413 55/push-ebp
5414 89/<- %ebp 4/r32/esp
5415
5416 51/push-ecx
5417
5418 (allocate *(ebp+8) *Function-size)
5419 8b/-> *(ebp+0xc) 1/r32/ecx
5420 89/<- *eax 1/r32/ecx
5421 8b/-> *(ebp+0x10) 1/r32/ecx
5422 89/<- *(eax+4) 1/r32/ecx
5423 8b/-> *(ebp+0x14) 1/r32/ecx
5424 89/<- *(eax+8) 1/r32/ecx
5425 8b/-> *(ebp+0x18) 1/r32/ecx
5426 89/<- *(eax+0xc) 1/r32/ecx
5427 8b/-> *(ebp+0x1c) 1/r32/ecx
5428 89/<- *(eax+0x10) 1/r32/ecx
5429 8b/-> *(ebp+0x20) 1/r32/ecx
5430 89/<- *(eax+0x14) 1/r32/ecx
5431 $new-function:end:
5432
5433 59/pop-to-ecx
5434
5435 89/<- %esp 5/r32/ebp
5436 5d/pop-to-ebp
5437 c3/return
5438
5439 new-var:
5440
5441 55/push-ebp
5442 89/<- %ebp 4/r32/esp
5443
5444 51/push-ecx
5445
5446 (allocate *(ebp+8) *Var-size)
5447 (zero-out %eax *Var-size)
5448 8b/-> *(ebp+0xc) 1/r32/ecx
5449 89/<- *eax 1/r32/ecx
5450 $new-var:end:
5451
5452 59/pop-to-ecx
5453
5454 89/<- %esp 5/r32/ebp
5455 5d/pop-to-ebp
5456 c3/return
5457
5458 new-literal-integer:
5459
5460 55/push-ebp
5461 89/<- %ebp 4/r32/esp
5462
5463 51/push-ecx
5464
5465 (is-hex-int? *(ebp+0xc))
5466 3d/compare-eax-and 0/imm32/false
5467 0f 84/jump-if-= $new-literal-integer:abort/disp32
5468
5469 (allocate *(ebp+8) *Tree-size)
5470 (zero-out %eax *Tree-size)
5471 89/<- %ecx 0/r32/eax
5472
5473 (new-var-from-slice *(ebp+8) *(ebp+0xc))
5474 89/<- *(eax+4) 1/r32/ecx
5475 $new-literal-integer:end:
5476
5477 59/pop-to-ecx
5478
5479 89/<- %esp 5/r32/ebp
5480 5d/pop-to-ebp
5481 c3/return
5482
5483 $new-literal-integer:abort:
5484 (write-buffered Stderr "variable cannot begin with a digit '")
5485 (write-slice-buffered Stderr *(ebp+0xc))
5486 (write-buffered Stderr "'\n")
5487 (flush Stderr)
5488
5489 bb/copy-to-ebx 1/imm32
5490 b8/copy-to-eax 1/imm32/exit
5491 cd/syscall 0x80/imm8
5492
5493
5494 new-literal:
5495
5496 55/push-ebp
5497 89/<- %ebp 4/r32/esp
5498
5499 51/push-ecx
5500 52/push-edx
5501
5502 (slice-to-string Heap *(ebp+0xc))
5503 89/<- %ecx 0/r32/eax
5504
5505 (allocate *(ebp+8) *Tree-size)
5506 (zero-out %eax *Tree-size)
5507 89/<- %edx 0/r32/eax
5508
5509 (new-var *(ebp+8) %ecx)
5510
5511 89/<- *(eax+4) 2/r32/edx
5512 $new-literal:end:
5513
5514 5a/pop-to-edx
5515 59/pop-to-ecx
5516
5517 89/<- %esp 5/r32/ebp
5518 5d/pop-to-ebp
5519 c3/return
5520
5521 new-var-from-slice:
5522
5523 55/push-ebp
5524 89/<- %ebp 4/r32/esp
5525
5526 51/push-ecx
5527
5528 (slice-to-string Heap *(ebp+0xc))
5529 (new-var *(ebp+8) %eax)
5530 $new-var-from-slice:end:
5531
5532 59/pop-to-ecx
5533
5534 89/<- %esp 5/r32/ebp
5535 5d/pop-to-ebp
5536 c3/return
5537
5538 new-block:
5539
5540 55/push-ebp
5541 89/<- %ebp 4/r32/esp
5542
5543 51/push-ecx
5544
5545 (allocate *(ebp+8) *Stmt-size)
5546 (zero-out %eax *Stmt-size)
5547 c7 0/subop/copy *eax 0/imm32/tag/block
5548 8b/-> *(ebp+0xc) 1/r32/ecx
5549 89/<- *(eax+4) 1/r32/ecx
5550 $new-block:end:
5551
5552 59/pop-to-ecx
5553
5554 89/<- %esp 5/r32/ebp
5555 5d/pop-to-ebp
5556 c3/return
5557
5558 new-var-def:
5559
5560 55/push-ebp
5561 89/<- %ebp 4/r32/esp
5562
5563 51/push-ecx
5564
5565 (allocate *(ebp+8) *Stmt-size)
5566 (zero-out %eax *Stmt-size)
5567 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
5568
5569 8b/-> *(ebp+0xc) 1/r32/ecx
5570 89/<- *(eax+4) 1/r32/ecx
5571 $new-var-def:end:
5572
5573 59/pop-to-ecx
5574
5575 89/<- %esp 5/r32/ebp
5576 5d/pop-to-ebp
5577 c3/return
5578
5579 new-reg-var-def:
5580
5581 55/push-ebp
5582 89/<- %ebp 4/r32/esp
5583
5584 51/push-ecx
5585 57/push-edi
5586
5587 8b/-> *(ebp+0xc) 1/r32/ecx
5588
5589 (allocate *(ebp+8) *Stmt-size)
5590 89/<- %edi 0/r32/eax
5591 (zero-out %edi *Stmt-size)
5592
5593 c7 0/subop/copy *edi 3/imm32/tag/var-in-register
5594
5595 (append-stmt-var Heap %ecx *(edi+0xc) 0)
5596 89/<- *(edi+0xc) 0/r32/eax
5597 $new-reg-var-def:end:
5598 89/<- %eax 7/r32/edi
5599
5600 5f/pop-to-edi
5601 59/pop-to-ecx
5602
5603 89/<- %esp 5/r32/ebp
5604 5d/pop-to-ebp
5605 c3/return
5606
5607 append-list:
5608
5609 55/push-ebp
5610 89/<- %ebp 4/r32/esp
5611
5612 51/push-ecx
5613
5614 (allocate *(ebp+8) *List-size)
5615 (zero-out %eax *List-size)
5616 8b/-> *(ebp+0xc) 1/r32/ecx
5617 89/<- *eax 1/r32/ecx
5618
5619 81 7/subop/compare *(ebp+0x10) 0/imm32
5620 74/jump-if-= $append-list:end/disp8
5621
5622
5623 8b/-> *(ebp+0x10) 1/r32/ecx
5624
5625 {
5626 81 7/subop/compare *(ecx+4) 0/imm32
5627 74/jump-if-= break/disp8
5628
5629 8b/-> *(ecx+4) 1/r32/ecx
5630 eb/jump loop/disp8
5631 }
5632
5633 89/<- *(ecx+4) 0/r32/eax
5634
5635 8b/-> *(ebp+0x10) 0/r32/eax
5636 $append-list:end:
5637
5638 59/pop-to-ecx
5639
5640 89/<- %esp 5/r32/ebp
5641 5d/pop-to-ebp
5642 c3/return
5643
5644 append-stmt-var:
5645
5646 55/push-ebp
5647 89/<- %ebp 4/r32/esp
5648
5649 51/push-ecx
5650
5651 (allocate *(ebp+8) *Stmt-var-size)
5652 (zero-out %eax *Stmt-var-size)
5653 8b/-> *(ebp+0xc) 1/r32/ecx
5654 89/<- *eax 1/r32/ecx
5655 8b/-> *(ebp+0x14) 1/r32/ecx
5656 89/<- *(eax+8) 1/r32/ecx
5657
5658 81 7/subop/compare *(ebp+0x10) 0/imm32
5659 74/jump-if-= $append-stmt-var:end/disp8
5660
5661
5662 8b/-> *(ebp+0x10) 1/r32/ecx
5663
5664 {
5665 81 7/subop/compare *(ecx+4) 0/imm32
5666 74/jump-if-= break/disp8
5667
5668 8b/-> *(ecx+4) 1/r32/ecx
5669 eb/jump loop/disp8
5670 }
5671
5672 89/<- *(ecx+4) 0/r32/eax
5673
5674 8b/-> *(ebp+0x10) 0/r32/eax
5675 $append-stmt-var:end:
5676
5677 59/pop-to-ecx
5678
5679 89/<- %esp 5/r32/ebp
5680 5d/pop-to-ebp
5681 c3/return
5682
5683 append-to-block:
5684
5685 55/push-ebp
5686 89/<- %ebp 4/r32/esp
5687
5688 56/push-esi
5689
5690 8b/-> *(ebp+0xc) 6/r32/esi
5691 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
5692 89/<- *(esi+4) 0/r32/eax
5693 $append-to-block:end:
5694
5695 5e/pop-to-esi
5696
5697 89/<- %esp 5/r32/ebp
5698 5d/pop-to-ebp
5699 c3/return
5700
5701
5702
5703
5704
5705
5706
5707 lookup-or-create-constant:
5708
5709 55/push-ebp
5710 89/<- %ebp 4/r32/esp
5711
5712 56/push-esi
5713
5714 (container-type *(ebp+8))
5715
5716
5717
5718
5719 89/<- %esi 0/r32/eax
5720
5721 (find-or-create-typeinfo %esi)
5722
5723
5724
5725
5726
5727 (find-or-create-typeinfo-output-var %eax *(ebp+0xc))
5728 $lookup-or-create-constant:end:
5729
5730 5e/pop-to-esi
5731
5732 89/<- %esp 5/r32/ebp
5733 5d/pop-to-ebp
5734 c3/return
5735
5736
5737
5738
5739
5740 container-type:
5741
5742 55/push-ebp
5743 89/<- %ebp 4/r32/esp
5744
5745 8b/-> *(ebp+8) 0/r32/eax
5746 8b/-> *eax 0/r32/eax
5747 8b/-> *(eax+4) 0/r32/eax
5748 {
5749 81 7/subop/compare *(eax+4) 0/imm32
5750 74/jump-if-= break/disp8
5751 8b/-> *(eax+4) 0/r32/eax
5752 8b/-> *eax 0/r32/eax
5753 }
5754 8b/-> *eax 0/r32/eax
5755 $container-type:end:
5756
5757 89/<- %esp 5/r32/ebp
5758 5d/pop-to-ebp
5759 c3/return
5760
5761 find-or-create-typeinfo:
5762
5763 55/push-ebp
5764 89/<- %ebp 4/r32/esp
5765
5766 51/push-ecx
5767
5768 (find-typeinfo *(ebp+8))
5769 {
5770
5771 3d/compare-eax-and 0/imm32
5772 75/jump-if-!= break/disp8
5773 $find-or-create-typeinfo:create:
5774 (allocate Heap *Typeinfo-size)
5775 (zero-out %eax *Typeinfo-size)
5776
5777 8b/-> *(ebp+8) 1/r32/ecx
5778 89/<- *eax 1/r32/ecx
5779
5780
5781 50/push-eax
5782 (new-stream Heap 0x40 *Typeinfo-fields-row-size)
5783 89/<- %ecx 0/r32/eax
5784 58/pop-to-eax
5785
5786 89/<- *(eax+4) 1/r32/ecx
5787
5788 8b/-> *_Program-types 1/r32/ecx
5789 89/<- *(eax+0xc) 1/r32/ecx
5790
5791 89/<- *_Program-types 0/r32/eax
5792 }
5793 $find-or-create-typeinfo:end:
5794
5795 59/pop-to-ecx
5796
5797 89/<- %esp 5/r32/ebp
5798 5d/pop-to-ebp
5799 c3/return
5800
5801 find-typeinfo:
5802
5803 55/push-ebp
5804 89/<- %ebp 4/r32/esp
5805
5806 51/push-ecx
5807
5808 8b/-> *(ebp+8) 1/r32/ecx
5809
5810 8b/-> *_Program-types 0/r32/eax
5811 {
5812
5813 3d/compare-eax-and 0/imm32
5814 74/jump-if-= break/disp8
5815
5816 39/compare *eax 1/r32/ecx
5817 0f 84/jump-if-= $find-or-create-typeinfo:end/disp32
5818
5819 8b/-> *(eax+0xc) 0/r32/eax
5820
5821 eb/jump loop/disp8
5822 }
5823 $find-typeinfo:end:
5824
5825 59/pop-to-ecx
5826
5827 89/<- %esp 5/r32/ebp
5828 5d/pop-to-ebp
5829 c3/return
5830
5831 find-or-create-typeinfo-output-var:
5832
5833 55/push-ebp
5834 89/<- %ebp 4/r32/esp
5835
5836 51/push-ecx
5837 56/push-esi
5838
5839 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc))
5840 89/<- %esi 0/r32/eax
5841
5842 {
5843 81 7/subop/compare *(esi+8) 0/imm32
5844 75/jump-if-!= break/disp8
5845
5846 (allocate Heap *Tree-size)
5847 c7 0/subop/copy *eax 6/imm32/constant
5848 c7 0/subop/copy *(eax+4) 0/imm32
5849 89/<- %ecx 0/r32/eax
5850
5851 (new-var Heap "field")
5852
5853 89/<- *(eax+4) 1/r32/ecx
5854
5855 c7 0/subop/copy *(eax+0xc) -1/imm32/uninitialized
5856
5857 89/<- *(esi+8) 0/r32/eax
5858 }
5859
5860 8b/-> *(esi+8) 0/r32/eax
5861 $find-or-create-typeinfo-output-var:end:
5862
5863 5e/pop-to-esi
5864 59/pop-to-ecx
5865
5866 89/<- %esp 5/r32/ebp
5867 5d/pop-to-ebp
5868 c3/return
5869
5870 find-or-create-typeinfo-fields:
5871
5872 55/push-ebp
5873 89/<- %ebp 4/r32/esp
5874
5875 56/push-esi
5876
5877 8b/-> *(ebp+8) 6/r32/esi
5878 8b/-> *(esi+4) 6/r32/esi
5879
5880 (leaky-get-or-insert-slice %esi *(ebp+0xc) *Typeinfo-fields-row-size)
5881 89/<- %esi 0/r32/eax
5882
5883 {
5884 81 7/subop/compare *esi 0/imm32
5885 75/jump-if-!= break/disp8
5886 (allocate Heap *Typeinfo-entry-size)
5887 (zero-out %eax *Typeinfo-entry-size)
5888 89/<- *esi 0/r32/eax
5889 }
5890
5891 8b/-> *esi 0/r32/eax
5892 $find-or-create-typeinfo-fields:end:
5893
5894 5e/pop-to-esi
5895
5896 89/<- %esp 5/r32/ebp
5897 5d/pop-to-ebp
5898 c3/return
5899
5900 populate-mu-type:
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926 55/push-ebp
5927 89/<- %ebp 4/r32/esp
5928
5929 68/push 0/imm32
5930
5931 50/push-eax
5932 51/push-ecx
5933 52/push-edx
5934 53/push-ebx
5935 56/push-esi
5936 57/push-edi
5937
5938 8b/-> *(ebp+0xc) 7/r32/edi
5939
5940 81 5/subop/subtract %esp 0x200/imm32
5941 68/push 0x200/imm32/length
5942 68/push 0/imm32/read
5943 68/push 0/imm32/write
5944 89/<- %ecx 4/r32/esp
5945
5946 68/push 0/imm32/end
5947 68/push 0/imm32/start
5948 89/<- %edx 4/r32/esp
5949 {
5950 $populate-mu-type:line-loop:
5951 (clear-stream %ecx)
5952 (read-line-buffered *(ebp+8) %ecx)
5953
5954 81 7/subop/compare *ecx 0/imm32
5955 0f 84/jump-if-= $populate-mu-type:abort/disp32
5956 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------
5962 (next-mu-token %ecx %edx)
5963
5964 (slice-empty? %edx)
5965 3d/compare-eax-and 0/imm32
5966 0f 85/jump-if-!= loop/disp32
5967
5968 (slice-equal? %edx "}")
5969 3d/compare-eax-and 0/imm32
5970 0f 85/jump-if-!= break/disp32
5971 $populate-mu-type:parse-element:
5972
5973 (parse-var-with-type %edx %ecx)
5974 89/<- %esi 0/r32/eax
5975 $populate-mu-type:create-typeinfo-fields:
5976
5977 (find-or-create-typeinfo-fields %edi %edx)
5978 89/<- %ebx 0/r32/eax
5979
5980
5981
5982
5983
5984
5985
5986 8b/-> *(ebp-4) 0/r32/eax
5987 89/<- *(ebx+4) 0/r32/eax
5988
5989 ff 0/subop/increment *(ebp-4)
5990 $populate-mu-type:set-input-type:
5991
5992 89/<- *ebx 6/r32/esi
5993 {
5994 $populate-mu-type:create-output-type:
5995
5996 81 7/subop/compare *(ebx+8) 0/imm32
5997 75/jump-if-!= break/disp8
5998 (new-literal Heap %edx)
5999 89/<- *(ebx+8) 0/r32/eax
6000 }
6001 e9/jump loop/disp32
6002 }
6003 $populate-mu-type:invalidate-total-size-in-bytes:
6004
6005
6006
6007 c7 0/subop/copy *(edi+8) -2/imm32/uninitialized
6008 $populate-mu-type:end:
6009
6010 81 0/subop/add %esp 0x214/imm32
6011
6012 5f/pop-to-edi
6013 5e/pop-to-esi
6014 5b/pop-to-ebx
6015 5a/pop-to-edx
6016 59/pop-to-ecx
6017 58/pop-to-eax
6018
6019 81 0/subop/add %esp 4/imm32
6020
6021 89/<- %esp 5/r32/ebp
6022 5d/pop-to-ebp
6023 c3/return
6024
6025 $populate-mu-type:abort:
6026
6027 (write-buffered Stderr "incomplete type definition '")
6028 (type-name *edi)
6029 (write-buffered Stderr %eax)
6030 (write-buffered Stderr "\n")
6031 (flush Stderr)
6032
6033 bb/copy-to-ebx 1/imm32
6034 b8/copy-to-eax 1/imm32/exit
6035 cd/syscall 0x80/imm8
6036
6037
6038 type-name:
6039
6040 55/push-ebp
6041 89/<- %ebp 4/r32/esp
6042
6043 (index Type-id *(ebp+8))
6044 $type-name:end:
6045
6046 89/<- %esp 5/r32/ebp
6047 5d/pop-to-ebp
6048 c3/return
6049
6050 index:
6051
6052 55/push-ebp
6053 89/<- %ebp 4/r32/esp
6054
6055 56/push-esi
6056
6057
6058 8b/-> *(ebp+8) 6/r32/esi
6059
6060 8b/-> *(ebp+0xc) 0/r32/eax
6061
6062 8b/-> *(esi+eax+0xc) 0/r32/eax
6063 $index:end:
6064
6065 5e/pop-to-esi
6066
6067 89/<- %esp 5/r32/ebp
6068 5d/pop-to-ebp
6069 c3/return
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080 populate-mu-type-sizes:
6081
6082 55/push-ebp
6083 89/<- %ebp 4/r32/esp
6084
6085 51/push-ecx
6086 $populate-mu-type-sizes:total-sizes:
6087
6088 8b/-> *_Program-types 1/r32/ecx
6089 {
6090
6091 81 7/subop/compare %ecx 0/imm32
6092 74/jump-if-= break/disp8
6093 (populate-mu-type-sizes-in-type %ecx)
6094
6095 8b/-> *(ecx+0xc) 1/r32/ecx
6096 eb/jump loop/disp8
6097 }
6098 $populate-mu-type-sizes:offsets:
6099
6100 8b/-> *_Program-types 1/r32/ecx
6101 {
6102
6103 81 7/subop/compare %ecx 0/imm32
6104 74/jump-if-= break/disp8
6105 (populate-mu-type-offsets %ecx)
6106
6107 8b/-> *(ecx+0xc) 1/r32/ecx
6108 eb/jump loop/disp8
6109 }
6110 $populate-mu-type-sizes:end:
6111
6112 59/pop-to-ecx
6113
6114 89/<- %esp 5/r32/ebp
6115 5d/pop-to-ebp
6116 c3/return
6117
6118
6119
6120
6121 populate-mu-type-sizes-in-type:
6122
6123 55/push-ebp
6124 89/<- %ebp 4/r32/esp
6125
6126 50/push-eax
6127 51/push-ecx
6128 52/push-edx
6129 56/push-esi
6130 57/push-edi
6131
6132 8b/-> *(ebp+8) 6/r32/esi
6133
6134 81 7/subop/compare *(esi+8) 0/imm32
6135 7d/jump-if->= $populate-mu-type-sizes-in-type:end/disp8
6136
6137 81 7/subop/compare *(esi+8) -1/imm32/being-computed
6138 74/jump-if-= $populate-mu-type-sizes-in-type:abort/disp8
6139
6140 c7 0/subop/copy *(esi+8) -1/imm32/being-computed
6141
6142 bf/copy-to-edi 0/imm32
6143
6144
6145 8b/-> *(esi+4) 1/r32/ecx
6146
6147 8b/-> *ecx 2/r32/edx
6148
6149 8d/copy-address *(ecx+0xc) 1/r32/ecx
6150
6151 8d/copy-address *(ecx+edx) 2/r32/edx
6152 {
6153 $populate-mu-type-sizes-in-type:loop:
6154
6155 39/compare %ecx 2/r32/edx
6156 73/jump-if-addr>= break/disp8
6157
6158 8b/-> *(ecx+4) 0/r32/eax
6159
6160 (compute-size-of-var *eax)
6161
6162 01/add-to %edi 0/r32/eax
6163
6164 81 0/subop/add %ecx 8/imm32
6165
6166 eb/jump loop/disp8
6167 }
6168
6169 89/<- *(esi+8) 7/r32/edi
6170 $populate-mu-type-sizes-in-type:end:
6171
6172 5f/pop-to-edi
6173 5e/pop-to-esi
6174 5a/pop-to-edx
6175 59/pop-to-ecx
6176 58/pop-to-eax
6177
6178 89/<- %esp 5/r32/ebp
6179 5d/pop-to-ebp
6180 c3/return
6181
6182 $populate-mu-type-sizes-in-type:abort:
6183 (write-buffered Stderr "cycle in type definitions\n")
6184 (flush Stderr)
6185
6186 bb/copy-to-ebx 1/imm32
6187 b8/copy-to-eax 1/imm32/exit
6188 cd/syscall 0x80/imm8
6189
6190
6191
6192
6193 compute-size-of-var:
6194
6195 55/push-ebp
6196 89/<- %ebp 4/r32/esp
6197
6198 51/push-ecx
6199
6200 8b/-> *(ebp+8) 1/r32/ecx
6201 8b/-> *(ecx+4) 1/r32/ecx
6202
6203 {
6204 8b/-> *Max-type-id 0/r32/eax
6205 39/compare *ecx 0/r32/eax
6206 72/jump-if-addr< break/disp8
6207 8b/-> *ecx 1/r32/ecx
6208 }
6209 (compute-size-of-type-id *ecx)
6210 $compute-size-of-var:end:
6211
6212 59/pop-to-ecx
6213
6214 89/<- %esp 5/r32/ebp
6215 5d/pop-to-ebp
6216 c3/return
6217
6218 compute-size-of-type-id:
6219
6220 55/push-ebp
6221 89/<- %ebp 4/r32/esp
6222
6223 8b/-> *(ebp+8) 0/r32/eax
6224
6225 3d/compare-eax-and 0/imm32
6226 74/jump-if-= $compute-size-of-type-id:end/disp8
6227
6228
6229 (find-typeinfo %eax)
6230 {
6231 3d/compare-eax-and 0/imm32
6232 74/jump-if-= break/disp8
6233 $compute-size-of-type-id:user-defined:
6234 (populate-mu-type-sizes %eax)
6235 8b/-> *(eax+8) 0/r32/eax
6236 eb/jump $compute-size-of-type-id:end/disp8
6237 }
6238
6239 b8/copy-to-eax 4/imm32
6240 $compute-size-of-type-id:end:
6241
6242 89/<- %esp 5/r32/ebp
6243 5d/pop-to-ebp
6244 c3/return
6245
6246
6247
6248
6249 populate-mu-type-offsets:
6250
6251 55/push-ebp
6252 89/<- %ebp 4/r32/esp
6253
6254 50/push-eax
6255 51/push-ecx
6256 52/push-edx
6257 53/push-ebx
6258 56/push-esi
6259 57/push-edi
6260
6261 bf/copy-to-edi 0/imm32
6262
6263 8b/-> *(ebp+8) 1/r32/ecx
6264 8b/-> *(ecx+4) 1/r32/ecx
6265
6266 8b/-> *ecx 2/r32/edx
6267 c1 5/subop/shift-right-logical %edx 3/imm8
6268
6269 bb/copy-to-ebx 0/imm32
6270 {
6271 $populate-mu-type-offsets:loop:
6272 39/compare %ebx 2/r32/edx
6273 7d/jump-if->= break/disp8
6274
6275 (locate-typeinfo-entry-with-index %ecx %ebx)
6276 89/<- %esi 0/r32/eax
6277
6278 8b/-> *(esi+8) 0/r32/eax
6279 89/<- *(eax+0xc) 7/r32/edi
6280
6281 8b/-> *esi 0/r32/eax
6282 (size-of %eax)
6283 01/add-to %edi 0/r32/eax
6284
6285 43/increment-ebx
6286 eb/jump loop/disp8
6287 }
6288 $populate-mu-type-offsets:end:
6289
6290 5f/pop-to-edi
6291 5e/pop-to-esi
6292 5b/pop-to-ebx
6293 5a/pop-to-edx
6294 59/pop-to-ecx
6295 58/pop-to-eax
6296
6297 89/<- %esp 5/r32/ebp
6298 5d/pop-to-ebp
6299 c3/return
6300
6301 locate-typeinfo-entry-with-index:
6302
6303 55/push-ebp
6304 89/<- %ebp 4/r32/esp
6305
6306 51/push-ecx
6307 52/push-edx
6308 53/push-ebx
6309 56/push-esi
6310 57/push-edi
6311
6312 8b/-> *(ebp+8) 6/r32/esi
6313
6314 8d/copy-address *(esi+0xc) 1/r32/ecx
6315
6316 8b/-> *esi 2/r32/edx
6317 8d/copy-address *(ecx+edx) 2/r32/edx
6318 {
6319 $locate-typeinfo-entry-with-index:loop:
6320 39/compare %ecx 2/r32/edx
6321 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8
6322
6323 8b/-> *(ecx+4) 3/r32/ebx
6324
6325 8b/-> *(ebx+4) 0/r32/eax
6326 39/compare *(ebp+0xc) 0/r32/eax
6327 89/<- %eax 3/r32/ebx
6328 74/jump-if-= break/disp8
6329
6330 81 0/subop/add %ecx 8/imm32
6331 eb/jump loop/disp8
6332 }
6333 $locate-typeinfo-entry-with-index:end:
6334
6335 5f/pop-to-edi
6336 5e/pop-to-esi
6337 5b/pop-to-ebx
6338 5a/pop-to-edx
6339 59/pop-to-ecx
6340
6341 89/<- %esp 5/r32/ebp
6342 5d/pop-to-ebp
6343 c3/return
6344
6345 $locate-typeinfo-entry-with-index:abort:
6346 (write-buffered Stderr "overflowing typeinfo-entry->index ")
6347 (print-int32-buffered Stderr %ecx)
6348 (write-buffered Stderr "\n")
6349 (flush Stderr)
6350
6351 bb/copy-to-ebx 1/imm32
6352 b8/copy-to-eax 1/imm32/exit
6353 cd/syscall 0x80/imm8
6354
6355
6356
6357
6358
6359
6360 check-mu-types:
6361
6362 55/push-ebp
6363 89/<- %ebp 4/r32/esp
6364
6365 $check-mu-types:end:
6366
6367 89/<- %esp 5/r32/ebp
6368 5d/pop-to-ebp
6369 c3/return
6370
6371 size-of:
6372
6373 55/push-ebp
6374 89/<- %ebp 4/r32/esp
6375
6376 51/push-ecx
6377
6378 8b/-> *(ebp+8) 1/r32/ecx
6379 8b/-> *(ecx+4) 1/r32/ecx
6380
6381 {
6382 (is-mu-array? %ecx)
6383 3d/compare-eax-and 0/imm32/false
6384 74/jump-if-= break/disp8
6385 (size-of-array %ecx)
6386 eb/jump $size-of:end/disp8
6387 }
6388
6389 {
6390 8b/-> *Max-type-id 0/r32/eax
6391 39/compare *ecx 0/r32/eax
6392 72/jump-if-addr< break/disp8
6393 8b/-> *ecx 1/r32/ecx
6394 }
6395 (size-of-type-id *ecx)
6396 $size-of:end:
6397
6398 59/pop-to-ecx
6399
6400 89/<- %esp 5/r32/ebp
6401 5d/pop-to-ebp
6402 c3/return
6403
6404 is-mu-array?:
6405
6406 55/push-ebp
6407 89/<- %ebp 4/r32/esp
6408
6409 51/push-ecx
6410
6411 8b/-> *(ebp+8) 1/r32/ecx
6412 8b/-> *ecx 1/r32/ecx
6413
6414 3b/compare 1/r32/ecx *Max-type-id
6415 b8/copy-to-eax 0/imm32/false
6416 72/jump-if-addr< $is-mu-array?:end/disp8
6417
6418 81 7/subop/compare *ecx 3/imm32/array-type-id
6419 0f 94/set-if-= %al
6420 81 4/subop/and %eax 0xff/imm32
6421 $is-mu-array?:end:
6422
6423 59/pop-to-ecx
6424
6425 89/<- %esp 5/r32/ebp
6426 5d/pop-to-ebp
6427 c3/return
6428
6429 size-of-array:
6430
6431 55/push-ebp
6432 89/<- %ebp 4/r32/esp
6433
6434 51/push-ecx
6435 52/push-edx
6436
6437 8b/-> *(ebp+8) 1/r32/ecx
6438
6439 8b/-> *(ecx+4) 1/r32/ecx
6440
6441 8b/-> *ecx 2/r32/edx
6442 8b/-> *edx 2/r32/edx
6443
6444 8b/-> *(ecx+4) 1/r32/ecx
6445 8b/-> *ecx 1/r32/ecx
6446 8b/-> *ecx 1/r32/ecx
6447
6448 (size-of-type-id %edx)
6449 f7 4/subop/multiply-into-eax %ecx
6450 05/add-to-eax 4/imm32
6451 $size-of-array:end:
6452
6453 5a/pop-to-edx
6454 59/pop-to-ecx
6455
6456 89/<- %esp 5/r32/ebp
6457 5d/pop-to-ebp
6458 c3/return
6459
6460 size-of-type-id:
6461
6462 55/push-ebp
6463 89/<- %ebp 4/r32/esp
6464
6465 8b/-> *(ebp+8) 0/r32/eax
6466
6467 3d/compare-eax-and 0/imm32
6468 74/jump-if-= $size-of-type-id:end/disp8
6469
6470
6471 (find-typeinfo %eax)
6472 {
6473 3d/compare-eax-and 0/imm32
6474 74/jump-if-= break/disp8
6475 $size-of-type-id:user-defined:
6476 8b/-> *(eax+8) 0/r32/eax
6477 eb/jump $size-of-type-id:end/disp8
6478 }
6479
6480 b8/copy-to-eax 4/imm32
6481 $size-of-type-id:end:
6482
6483 89/<- %esp 5/r32/ebp
6484 5d/pop-to-ebp
6485 c3/return
6486
6487 type-equal?:
6488
6489 55/push-ebp
6490 89/<- %ebp 4/r32/esp
6491
6492 51/push-ecx
6493 52/push-edx
6494
6495 8b/-> *(ebp+8) 1/r32/ecx
6496
6497 8b/-> *(ebp+0xc) 2/r32/edx
6498
6499 8b/-> %ecx 0/r32/eax
6500 39/compare %edx 0/r32/eax
6501 b8/copy-to-eax 1/imm32/true
6502 74/jump-if-= $type-equal?:end/disp8
6503
6504 81 7/subop/compare %ecx 0x10000/imm32
6505 b8/copy-to-eax 0/imm32/false
6506 72/jump-if-addr< $type-equal?:end/disp8
6507
6508 81 7/subop/compare %edx 0x10000/imm32
6509 b8/copy-to-eax 0/imm32/false
6510 72/jump-if-addr< $type-equal?:end/disp8
6511
6512 (type-equal? *ecx *edx)
6513 3d/compare-eax-and 0/imm32/false
6514 74/jump-if-= $type-equal?:end/disp8
6515
6516 (type-equal? *(ecx+4) *(edx+4))
6517 $type-equal?:end:
6518
6519 5a/pop-to-edx
6520 59/pop-to-ecx
6521
6522 89/<- %esp 5/r32/ebp
6523 5d/pop-to-ebp
6524 c3/return
6525
6526
6527
6528
6529
6530 == data
6531
6532 Curr-block-depth:
6533 0/imm32
6534 Curr-local-stack-offset:
6535 0/imm32
6536
6537 == code
6538
6539 emit-subx:
6540
6541 55/push-ebp
6542 89/<- %ebp 4/r32/esp
6543
6544 50/push-eax
6545 51/push-ecx
6546 57/push-edi
6547
6548 8b/-> *(ebp+8) 7/r32/edi
6549
6550 8b/-> *_Program-functions 1/r32/ecx
6551 {
6552
6553 81 7/subop/compare %ecx 0/imm32
6554 0f 84/jump-if-= break/disp32
6555 (emit-subx-function %edi %ecx)
6556
6557 8b/-> *(ecx+0x14) 1/r32/ecx
6558 e9/jump loop/disp32
6559 }
6560 $emit-subx:end:
6561
6562 5f/pop-to-edi
6563 59/pop-to-ecx
6564 58/pop-to-eax
6565
6566 89/<- %esp 5/r32/ebp
6567 5d/pop-to-ebp
6568 c3/return
6569
6570 emit-subx-function:
6571
6572 55/push-ebp
6573 89/<- %ebp 4/r32/esp
6574
6575 (populate-mu-type-offsets-in-inouts *(ebp+0xc))
6576
6577 50/push-eax
6578 51/push-ecx
6579 52/push-edx
6580 57/push-edi
6581
6582 8b/-> *(ebp+8) 7/r32/edi
6583
6584 8b/-> *(ebp+0xc) 1/r32/ecx
6585
6586 81 5/subop/subtract %esp 0x400/imm32
6587 68/push 0x400/imm32/length
6588 68/push 0/imm32/top
6589 89/<- %edx 4/r32/esp
6590
6591 (write-buffered %edi *ecx)
6592 (write-buffered %edi ":\n")
6593
6594 c7 0/subop/copy *Curr-block-depth 1/imm32
6595 c7 0/subop/copy *Curr-local-stack-offset 0/imm32
6596
6597 (emit-subx-prologue %edi)
6598 (emit-subx-block %edi *(ecx+0x10) %edx)
6599 (emit-subx-epilogue %edi)
6600
6601
6602 $emit-subx-function:end:
6603
6604 81 0/subop/add %esp 408/imm32
6605
6606 5f/pop-to-edi
6607 5a/pop-to-edx
6608 59/pop-to-ecx
6609 58/pop-to-eax
6610
6611 89/<- %esp 5/r32/ebp
6612 5d/pop-to-ebp
6613 c3/return
6614
6615 populate-mu-type-offsets-in-inouts:
6616
6617 55/push-ebp
6618 89/<- %ebp 4/r32/esp
6619
6620 50/push-eax
6621 51/push-ecx
6622 52/push-edx
6623 53/push-ebx
6624 57/push-edi
6625
6626 ba/copy-to-edx 8/imm32
6627
6628 8b/-> *(ebp+8) 1/r32/ecx
6629 8b/-> *(ecx+8) 1/r32/ecx
6630 {
6631 $populate-mu-type-offsets-in-inouts:loop:
6632 81 7/subop/compare %ecx 0/imm32
6633 74/jump-if-= break/disp8
6634
6635 8b/-> *ecx 3/r32/ebx
6636
6637 89/<- *(ebx+0xc) 2/r32/edx
6638
6639 (size-of %ebx)
6640 01/add %edx 0/r32/eax
6641
6642 8b/-> *(ecx+4) 1/r32/ecx
6643 eb/jump loop/disp8
6644 }
6645 $populate-mu-type-offsets-in-inouts:end:
6646
6647 5f/pop-to-edi
6648 5b/pop-to-ebx
6649 5a/pop-to-edx
6650 59/pop-to-ecx
6651 58/pop-to-eax
6652
6653 89/<- %esp 5/r32/ebp
6654 5d/pop-to-ebp
6655 c3/return
6656
6657 emit-subx-stmt-list:
6658
6659 55/push-ebp
6660 89/<- %ebp 4/r32/esp
6661
6662 50/push-eax
6663 51/push-ecx
6664 52/push-edx
6665 53/push-ebx
6666 56/push-esi
6667
6668 8b/-> *(ebp+0xc) 6/r32/esi
6669
6670 ba/copy-to-edx 0/imm32/false
6671
6672 {
6673 $emit-subx-stmt-list:loop:
6674 81 7/subop/compare %esi 0/imm32
6675 0f 84/jump-if-= break/disp32
6676
6677 8b/-> *esi 1/r32/ecx
6678 {
6679 $emit-subx-stmt-list:check-for-block:
6680 81 7/subop/compare *ecx 0/imm32/block
6681 75/jump-if-!= break/disp8
6682 $emit-subx-stmt-list:block:
6683 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10))
6684 }
6685 {
6686 $emit-subx-stmt-list:check-for-stmt:
6687 81 7/subop/compare *ecx 1/imm32/stmt1
6688 0f 85/jump-if-!= break/disp32
6689 $emit-subx-stmt-list:stmt1:
6690 {
6691 (is-mu-branch? %ecx)
6692 3d/compare-eax-and 0/imm32/false
6693 0f 84/jump-if-= break/disp32
6694 $emit-subx-stmt-list:branch-stmt:
6695
6696 81 7/subop/compare %edx 0/imm32/false
6697 0f 84/jump-if-= break/disp32
6698 $emit-subx-stmt-list:branch-stmt-and-var-seen:
6699 +-- 26 lines: # unconditional loops -----------------------------------------------------------------------------------------------------------------------------------------------------
6725 +-- 15 lines: # unconditional breaks ----------------------------------------------------------------------------------------------------------------------------------------------------
6740 +-- 37 lines: # simple conditional branches without a target ----------------------------------------------------------------------------------------------------------------------------
6777 +-- 19 lines: # conditional branches with an explicit target ----------------------------------------------------------------------------------------------------------------------------
6796 }
6797 $emit-subx-stmt-list:1-to-1:
6798 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
6799 }
6800 {
6801 $emit-subx-stmt-list:check-for-var-def:
6802 81 7/subop/compare *ecx 2/imm32/var-def
6803 75/jump-if-!= break/disp8
6804 $emit-subx-stmt-list:var-def:
6805 (emit-subx-var-def *(ebp+8) %ecx)
6806 (push *(ebp+0x10) *(ecx+4))
6807
6808 ba/copy-to-edx 1/imm32/true
6809 }
6810 {
6811 $emit-subx-stmt-list:check-for-reg-var-def:
6812 81 7/subop/compare *ecx 3/imm32/reg-var-def
6813 0f 85/jump-if-!= break/disp32
6814 $emit-subx-stmt-list:reg-var-def:
6815
6816 (compute-reg-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10))
6817
6818 (push *(ebp+0x10) %eax)
6819
6820 (emit-subx-stmt *(ebp+8) %ecx Primitives *_Program-functions)
6821
6822 ba/copy-to-edx 1/imm32/true
6823 }
6824 $emit-subx-stmt-list:continue:
6825
6826 8b/-> *(esi+4) 6/r32/esi
6827 e9/jump loop/disp32
6828 }
6829 $emit-subx-stmt-list:emit-cleanup:
6830 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth)
6831 $emit-subx-stmt-list:cleanup:
6832 (clean-up-blocks *(ebp+0x10) *Curr-block-depth)
6833 $emit-subx-stmt-list:end:
6834
6835 5e/pop-to-esi
6836 5b/pop-to-ebx
6837 5a/pop-to-edx
6838 59/pop-to-ecx
6839 58/pop-to-eax
6840
6841 89/<- %esp 5/r32/ebp
6842 5d/pop-to-ebp
6843 c3/return
6844
6845 compute-reg-and-maybe-emit-spill:
6846
6847 55/push-ebp
6848 89/<- %ebp 4/r32/esp
6849
6850 51/push-ecx
6851
6852 8b/-> *(ebp+0xc) 1/r32/ecx
6853
6854 8b/-> *(ecx+0xc) 1/r32/ecx
6855 8b/-> *ecx 1/r32/ecx
6856
6857 8b/-> *Curr-block-depth 0/r32/eax
6858 89/<- *(ecx+8) 0/r32/eax
6859
6860 8b/-> *(ecx+0x10) 0/r32/eax
6861
6862 3d/compare-eax-and 0/imm32
6863 0f 84/jump-if-= $compute-reg-and-maybe-emit-spill:abort/disp32
6864
6865 (already-spilled-this-block? %ecx *(ebp+0x10))
6866 3d/compare-eax-and 0/imm32/false
6867 75/jump-if-!= $compute-reg-and-maybe-emit-spill:end/disp8
6868
6869
6870 81 5/subop/subtract *Curr-local-stack-offset 4/imm32
6871
6872 (emit-indent *(ebp+8) *Curr-block-depth)
6873 (write-buffered *(ebp+8) "ff 6/subop/push %")
6874 (write-buffered *(ebp+8) *(ecx+0x10))
6875 (write-buffered *(ebp+8) Newline)
6876 $compute-reg-and-maybe-emit-spill:end:
6877
6878 89/<- %eax 1/r32/ecx
6879
6880 59/pop-to-ecx
6881
6882 89/<- %esp 5/r32/ebp
6883 5d/pop-to-ebp
6884 c3/return
6885
6886 $compute-reg-and-maybe-emit-spill:abort:
6887
6888 (write-buffered Stderr "var '")
6889 (write-buffered Stderr *eax)
6890 (write-buffered Stderr "' initialized from an instruction must live in a register\n")
6891 (flush Stderr)
6892
6893 bb/copy-to-ebx 1/imm32
6894 b8/copy-to-eax 1/imm32/exit
6895 cd/syscall 0x80/imm8
6896
6897
6898 emit-subx-cleanup-and-unconditional-nonlocal-branch:
6899
6900 55/push-ebp
6901 89/<- %ebp 4/r32/esp
6902
6903 50/push-eax
6904 51/push-ecx
6905 52/push-edx
6906
6907 8b/-> *(ebp+0xc) 1/r32/ecx
6908
6909 8b/-> *(ecx+8) 2/r32/edx
6910 8b/-> *edx 2/r32/edx
6911 8b/-> *edx 2/r32/edx
6912
6913 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %edx)
6914
6915 (emit-indent *(ebp+8) *Curr-block-depth)
6916 (write-buffered *(ebp+8) "e9/jump ")
6917 (write-buffered *(ebp+8) %edx)
6918 (string-starts-with? *(ecx+4) "break")
6919 3d/compare-eax-and 0/imm32/false
6920 {
6921 74/jump-if-= break/disp8
6922 (write-buffered *(ebp+8) ":break/disp32\n")
6923 }
6924 3d/compare-eax-and 0/imm32/false
6925 {
6926 75/jump-if-!= break/disp8
6927 (write-buffered *(ebp+8) ":loop/disp32\n")
6928 }
6929 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end:
6930
6931 5a/pop-to-edx
6932 59/pop-to-ecx
6933 58/pop-to-eax
6934
6935 89/<- %esp 5/r32/ebp
6936 5d/pop-to-ebp
6937 c3/return
6938
6939 is-mu-branch?:
6940
6941 55/push-ebp
6942 89/<- %ebp 4/r32/esp
6943
6944 51/push-ecx
6945
6946 8b/-> *(ebp+8) 1/r32/ecx
6947
6948 (string-starts-with? *(ecx+4) "loop")
6949 3d/compare-eax-and 0/imm32/false
6950 75/jump-if-not-equal $is-mu-branch?:end/disp8
6951
6952 (string-starts-with? *(ecx+4) "break")
6953 $is-mu-branch?:end:
6954
6955 59/pop-to-ecx
6956
6957 89/<- %esp 5/r32/ebp
6958 5d/pop-to-ebp
6959 c3/return
6960
6961 emit-reverse-break:
6962
6963 55/push-ebp
6964 89/<- %ebp 4/r32/esp
6965
6966 50/push-eax
6967
6968 8b/-> *(ebp+0xc) 0/r32/eax
6969
6970 (get Reverse-branch *(eax+4) 8 "reverse-branch: ")
6971 (emit-indent *(ebp+8) *Curr-block-depth)
6972 (write-buffered *(ebp+8) *eax)
6973 (write-buffered *(ebp+8) " break/disp32\n")
6974 $emit-reverse-break:end:
6975
6976 58/pop-to-eax
6977
6978 89/<- %esp 5/r32/ebp
6979 5d/pop-to-ebp
6980 c3/return
6981
6982 == data
6983
6984 Reverse-branch:
6985
6986 0xa0/imm32/write
6987 0/imm32/read
6988 0xa0/imm32/length
6989
6990 "break-if-="/imm32 "0f 85/jump-if-!="/imm32
6991 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32
6992 "break-if-!="/imm32 "0f 84/jump-if-="/imm32
6993 "loop-if-!="/imm32 "0f 84/jump-if-="/imm32
6994 "break-if-<"/imm32 "0f 8d/jump-if->="/imm32
6995 "loop-if-<"/imm32 "0f 8d/jump-if->="/imm32
6996 "break-if->"/imm32 "0f 8e/jump-if-<="/imm32
6997 "loop-if->"/imm32 "0f 8e/jump-if-<="/imm32
6998 "break-if-<="/imm32 "0f 87/jump-if->"/imm32
6999 "loop-if-<="/imm32 "0f 87/jump-if->"/imm32
7000 "break-if->="/imm32 "0f 8c/jump-if-<"/imm32
7001 "loop-if->="/imm32 "0f 8c/jump-if-<"/imm32
7002 "break-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
7003 "loop-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
7004 "break-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
7005 "loop-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
7006 "break-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
7007 "loop-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
7008 "break-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
7009 "loop-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
7010
7011 == code
7012
7013 emit-unconditional-jump-to-depth:
7014
7015 55/push-ebp
7016 89/<- %ebp 4/r32/esp
7017
7018 50/push-eax
7019 51/push-ecx
7020 52/push-edx
7021 53/push-ebx
7022
7023 8b/-> *(ebp+0xc) 1/r32/ecx
7024
7025 8b/-> *ecx 0/r32/eax
7026
7027 81 0/subop/add %ecx 8/imm32
7028
7029 81 5/subop/subtract %eax 4/imm32
7030 8d/copy-address *(ecx+eax) 0/r32/eax
7031
7032 8b/-> *(ebp+0x10) 2/r32/edx
7033 {
7034 $emit-unconditional-jump-to-depth:loop:
7035
7036 39/compare %eax 1/r32/ecx
7037 0f 82/jump-if-addr< break/disp32
7038
7039 8b/-> *eax 3/r32/ebx
7040
7041 39/compare *(ebx+8) 2/r32/edx
7042 0f 8c/jump-if-< break/disp32
7043 {
7044 $emit-unconditional-jump-to-depth:check:
7045
7046 39/compare *(ebx+8) 2/r32/edx
7047 0f 85/jump-if-!= break/disp32
7048 $emit-unconditional-jump-to-depth:depth-found:
7049
7050
7051 50/push-eax
7052 (size-of %ebx)
7053
7054 3d/compare-eax-and 0/imm32
7055 58/pop-to-eax
7056
7057 0f 85/jump-if-!= break/disp32
7058 $emit-unconditional-jump-to-depth:label-found:
7059
7060 (emit-indent *(ebp+8) *Curr-block-depth)
7061 (write-buffered *(ebp+8) "e9/jump ")
7062 (write-buffered *(ebp+8) *ebx)
7063 (write-buffered *(ebp+8) ":")
7064 (write-buffered *(ebp+8) *(ebp+0x14))
7065 (write-buffered *(ebp+8) "/disp32\n")
7066 eb/jump $emit-unconditional-jump-to-depth:end/disp8
7067 }
7068
7069 2d/subtract-from-eax 4/imm32
7070 e9/jump loop/disp32
7071 }
7072
7073 $emit-unconditional-jump-to-depth:end:
7074
7075 5b/pop-to-ebx
7076 5a/pop-to-edx
7077 59/pop-to-ecx
7078 58/pop-to-eax
7079
7080 89/<- %esp 5/r32/ebp
7081 5d/pop-to-ebp
7082 c3/return
7083
7084
7085
7086 emit-cleanup-code-until-depth:
7087
7088 55/push-ebp
7089 89/<- %ebp 4/r32/esp
7090
7091 50/push-eax
7092 51/push-ecx
7093 52/push-edx
7094 53/push-ebx
7095
7096 8b/-> *(ebp+0xc) 1/r32/ecx
7097
7098 8b/-> *ecx 0/r32/eax
7099
7100 81 0/subop/add %ecx 8/imm32
7101
7102 81 5/subop/subtract %eax 4/imm32
7103 8d/copy-address *(ecx+eax) 0/r32/eax
7104
7105 8b/-> *(ebp+0x10) 2/r32/edx
7106 {
7107 $emit-cleanup-code-until-depth:loop:
7108
7109 39/compare %eax 1/r32/ecx
7110 0f 82/jump-if-addr< break/disp32
7111
7112 8b/-> *eax 3/r32/ebx
7113
7114 39/compare *(ebx+8) 2/r32/edx
7115 0f 8c/jump-if-< break/disp32
7116
7117 81 7/subop/compare *(ebx+0x10) 0/imm32
7118 {
7119 0f 84/jump-if-= break/disp32
7120 50/push-eax
7121 {
7122 $emit-cleanup-code-until-depth:check-for-previous-spill:
7123 (same-register-spilled-before? %ebx *(ebp+0xc) %eax)
7124 3d/compare-eax-and 0/imm32/false
7125 0f 85/jump-if-!= break/disp32
7126 $emit-cleanup-code-until-depth:reclaim-var-in-register:
7127 (emit-indent *(ebp+8) *Curr-block-depth)
7128 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7129 (write-buffered *(ebp+8) *(ebx+0x10))
7130 (write-buffered *(ebp+8) Newline)
7131 }
7132 58/pop-to-eax
7133 eb/jump $emit-cleanup-code-until-depth:continue/disp8
7134 }
7135
7136 {
7137 75/jump-if-!= break/disp8
7138 $emit-cleanup-code-until-depth:reclaim-var-on-stack:
7139 50/push-eax
7140 (size-of %ebx)
7141
7142 3d/compare-eax-and 0/imm32
7143 74/jump-if-= break/disp8
7144
7145 (emit-indent *(ebp+8) *Curr-block-depth)
7146 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7147 (print-int32-buffered *(ebp+8) %eax)
7148 (write-buffered *(ebp+8) "/imm32\n")
7149 58/pop-to-eax
7150 }
7151 $emit-cleanup-code-until-depth:continue:
7152
7153 2d/subtract-from-eax 4/imm32
7154 e9/jump loop/disp32
7155 }
7156 $emit-cleanup-code-until-depth:end:
7157
7158 5b/pop-to-ebx
7159 5a/pop-to-edx
7160 59/pop-to-ecx
7161 58/pop-to-eax
7162
7163 89/<- %esp 5/r32/ebp
7164 5d/pop-to-ebp
7165 c3/return
7166
7167
7168
7169 emit-cleanup-code-until-target:
7170
7171 55/push-ebp
7172 89/<- %ebp 4/r32/esp
7173
7174 50/push-eax
7175 51/push-ecx
7176 52/push-edx
7177 53/push-ebx
7178
7179 8b/-> *(ebp+0xc) 1/r32/ecx
7180
7181 8b/-> *ecx 0/r32/eax
7182
7183 81 0/subop/add %ecx 8/imm32
7184
7185 81 5/subop/subtract %eax 4/imm32
7186 8d/copy-address *(ecx+eax) 2/r32/edx
7187 {
7188 $emit-cleanup-code-until-target:loop:
7189
7190 39/compare %edx 1/r32/ecx
7191 0f 82/jump-if-addr< break/disp32
7192
7193 8b/-> *edx 3/r32/ebx
7194
7195 (string-equal? *ebx *(ebp+0x10))
7196 3d/compare-eax-and 0/imm32/false
7197 0f 85/jump-if-!= break/disp32
7198
7199 81 7/subop/compare *(ebx+0x10) 0/imm32
7200 {
7201 74/jump-if-= break/disp8
7202 50/push-eax
7203 {
7204 $emit-cleanup-code-until-target:check-for-previous-spill:
7205 (same-register-spilled-before? %ebx *(ebp+0xc) %edx)
7206 3d/compare-eax-and 0/imm32/false
7207 75/jump-if-!= break/disp8
7208 $emit-cleanup-code-until-target:reclaim-var-in-register:
7209 (emit-indent *(ebp+8) *Curr-block-depth)
7210 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7211 (write-buffered *(ebp+8) *(ebx+0x10))
7212 (write-buffered *(ebp+8) Newline)
7213 }
7214 58/pop-to-eax
7215 eb/jump $emit-cleanup-code-until-target:continue/disp8
7216 }
7217
7218 {
7219 75/jump-if-!= break/disp8
7220 $emit-cleanup-code-until-target:reclaim-var-on-stack:
7221 (size-of %ebx)
7222
7223 3d/compare-eax-and 0/imm32
7224 74/jump-if-= break/disp8
7225
7226 (emit-indent *(ebp+8) *Curr-block-depth)
7227 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7228 (print-int32-buffered *(ebp+8) %eax)
7229 (write-buffered *(ebp+8) "/imm32\n")
7230 }
7231 $emit-cleanup-code-until-target:continue:
7232
7233 81 5/subop/subtract %edx 4/imm32
7234 e9/jump loop/disp32
7235 }
7236 $emit-cleanup-code-until-target:end:
7237
7238 5b/pop-to-ebx
7239 5a/pop-to-edx
7240 59/pop-to-ecx
7241 58/pop-to-eax
7242
7243 89/<- %esp 5/r32/ebp
7244 5d/pop-to-ebp
7245 c3/return
7246
7247
7248
7249 already-spilled-this-block?:
7250
7251 55/push-ebp
7252 89/<- %ebp 4/r32/esp
7253
7254 51/push-ecx
7255 52/push-edx
7256 53/push-ebx
7257 56/push-esi
7258 57/push-edi
7259
7260 8b/-> *(ebp+0xc) 1/r32/ecx
7261
7262 8b/-> *ecx 0/r32/eax
7263
7264 81 0/subop/add %ecx 8/imm32
7265
7266 81 5/subop/subtract %eax 4/imm32
7267 8d/copy-address *(ecx+eax) 2/r32/edx
7268
7269 8b/-> *(ebp+8) 3/r32/ebx
7270 8b/-> *(ebx+8) 3/r32/ebx
7271
7272 8b/-> *(ebp+8) 6/r32/esi
7273 8b/-> *(esi+0x10) 6/r32/esi
7274 {
7275 $already-spilled-this-block?:loop:
7276
7277 39/compare %edx 1/r32/ecx
7278 0f 82/jump-if-addr< break/disp32
7279
7280 8b/-> *edx 7/r32/edi
7281
7282 39/compare *(edi+8) 3/r32/ebx
7283 0f 8c/jump-if-< break/disp32
7284
7285 8b/-> *(edi+0x10) 7/r32/edi
7286
7287 {
7288 $already-spilled-this-block?:check-reg:
7289 81 7/subop/compare %edi 0/imm32
7290 74/jump-if-= break/disp8
7291
7292 (string-equal? %esi %edi)
7293 3d/compare-eax-and 0/imm32/false
7294 74/jump-if-= break/disp8
7295 b8/copy-to-eax 1/imm32/true
7296 eb/jump $already-spilled-this-block?:end/disp8
7297 }
7298 $already-spilled-this-block?:continue:
7299
7300 81 5/subop/subtract %edx 4/imm32
7301 e9/jump loop/disp32
7302 }
7303
7304 b8/copy-to-eax 0/imm32/false
7305 $already-spilled-this-block?:end:
7306
7307 5f/pop-to-edi
7308 5e/pop-to-esi
7309 5b/pop-to-ebx
7310 5a/pop-to-edx
7311 59/pop-to-ecx
7312
7313 89/<- %esp 5/r32/ebp
7314 5d/pop-to-ebp
7315 c3/return
7316
7317
7318
7319
7320
7321 same-register-spilled-before?:
7322
7323 55/push-ebp
7324 89/<- %ebp 4/r32/esp
7325
7326 51/push-ecx
7327 52/push-edx
7328 53/push-ebx
7329 56/push-esi
7330 57/push-edi
7331
7332 8b/-> *(ebp+8) 1/r32/ecx
7333
7334 8b/-> *(ecx+0x10) 2/r32/edx
7335
7336 8b/-> *(ecx+8) 3/r32/ebx
7337
7338 8b/-> *(ebp+0xc) 1/r32/ecx
7339 81 0/subop/add %ecx 8/imm32
7340
7341
7342
7343 8b/-> *(ebp+0x10) 6/r32/esi
7344
7345 81 5/subop/subtract %esi 4/imm32
7346 {
7347 $same-register-spilled-before?:loop:
7348
7349 39/compare %esi 1/r32/ecx
7350 0f 82/jump-if-addr< break/disp32
7351
7352 8b/-> *esi 0/r32/eax
7353
7354 39/compare *(eax+8) 3/r32/ebx
7355 0f 8c/jump-if-< break/disp32
7356
7357 81 7/subop/compare *(eax+0x10) 0/imm32
7358 74/jump-if-= $same-register-spilled-before?:continue/disp8
7359
7360 (string-equal? *(eax+0x10) %edx)
7361 3d/compare-eax-and 0/imm32/false
7362 75/jump-if-!= $same-register-spilled-before?:end/disp8
7363 $same-register-spilled-before?:continue:
7364
7365 81 5/subop/subtract %esi 4/imm32
7366 e9/jump loop/disp32
7367 }
7368 $same-register-spilled-before?:false:
7369 b8/copy-to-eax 0/imm32/false
7370 $same-register-spilled-before?:end:
7371
7372 5f/pop-to-edi
7373 5e/pop-to-esi
7374 5b/pop-to-ebx
7375 5a/pop-to-edx
7376 59/pop-to-ecx
7377
7378 89/<- %esp 5/r32/ebp
7379 5d/pop-to-ebp
7380 c3/return
7381
7382
7383 clean-up-blocks:
7384
7385 55/push-ebp
7386 89/<- %ebp 4/r32/esp
7387
7388 50/push-eax
7389 51/push-ecx
7390 56/push-esi
7391
7392 8b/-> *(ebp+8) 6/r32/esi
7393
7394 8b/-> *(ebp+0xc) 1/r32/ecx
7395 {
7396 $clean-up-blocks:reclaim-loop:
7397
7398 81 7/subop/compare *esi 0/imm32
7399 7e/jump-if-<= break/disp8
7400
7401 (top %esi)
7402
7403 39/compare *(eax+8) 1/r32/ecx
7404 7c/jump-if-< break/disp8
7405
7406 81 7/subop/compare *(eax+0x10) 0/imm32
7407 {
7408 75/jump-if-!= break/disp8
7409 $clean-up-blocks:reclaim-var-on-stack:
7410 (size-of %eax)
7411 01/add *Curr-local-stack-offset 0/r32/eax
7412 }
7413 (pop %esi)
7414 e9/jump loop/disp32
7415 }
7416 $clean-up-blocks:end:
7417
7418 5e/pop-to-esi
7419 59/pop-to-ecx
7420 58/pop-to-eax
7421
7422 89/<- %esp 5/r32/ebp
7423 5d/pop-to-ebp
7424 c3/return
7425
7426 emit-subx-var-def:
7427
7428 55/push-ebp
7429 89/<- %ebp 4/r32/esp
7430
7431 50/push-eax
7432 51/push-ecx
7433 52/push-edx
7434
7435 8b/-> *(ebp+0xc) 0/r32/eax
7436
7437 8b/-> *(eax+4) 1/r32/ecx
7438
7439 8b/-> *Curr-block-depth 0/r32/eax
7440 89/<- *(ecx+8) 0/r32/eax
7441
7442 (size-of %ecx)
7443 89/<- %edx 0/r32/eax
7444
7445 29/subtract-from *Curr-local-stack-offset 2/r32/edx
7446
7447 8b/-> *Curr-local-stack-offset 0/r32/eax
7448 89/<- *(ecx+0xc) 0/r32/eax
7449
7450 {
7451 (is-mu-array? *(ecx+4))
7452 3d/compare-eax-and 0/imm32/false
7453 0f 84/jump-if-= break/disp32
7454
7455 81 5/subop/subtract %edx 4/imm32
7456 (emit-indent *(ebp+8) *Curr-block-depth)
7457 (write-buffered *(ebp+8) "(push-n-zero-bytes ")
7458 (print-int32-buffered *(ebp+8) %edx)
7459 (write-buffered *(ebp+8) ")\n")
7460 (emit-indent *(ebp+8) *Curr-block-depth)
7461 (write-buffered *(ebp+8) "68/push ")
7462 (print-int32-buffered *(ebp+8) %edx)
7463 (write-buffered *(ebp+8) "/imm32\n")
7464 eb/jump $emit-subx-var-def:end/disp8
7465 }
7466
7467 {
7468 81 7/subop/compare %edx 0/imm32
7469 7e/jump-if-<= break/disp8
7470 (emit-indent *(ebp+8) *Curr-block-depth)
7471 (write-buffered *(ebp+8) "68/push 0/imm32\n")
7472
7473 81 5/subop/subtract %edx 4/imm32
7474
7475 eb/jump loop/disp8
7476 }
7477 $emit-subx-var-def:end:
7478
7479 5a/pop-to-edx
7480 59/pop-to-ecx
7481 58/pop-to-eax
7482
7483 89/<- %esp 5/r32/ebp
7484 5d/pop-to-ebp
7485 c3/return
7486
7487 emit-subx-stmt:
7488
7489 55/push-ebp
7490 89/<- %ebp 4/r32/esp
7491
7492 50/push-eax
7493 51/push-ecx
7494
7495
7496 8b/-> *(ebp+0xc) 1/r32/ecx
7497
7498 {
7499
7500 (string-equal? *(ecx+4) "length")
7501 3d/compare-eax-and 0/imm32
7502 0f 84/jump-if-= break/disp32
7503 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc))
7504 e9/jump $emit-subx-stmt:end/disp32
7505 }
7506
7507 {
7508
7509 (string-equal? *(ecx+4) "index")
7510 3d/compare-eax-and 0/imm32
7511 0f 84/jump-if-= break/disp32
7512 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc))
7513 e9/jump $emit-subx-stmt:end/disp32
7514 }
7515
7516 {
7517
7518 (string-equal? *(ecx+4) "compute-offset")
7519 3d/compare-eax-and 0/imm32
7520 0f 84/jump-if-= break/disp32
7521 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc))
7522 e9/jump $emit-subx-stmt:end/disp32
7523 }
7524
7525 {
7526
7527 (string-equal? *(ecx+4) "get")
7528 3d/compare-eax-and 0/imm32
7529 0f 84/jump-if-= break/disp32
7530 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc))
7531 e9/jump $emit-subx-stmt:end/disp32
7532 }
7533
7534 {
7535 $emit-subx-stmt:check-for-primitive:
7536 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
7537 3d/compare-eax-and 0/imm32
7538 74/jump-if-= break/disp8
7539 $emit-subx-stmt:primitive:
7540 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
7541 e9/jump $emit-subx-stmt:end/disp32
7542 }
7543
7544 {
7545 $emit-subx-stmt:check-for-call:
7546 (find-matching-function *(ebp+0x14) *(ebp+0xc))
7547 3d/compare-eax-and 0/imm32
7548 74/jump-if-= break/disp8
7549 $emit-subx-stmt:call:
7550 (emit-subx-call *(ebp+8) *(ebp+0xc) %eax)
7551 e9/jump $emit-subx-stmt:end/disp32
7552 }
7553
7554 (emit-hailmary-call *(ebp+8) *(ebp+0xc))
7555 $emit-subx-stmt:end:
7556
7557 59/pop-to-ecx
7558 58/pop-to-eax
7559
7560 89/<- %esp 5/r32/ebp
7561 5d/pop-to-ebp
7562 c3/return
7563
7564 translate-mu-length-stmt:
7565
7566 55/push-ebp
7567 89/<- %ebp 4/r32/esp
7568
7569 50/push-eax
7570 51/push-ecx
7571
7572 8b/-> *(ebp+0xc) 1/r32/ecx
7573
7574 (emit-indent *(ebp+8) *Curr-block-depth)
7575 (write-buffered *(ebp+8) "8b/copy-from *")
7576
7577 8b/-> *(ecx+8) 0/r32/eax
7578 8b/-> *eax 0/r32/eax
7579
7580 {
7581 81 7/subop/compare *(eax+0x10)) 0/imm32
7582 74/jump-if-= break/disp8
7583 (write-buffered *(ebp+8) *(eax+0x10))
7584 eb/jump $translate-mu-length-stmt:emit-output/disp8
7585 }
7586
7587 {
7588 81 7/subop/compare *(eax+0xc)) 0/imm32
7589 74/jump-if-= break/disp8
7590 (write-buffered *(ebp+8) "(ebp+")
7591 (print-int32-buffered *(ebp+8) *(eax+0xc))
7592 (write-buffered *(ebp+8) ")")
7593 }
7594 $translate-mu-length-stmt:emit-output:
7595 (write-buffered *(ebp+8) " ")
7596
7597 8b/-> *(ecx+0xc) 0/r32/eax
7598 8b/-> *eax 0/r32/eax
7599 (get Registers *(eax+0x10) 8 "Registers")
7600 (print-int32-buffered *(ebp+8) *eax)
7601 (write-buffered *(ebp+8) "/r32\n")
7602 $translate-mu-length-stmt:end:
7603
7604 59/pop-to-ecx
7605 58/pop-to-eax
7606
7607 89/<- %esp 5/r32/ebp
7608 5d/pop-to-ebp
7609 c3/return
7610
7611 translate-mu-index-stmt:
7612
7613 55/push-ebp
7614 89/<- %ebp 4/r32/esp
7615
7616 51/push-ecx
7617
7618 8b/-> *(ebp+0xc) 1/r32/ecx
7619 8b/-> *(ecx+8) 1/r32/ecx
7620 8b/-> *ecx 1/r32/ecx
7621
7622 {
7623 81 7/subop/compare *(ecx+0x10) 0/imm32
7624 74/jump-if-= break/disp8
7625
7626 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc))
7627 eb/jump $translate-mu-index-stmt:end/disp8
7628 }
7629
7630 {
7631 81 7/subop/compare *(ecx+0xc) 0/imm32
7632 74/jump-if-= break/disp8
7633
7634 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc))
7635 eb/jump $translate-mu-index-stmt:end/disp8
7636 }
7637 $translate-mu-index-stmt:end:
7638
7639 59/pop-to-ecx
7640
7641 89/<- %esp 5/r32/ebp
7642 5d/pop-to-ebp
7643 c3/return
7644
7645 $translate-mu-index-stmt-with-array:error1:
7646 (write-buffered Stderr "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n")
7647 (flush Stderr)
7648
7649 bb/copy-to-ebx 1/imm32
7650 b8/copy-to-eax 1/imm32/exit
7651 cd/syscall 0x80/imm8
7652
7653
7654 $translate-mu-index-stmt-with-array:error2:
7655 (write-buffered Stderr "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n")
7656 (flush Stderr)
7657
7658 bb/copy-to-ebx 1/imm32
7659 b8/copy-to-eax 1/imm32/exit
7660 cd/syscall 0x80/imm8
7661
7662
7663 translate-mu-index-stmt-with-array-in-register:
7664
7665 55/push-ebp
7666 89/<- %ebp 4/r32/esp
7667
7668 50/push-eax
7669 51/push-ecx
7670 52/push-edx
7671 53/push-ebx
7672
7673 (emit-indent *(ebp+8) *Curr-block-depth)
7674 (write-buffered *(ebp+8) "8d/copy-address *(")
7675
7676 $translate-mu-index-stmt-with-array-in-register:emit-base:
7677
7678 8b/-> *(ebp+0xc) 1/r32/ecx
7679
7680 8b/-> *(ecx+8) 3/r32/ebx
7681 8b/-> *ebx 3/r32/ebx
7682
7683 (write-buffered *(ebp+8) *(ebx+0x10))
7684
7685 (write-buffered *(ebp+8) " + ")
7686
7687 8b/-> *(ecx+8) 2/r32/edx
7688 8b/-> *(edx+4) 2/r32/edx
7689 8b/-> *edx 2/r32/edx
7690
7691 81 7/subop/compare *(edx+0x10) 0/imm32
7692 {
7693 0f 84/jump-if-= break/disp32
7694 $translate-mu-index-stmt-with-array-in-register:emit-register-index:
7695
7696 (is-simple-mu-type? *(edx+4) 1)
7697 3d/compare-eax-and 0/imm32/false
7698 {
7699 0f 84/jump-if-= break/disp32
7700 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index:
7701
7702
7703 (write-buffered *(ebp+8) *(edx+0x10))
7704 (write-buffered *(ebp+8) "<<")
7705
7706
7707 (array-element-type-id %ebx)
7708 (size-of-type-id %eax)
7709 (num-shift-rights %eax)
7710 (print-int32-buffered *(ebp+8) %eax)
7711 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32
7712 }
7713
7714 8b/-> *(edx+4) 0/r32/eax
7715 8b/-> *eax 0/r32/eax
7716 3b/compare 0/r32/eax *Max-type-id
7717 0f 82/jump-if-addr< $translate-mu-index-stmt-with-array:error2/disp32
7718
7719 (is-simple-mu-type? %eax 7)
7720 3d/compare-eax-and 0/imm32/false
7721 {
7722 0f 84/jump-if-= break/disp32
7723
7724 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index:
7725 (write-buffered *(ebp+8) *(edx+0x10))
7726 }
7727 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done:
7728 (write-buffered *(ebp+8) " + 4) ")
7729 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7730 }
7731
7732 (is-simple-mu-type? *(edx+4) 0)
7733 3d/compare-eax-and 0/imm32/false
7734 {
7735 0f 84/jump-if-= break/disp32
7736 $translate-mu-index-stmt-with-array-in-register:emit-literal-index:
7737
7738 (parse-hex-int *edx)
7739 89/<- %edx 0/r32/eax
7740
7741 (array-element-type-id %ebx)
7742 (size-of-type-id %eax)
7743 f7 4/subop/multiply-into-eax %edx
7744
7745 05/add-to-eax 4/imm32
7746
7747
7748 (print-int32-buffered *(ebp+8) %eax)
7749 (write-buffered *(ebp+8) ") ")
7750 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7751 }
7752
7753 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
7754 $translate-mu-index-stmt-with-array-in-register:emit-output:
7755
7756 8b/-> *(ebp+0xc) 1/r32/ecx
7757 8b/-> *(ecx+0xc) 0/r32/eax
7758 8b/-> *eax 0/r32/eax
7759 (get Registers *(eax+0x10) 8 "Registers")
7760 (print-int32-buffered *(ebp+8) *eax)
7761 (write-buffered *(ebp+8) "/r32\n")
7762 $translate-mu-index-stmt-with-array-in-register:end:
7763
7764 5b/pop-to-ebx
7765 5a/pop-to-edx
7766 59/pop-to-ecx
7767 58/pop-to-eax
7768
7769 89/<- %esp 5/r32/ebp
7770 5d/pop-to-ebp
7771 c3/return
7772
7773 translate-mu-index-stmt-with-array-on-stack:
7774
7775 55/push-ebp
7776 89/<- %ebp 4/r32/esp
7777
7778 50/push-eax
7779 51/push-ecx
7780 52/push-edx
7781 53/push-ebx
7782
7783 (emit-indent *(ebp+8) *Curr-block-depth)
7784 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ")
7785
7786 8b/-> *(ebp+0xc) 0/r32/eax
7787
7788 8b/-> *(eax+8) 0/r32/eax
7789 8b/-> *eax 1/r32/ecx
7790
7791 8b/-> *(eax+4) 0/r32/eax
7792
7793 8b/-> *eax 2/r32/edx
7794
7795 81 7/subop/compare *(edx+0x10) 0/imm32
7796 {
7797 0f 84/jump-if-= break/disp32
7798 $translate-mu-index-stmt-with-array-on-stack:emit-register-index:
7799
7800 (is-simple-mu-type? *(edx+4) 1)
7801 3d/compare-eax-and 0/imm32/false
7802 {
7803 0f 84/jump-if-= break/disp32
7804 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index:
7805
7806
7807 (write-buffered *(ebp+8) *(edx+0x10))
7808 (write-buffered *(ebp+8) "<<")
7809
7810
7811 (array-element-type-id %ecx)
7812 (size-of-type-id %eax)
7813 (num-shift-rights %eax)
7814 (print-int32-buffered *(ebp+8) %eax)
7815
7816 (write-buffered *(ebp+8) " + ")
7817
7818 8b/-> *(ecx+0xc) 0/r32/eax
7819 05/add-to-eax 4/imm32
7820 (print-int32-buffered *(ebp+8) %eax)
7821 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32
7822 }
7823
7824 8b/-> *(edx+4) 0/r32/eax
7825 8b/-> *eax 0/r32/eax
7826 3b/compare 0/r32/eax *Max-type-id
7827 0f 82/jump-if-addr< $translate-mu-index-stmt-with-array:error2/disp32
7828
7829 (is-simple-mu-type? %eax 7)
7830 3d/compare-eax-and 0/imm32/false
7831 {
7832 0f 84/jump-if-= break/disp32
7833
7834 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index:
7835 (write-buffered *(ebp+8) *(edx+0x10))
7836 }
7837 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done:
7838 (write-buffered *(ebp+8) ") ")
7839 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
7840 }
7841
7842 (is-simple-mu-type? *(edx+4) 0)
7843 3d/compare-eax-and 0/imm32/false
7844 {
7845 0f 84/jump-if-= break/disp32
7846 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index:
7847
7848 (parse-hex-int *edx)
7849 89/<- %ebx 0/r32/eax
7850
7851 (array-element-type-id %ecx)
7852 (size-of-type-id %eax)
7853 f7 4/subop/multiply-into-eax %ebx
7854
7855 03/add-to 0/r32/eax *(ecx+0xc)
7856
7857 05/add-to-eax 4/imm32
7858
7859
7860 (print-int32-buffered *(ebp+8) %eax)
7861 (write-buffered *(ebp+8) ") ")
7862 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
7863 }
7864
7865 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
7866 $translate-mu-index-stmt-with-array-on-stack:emit-output:
7867
7868 8b/-> *(ebp+0xc) 0/r32/eax
7869 8b/-> *(eax+0xc) 0/r32/eax
7870 8b/-> *eax 0/r32/eax
7871 (get Registers *(eax+0x10) 8 "Registers")
7872 (print-int32-buffered *(ebp+8) *eax)
7873 (write-buffered *(ebp+8) "/r32\n")
7874 $translate-mu-index-stmt-with-array-on-stack:end:
7875
7876 5b/pop-to-ebx
7877 5a/pop-to-edx
7878 59/pop-to-ecx
7879 58/pop-to-eax
7880
7881 89/<- %esp 5/r32/ebp
7882 5d/pop-to-ebp
7883 c3/return
7884
7885 translate-mu-compute-index-stmt:
7886
7887 55/push-ebp
7888 89/<- %ebp 4/r32/esp
7889
7890 50/push-eax
7891 51/push-ecx
7892 52/push-edx
7893 53/push-ebx
7894
7895 (emit-indent *(ebp+8) *Curr-block-depth)
7896 (write-buffered *(ebp+8) "69/multiply ")
7897 $translate-mu-compute-index-stmt:emit-elem-size:
7898
7899 8b/-> *(ebp+0xc) 1/r32/ecx
7900
7901 8b/-> *(ecx+8) 2/r32/edx
7902
7903 8b/-> *edx 3/r32/ebx
7904
7905 (array-element-type-id %ebx)
7906 (size-of-type-id %eax)
7907 (print-int32-buffered *(ebp+8) %eax)
7908 (write-buffered *(ebp+8) "/imm32")
7909 $translate-mu-compute-index-stmt:emit-index:
7910 (emit-subx-var-as-rm32 *(ebp+8) *(edx+4))
7911 (write-buffered *(ebp+8) Space)
7912 $translate-mu-compute-index-stmt:emit-output:
7913
7914 8b/-> *(ecx+0xc) 0/r32/eax
7915 8b/-> *eax 0/r32/eax
7916 (get Registers *(eax+0x10) 8 "Registers")
7917 (print-int32-buffered *(ebp+8) *eax)
7918 (write-buffered *(ebp+8) "/r32\n")
7919 $translate-mu-compute-index-stmt:end:
7920
7921 5b/pop-to-ebx
7922 5a/pop-to-edx
7923 59/pop-to-ecx
7924 58/pop-to-eax
7925
7926 89/<- %esp 5/r32/ebp
7927 5d/pop-to-ebp
7928 c3/return
7929
7930 translate-mu-get-stmt:
7931
7932 55/push-ebp
7933 89/<- %ebp 4/r32/esp
7934
7935 50/push-eax
7936 51/push-ecx
7937 52/push-edx
7938
7939 (emit-indent *(ebp+8) *Curr-block-depth)
7940 (write-buffered *(ebp+8) "8d/copy-address ")
7941
7942 8b/-> *(ebp+0xc) 1/r32/ecx
7943
7944 (mu-get-offset %ecx)
7945 89/<- %edx 0/r32/eax
7946
7947 8b/-> *(ecx+8) 0/r32/eax
7948 8b/-> *eax 0/r32/eax
7949
7950 81 7/subop/compare *(eax+0x10) 0/imm32
7951 {
7952 0f 84/jump-if-= break/disp32
7953 $translate-mu-get-stmt:emit-register-input:
7954
7955 (write-buffered *(ebp+8) "*(")
7956 (write-buffered *(ebp+8) *(eax+0x10))
7957 (write-buffered *(ebp+8) " + ")
7958 (print-int32-buffered *(ebp+8) %edx)
7959 (write-buffered *(ebp+8) ") ")
7960 e9/jump $translate-mu-get-stmt:emit-output/disp32
7961 }
7962
7963 {
7964 $translate-mu-get-stmt:emit-stack-input:
7965
7966 (write-buffered *(ebp+8) "*(ebp+")
7967 03/add-from *(eax+0xc) 2/r32/edx
7968 (print-int32-buffered *(ebp+8) %edx)
7969 (write-buffered *(ebp+8) ") ")
7970 eb/jump $translate-mu-get-stmt:emit-output/disp8
7971 }
7972 $translate-mu-get-stmt:emit-output:
7973
7974 8b/-> *(ecx+0xc) 0/r32/eax
7975 8b/-> *eax 0/r32/eax
7976 (get Registers *(eax+0x10) 8 "Registers")
7977 (print-int32-buffered *(ebp+8) *eax)
7978 (write-buffered *(ebp+8) "/r32\n")
7979 $translate-mu-get-stmt:end:
7980
7981 5a/pop-to-edx
7982 59/pop-to-ecx
7983 58/pop-to-eax
7984
7985 89/<- %esp 5/r32/ebp
7986 5d/pop-to-ebp
7987 c3/return
7988
7989 array-element-type-id:
7990
7991
7992 55/push-ebp
7993 89/<- %ebp 4/r32/esp
7994
7995 8b/-> *(ebp+8) 0/r32/eax
7996 8b/-> *(eax+4) 0/r32/eax
7997
7998 8b/-> *(eax+4) 0/r32/eax
7999
8000
8001 8b/-> *(eax+4) 0/r32/eax
8002
8003 8b/-> *eax 0/r32/eax
8004 8b/-> *eax 0/r32/eax
8005 $array-element-type-id:end:
8006
8007 89/<- %esp 5/r32/ebp
8008 5d/pop-to-ebp
8009 c3/return
8010
8011 power-of-2?:
8012
8013
8014 55/push-ebp
8015 89/<- %ebp 4/r32/esp
8016
8017 8b/-> *(ebp+8) 0/r32/eax
8018 48/decrement-eax
8019
8020 0b/and-> *(ebp+8) 0/r32/eax
8021
8022 3d/compare-eax-and 0/imm32
8023 0f 94/set-byte-if-= %al
8024 81 4/subop/and %eax 0xff/imm32
8025 $power-of-2?:end:
8026
8027 89/<- %esp 5/r32/ebp
8028 5d/pop-to-ebp
8029 c3/return
8030
8031 num-shift-rights:
8032
8033
8034 55/push-ebp
8035 89/<- %ebp 4/r32/esp
8036
8037 51/push-ecx
8038
8039 8b/-> *(ebp+8) 1/r32/ecx
8040
8041 b8/copy-to-eax 0/imm32
8042 {
8043
8044 81 7/subop/compare %ecx 1/imm32
8045 7e/jump-if-<= break/disp8
8046 40/increment-eax
8047 c1/shift 5/subop/arithmetic-right %ecx 1/imm8
8048 eb/jump loop/disp8
8049 }
8050 $num-shift-rights:end:
8051
8052 59/pop-to-ecx
8053
8054 89/<- %esp 5/r32/ebp
8055 5d/pop-to-ebp
8056 c3/return
8057
8058 mu-get-offset:
8059
8060 55/push-ebp
8061 89/<- %ebp 4/r32/esp
8062
8063 8b/-> *(ebp+8) 0/r32/eax
8064 8b/-> *(eax+8) 0/r32/eax
8065 8b/-> *(eax+4) 0/r32/eax
8066
8067 8b/-> *eax 0/r32/eax
8068
8069 8b/-> *(eax+0xc) 0/r32/eax
8070 $emit-get-offset:end:
8071
8072 89/<- %esp 5/r32/ebp
8073 5d/pop-to-ebp
8074 c3/return
8075
8076 emit-subx-block:
8077
8078 55/push-ebp
8079 89/<- %ebp 4/r32/esp
8080
8081 50/push-eax
8082 51/push-ecx
8083 56/push-esi
8084
8085 8b/-> *(ebp+0xc) 6/r32/esi
8086
8087 8b/-> *(esi+8) 0/r32/eax
8088 8b/-> *Curr-block-depth 1/r32/ecx
8089 89/<- *(eax+8) 1/r32/ecx
8090
8091 8b/-> *(esi+4) 0/r32/eax
8092
8093 {
8094 $emit-subx-block:check-empty:
8095 3d/compare-eax-and 0/imm32
8096 0f 84/jump-if-= break/disp32
8097 (emit-indent *(ebp+8) *Curr-block-depth)
8098 (write-buffered *(ebp+8) "{\n")
8099
8100 8b/-> *(esi+8) 1/r32/ecx
8101
8102 (write-buffered *(ebp+8) *ecx)
8103 (write-buffered *(ebp+8) ":loop:\n")
8104 ff 0/subop/increment *Curr-block-depth
8105 (push *(ebp+0x10) %ecx)
8106 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10))
8107 (pop *(ebp+0x10))
8108 ff 1/subop/decrement *Curr-block-depth
8109 (emit-indent *(ebp+8) *Curr-block-depth)
8110 (write-buffered *(ebp+8) "}\n")
8111 (write-buffered *(ebp+8) *ecx)
8112 (write-buffered *(ebp+8) ":break:\n")
8113 }
8114 $emit-subx-block:end:
8115
8116 5e/pop-to-esi
8117 59/pop-to-ecx
8118 58/pop-to-eax
8119
8120 89/<- %esp 5/r32/ebp
8121 5d/pop-to-ebp
8122 c3/return
8123
8124
8125
8126 == data
8127 Primitives:
8128
8129 _Primitive-inc-eax:
8130
8131 "increment"/imm32/name
8132 0/imm32/no-inouts
8133 Single-int-var-in-eax/imm32/outputs
8134 "40/increment-eax"/imm32/subx-name
8135 0/imm32/no-rm32
8136 0/imm32/no-r32
8137 0/imm32/no-imm32
8138 0/imm32/no-disp32
8139 0/imm32/output-is-write-only
8140 _Primitive-inc-ecx/imm32/next
8141 _Primitive-inc-ecx:
8142
8143 "increment"/imm32/name
8144 0/imm32/no-inouts
8145 Single-int-var-in-ecx/imm32/outputs
8146 "41/increment-ecx"/imm32/subx-name
8147 0/imm32/no-rm32
8148 0/imm32/no-r32
8149 0/imm32/no-imm32
8150 0/imm32/no-disp32
8151 0/imm32/output-is-write-only
8152 _Primitive-inc-edx/imm32/next
8153 _Primitive-inc-edx:
8154
8155 "increment"/imm32/name
8156 0/imm32/no-inouts
8157 Single-int-var-in-edx/imm32/outputs
8158 "42/increment-edx"/imm32/subx-name
8159 0/imm32/no-rm32
8160 0/imm32/no-r32
8161 0/imm32/no-imm32
8162 0/imm32/no-disp32
8163 0/imm32/output-is-write-only
8164 _Primitive-inc-ebx/imm32/next
8165 _Primitive-inc-ebx:
8166
8167 "increment"/imm32/name
8168 0/imm32/no-inouts
8169 Single-int-var-in-ebx/imm32/outputs
8170 "43/increment-ebx"/imm32/subx-name
8171 0/imm32/no-rm32
8172 0/imm32/no-r32
8173 0/imm32/no-imm32
8174 0/imm32/no-disp32
8175 0/imm32/output-is-write-only
8176 _Primitive-inc-esi/imm32/next
8177 _Primitive-inc-esi:
8178
8179 "increment"/imm32/name
8180 0/imm32/no-inouts
8181 Single-int-var-in-esi/imm32/outputs
8182 "46/increment-esi"/imm32/subx-name
8183 0/imm32/no-rm32
8184 0/imm32/no-r32
8185 0/imm32/no-imm32
8186 0/imm32/no-disp32
8187 0/imm32/output-is-write-only
8188 _Primitive-inc-edi/imm32/next
8189 _Primitive-inc-edi:
8190
8191 "increment"/imm32/name
8192 0/imm32/no-inouts
8193 Single-int-var-in-edi/imm32/outputs
8194 "47/increment-edi"/imm32/subx-name
8195 0/imm32/no-rm32
8196 0/imm32/no-r32
8197 0/imm32/no-imm32
8198 0/imm32/no-disp32
8199 0/imm32/output-is-write-only
8200 _Primitive-dec-eax/imm32/next
8201 _Primitive-dec-eax:
8202
8203 "decrement"/imm32/name
8204 0/imm32/no-inouts
8205 Single-int-var-in-eax/imm32/outputs
8206 "48/decrement-eax"/imm32/subx-name
8207 0/imm32/no-rm32
8208 0/imm32/no-r32
8209 0/imm32/no-imm32
8210 0/imm32/no-disp32
8211 0/imm32/output-is-write-only
8212 _Primitive-dec-ecx/imm32/next
8213 _Primitive-dec-ecx:
8214
8215 "decrement"/imm32/name
8216 0/imm32/no-inouts
8217 Single-int-var-in-ecx/imm32/outputs
8218 "49/decrement-ecx"/imm32/subx-name
8219 0/imm32/no-rm32
8220 0/imm32/no-r32
8221 0/imm32/no-imm32
8222 0/imm32/no-disp32
8223 0/imm32/output-is-write-only
8224 _Primitive-dec-edx/imm32/next
8225 _Primitive-dec-edx:
8226
8227 "decrement"/imm32/name
8228 0/imm32/no-inouts
8229 Single-int-var-in-edx/imm32/outputs
8230 "4a/decrement-edx"/imm32/subx-name
8231 0/imm32/no-rm32
8232 0/imm32/no-r32
8233 0/imm32/no-imm32
8234 0/imm32/no-disp32
8235 0/imm32/output-is-write-only
8236 _Primitive-dec-ebx/imm32/next
8237 _Primitive-dec-ebx:
8238
8239 "decrement"/imm32/name
8240 0/imm32/no-inouts
8241 Single-int-var-in-ebx/imm32/outputs
8242 "4b/decrement-ebx"/imm32/subx-name
8243 0/imm32/no-rm32
8244 0/imm32/no-r32
8245 0/imm32/no-imm32
8246 0/imm32/no-disp32
8247 0/imm32/output-is-write-only
8248 _Primitive-dec-esi/imm32/next
8249 _Primitive-dec-esi:
8250
8251 "decrement"/imm32/name
8252 0/imm32/no-inouts
8253 Single-int-var-in-esi/imm32/outputs
8254 "4e/decrement-esi"/imm32/subx-name
8255 0/imm32/no-rm32
8256 0/imm32/no-r32
8257 0/imm32/no-imm32
8258 0/imm32/no-disp32
8259 0/imm32/output-is-write-only
8260 _Primitive-dec-edi/imm32/next
8261 _Primitive-dec-edi:
8262
8263 "decrement"/imm32/name
8264 0/imm32/no-inouts
8265 Single-int-var-in-edi/imm32/outputs
8266 "4f/decrement-edi"/imm32/subx-name
8267 0/imm32/no-rm32
8268 0/imm32/no-r32
8269 0/imm32/no-imm32
8270 0/imm32/no-disp32
8271 0/imm32/output-is-write-only
8272 _Primitive-inc-mem/imm32/next
8273 _Primitive-inc-mem:
8274
8275 "increment"/imm32/name
8276 Single-int-var-in-mem/imm32/inouts
8277 0/imm32/no-outputs
8278 "ff 0/subop/increment"/imm32/subx-name
8279 1/imm32/rm32-is-first-inout
8280 0/imm32/no-r32
8281 0/imm32/no-imm32
8282 0/imm32/no-disp32
8283 0/imm32/output-is-write-only
8284 _Primitive-inc-reg/imm32/next
8285 _Primitive-inc-reg:
8286
8287 "increment"/imm32/name
8288 0/imm32/no-inouts
8289 Single-int-var-in-some-register/imm32/outputs
8290 "ff 0/subop/increment"/imm32/subx-name
8291 3/imm32/rm32-is-first-output
8292 0/imm32/no-r32
8293 0/imm32/no-imm32
8294 0/imm32/no-disp32
8295 0/imm32/output-is-write-only
8296 _Primitive-dec-mem/imm32/next
8297 _Primitive-dec-mem:
8298
8299 "decrement"/imm32/name
8300 Single-int-var-in-mem/imm32/inouts
8301 0/imm32/no-outputs
8302 "ff 1/subop/decrement"/imm32/subx-name
8303 1/imm32/rm32-is-first-inout
8304 0/imm32/no-r32
8305 0/imm32/no-imm32
8306 0/imm32/no-disp32
8307 0/imm32/output-is-write-only
8308 _Primitive-dec-reg/imm32/next
8309 _Primitive-dec-reg:
8310
8311 "decrement"/imm32/name
8312 0/imm32/no-inouts
8313 Single-int-var-in-some-register/imm32/outputs
8314 "ff 1/subop/decrement"/imm32/subx-name
8315 3/imm32/rm32-is-first-output
8316 0/imm32/no-r32
8317 0/imm32/no-imm32
8318 0/imm32/no-disp32
8319 0/imm32/output-is-write-only
8320 _Primitive-add-to-eax/imm32/next
8321
8322 _Primitive-add-to-eax:
8323
8324 "add"/imm32/name
8325 Single-lit-var/imm32/inouts
8326 Single-int-var-in-eax/imm32/outputs
8327 "05/add-to-eax"/imm32/subx-name
8328 0/imm32/no-rm32
8329 0/imm32/no-r32
8330 1/imm32/imm32-is-first-inout
8331 0/imm32/no-disp32
8332 0/imm32/output-is-write-only
8333 _Primitive-add-reg-to-reg/imm32/next
8334 _Primitive-add-reg-to-reg:
8335
8336 "add"/imm32/name
8337 Single-int-var-in-some-register/imm32/inouts
8338 Single-int-var-in-some-register/imm32/outputs
8339 "01/add-to"/imm32/subx-name
8340 3/imm32/rm32-is-first-output
8341 1/imm32/r32-is-first-inout
8342 0/imm32/no-imm32
8343 0/imm32/no-disp32
8344 0/imm32/output-is-write-only
8345 _Primitive-add-reg-to-mem/imm32/next
8346 _Primitive-add-reg-to-mem:
8347
8348 "add-to"/imm32/name
8349 Two-args-int-stack-int-reg/imm32/inouts
8350 0/imm32/outputs
8351 "01/add-to"/imm32/subx-name
8352 1/imm32/rm32-is-first-inout
8353 2/imm32/r32-is-second-inout
8354 0/imm32/no-imm32
8355 0/imm32/no-disp32
8356 0/imm32/output-is-write-only
8357 _Primitive-add-mem-to-reg/imm32/next
8358 _Primitive-add-mem-to-reg:
8359
8360 "add"/imm32/name
8361 Single-int-var-in-mem/imm32/inouts
8362 Single-int-var-in-some-register/imm32/outputs
8363 "03/add"/imm32/subx-name
8364 1/imm32/rm32-is-first-inout
8365 3/imm32/r32-is-first-output
8366 0/imm32/no-imm32
8367 0/imm32/no-disp32
8368 0/imm32/output-is-write-only
8369 _Primitive-add-lit-to-reg/imm32/next
8370 _Primitive-add-lit-to-reg:
8371
8372 "add"/imm32/name
8373 Single-lit-var/imm32/inouts
8374 Single-int-var-in-some-register/imm32/outputs
8375 "81 0/subop/add"/imm32/subx-name
8376 3/imm32/rm32-is-first-output
8377 0/imm32/no-r32
8378 1/imm32/imm32-is-first-inout
8379 0/imm32/no-disp32
8380 0/imm32/output-is-write-only
8381 _Primitive-add-lit-to-mem/imm32/next
8382 _Primitive-add-lit-to-mem:
8383
8384 "add-to"/imm32/name
8385 Int-var-and-literal/imm32/inouts
8386 0/imm32/outputs
8387 "81 0/subop/add"/imm32/subx-name
8388 1/imm32/rm32-is-first-inout
8389 0/imm32/no-r32
8390 2/imm32/imm32-is-second-inout
8391 0/imm32/no-disp32
8392 0/imm32/output-is-write-only
8393 _Primitive-subtract-from-eax/imm32/next
8394
8395 _Primitive-subtract-from-eax:
8396
8397 "subtract"/imm32/name
8398 Single-lit-var/imm32/inouts
8399 Single-int-var-in-eax/imm32/outputs
8400 "2d/subtract-from-eax"/imm32/subx-name
8401 0/imm32/no-rm32
8402 0/imm32/no-r32
8403 1/imm32/imm32-is-first-inout
8404 0/imm32/no-disp32
8405 0/imm32/output-is-write-only
8406 _Primitive-subtract-reg-from-reg/imm32/next
8407 _Primitive-subtract-reg-from-reg:
8408
8409 "subtract"/imm32/name
8410 Single-int-var-in-some-register/imm32/inouts
8411 Single-int-var-in-some-register/imm32/outputs
8412 "29/subtract-from"/imm32/subx-name
8413 3/imm32/rm32-is-first-output
8414 1/imm32/r32-is-first-inout
8415 0/imm32/no-imm32
8416 0/imm32/no-disp32
8417 0/imm32/output-is-write-only
8418 _Primitive-subtract-reg-from-mem/imm32/next
8419 _Primitive-subtract-reg-from-mem:
8420
8421 "subtract-from"/imm32/name
8422 Two-args-int-stack-int-reg/imm32/inouts
8423 0/imm32/outputs
8424 "29/subtract-from"/imm32/subx-name
8425 1/imm32/rm32-is-first-inout
8426 2/imm32/r32-is-second-inout
8427 0/imm32/no-imm32
8428 0/imm32/no-disp32
8429 0/imm32/output-is-write-only
8430 _Primitive-subtract-mem-from-reg/imm32/next
8431 _Primitive-subtract-mem-from-reg:
8432
8433 "subtract"/imm32/name
8434 Single-int-var-in-mem/imm32/inouts
8435 Single-int-var-in-some-register/imm32/outputs
8436 "2b/subtract"/imm32/subx-name
8437 1/imm32/rm32-is-first-inout
8438 3/imm32/r32-is-first-output
8439 0/imm32/no-imm32
8440 0/imm32/no-disp32
8441 0/imm32/output-is-write-only
8442 _Primitive-subtract-lit-from-reg/imm32/next
8443 _Primitive-subtract-lit-from-reg:
8444
8445 "subtract"/imm32/name
8446 Single-lit-var/imm32/inouts
8447 Single-int-var-in-some-register/imm32/outputs
8448 "81 5/subop/subtract"/imm32/subx-name
8449 3/imm32/rm32-is-first-output
8450 0/imm32/no-r32
8451 1/imm32/imm32-is-first-inout
8452 0/imm32/no-disp32
8453 0/imm32/output-is-write-only
8454 _Primitive-subtract-lit-from-mem/imm32/next
8455 _Primitive-subtract-lit-from-mem:
8456
8457 "subtract-from"/imm32/name
8458 Int-var-and-literal/imm32/inouts
8459 0/imm32/outputs
8460 "81 5/subop/subtract"/imm32/subx-name
8461 1/imm32/rm32-is-first-inout
8462 0/imm32/no-r32
8463 2/imm32/imm32-is-first-inout
8464 0/imm32/no-disp32
8465 0/imm32/output-is-write-only
8466 _Primitive-and-with-eax/imm32/next
8467
8468 _Primitive-and-with-eax:
8469
8470 "and"/imm32/name
8471 Single-lit-var/imm32/inouts
8472 Single-int-var-in-eax/imm32/outputs
8473 "25/and-with-eax"/imm32/subx-name
8474 0/imm32/no-rm32
8475 0/imm32/no-r32
8476 1/imm32/imm32-is-first-inout
8477 0/imm32/no-disp32
8478 0/imm32/output-is-write-only
8479 _Primitive-and-reg-with-reg/imm32/next
8480 _Primitive-and-reg-with-reg:
8481
8482 "and"/imm32/name
8483 Single-int-var-in-some-register/imm32/inouts
8484 Single-int-var-in-some-register/imm32/outputs
8485 "21/and-with"/imm32/subx-name
8486 3/imm32/rm32-is-first-output
8487 1/imm32/r32-is-first-inout
8488 0/imm32/no-imm32
8489 0/imm32/no-disp32
8490 0/imm32/output-is-write-only
8491 _Primitive-and-reg-with-mem/imm32/next
8492 _Primitive-and-reg-with-mem:
8493
8494 "and-with"/imm32/name
8495 Two-args-int-stack-int-reg/imm32/inouts
8496 0/imm32/outputs
8497 "21/and-with"/imm32/subx-name
8498 1/imm32/rm32-is-first-inout
8499 2/imm32/r32-is-second-inout
8500 0/imm32/no-imm32
8501 0/imm32/no-disp32
8502 0/imm32/output-is-write-only
8503 _Primitive-and-mem-with-reg/imm32/next
8504 _Primitive-and-mem-with-reg:
8505
8506 "and"/imm32/name
8507 Single-int-var-in-mem/imm32/inouts
8508 Single-int-var-in-some-register/imm32/outputs
8509 "23/and"/imm32/subx-name
8510 1/imm32/rm32-is-first-inout
8511 3/imm32/r32-is-first-output
8512 0/imm32/no-imm32
8513 0/imm32/no-disp32
8514 0/imm32/output-is-write-only
8515 _Primitive-and-lit-with-reg/imm32/next
8516 _Primitive-and-lit-with-reg:
8517
8518 "and"/imm32/name
8519 Single-lit-var/imm32/inouts
8520 Single-int-var-in-some-register/imm32/outputs
8521 "81 4/subop/and"/imm32/subx-name
8522 3/imm32/rm32-is-first-output
8523 0/imm32/no-r32
8524 1/imm32/imm32-is-first-inout
8525 0/imm32/no-disp32
8526 0/imm32/output-is-write-only
8527 _Primitive-and-lit-with-mem/imm32/next
8528 _Primitive-and-lit-with-mem:
8529
8530 "and-with"/imm32/name
8531 Int-var-and-literal/imm32/inouts
8532 0/imm32/outputs
8533 "81 4/subop/and"/imm32/subx-name
8534 1/imm32/rm32-is-first-inout
8535 0/imm32/no-r32
8536 2/imm32/imm32-is-first-inout
8537 0/imm32/no-disp32
8538 0/imm32/output-is-write-only
8539 _Primitive-or-with-eax/imm32/next
8540
8541 _Primitive-or-with-eax:
8542
8543 "or"/imm32/name
8544 Single-lit-var/imm32/inouts
8545 Single-int-var-in-eax/imm32/outputs
8546 "0d/or-with-eax"/imm32/subx-name
8547 0/imm32/no-rm32
8548 0/imm32/no-r32
8549 1/imm32/imm32-is-first-inout
8550 0/imm32/no-disp32
8551 0/imm32/output-is-write-only
8552 _Primitive-or-reg-with-reg/imm32/next
8553 _Primitive-or-reg-with-reg:
8554
8555 "or"/imm32/name
8556 Single-int-var-in-some-register/imm32/inouts
8557 Single-int-var-in-some-register/imm32/outputs
8558 "09/or-with"/imm32/subx-name
8559 3/imm32/rm32-is-first-output
8560 1/imm32/r32-is-first-inout
8561 0/imm32/no-imm32
8562 0/imm32/no-disp32
8563 0/imm32/output-is-write-only
8564 _Primitive-or-reg-with-mem/imm32/next
8565 _Primitive-or-reg-with-mem:
8566
8567 "or-with"/imm32/name
8568 Two-args-int-stack-int-reg/imm32/inouts
8569 0/imm32/outputs
8570 "09/or-with"/imm32/subx-name
8571 1/imm32/rm32-is-first-inout
8572 2/imm32/r32-is-second-inout
8573 0/imm32/no-imm32
8574 0/imm32/no-disp32
8575 0/imm32/output-is-write-only
8576 _Primitive-or-mem-with-reg/imm32/next
8577 _Primitive-or-mem-with-reg:
8578
8579 "or"/imm32/name
8580 Single-int-var-in-mem/imm32/inouts
8581 Single-int-var-in-some-register/imm32/outputs
8582 "0b/or"/imm32/subx-name
8583 1/imm32/rm32-is-first-inout
8584 3/imm32/r32-is-first-output
8585 0/imm32/no-imm32
8586 0/imm32/no-disp32
8587 0/imm32/output-is-write-only
8588 _Primitive-or-lit-with-reg/imm32/next
8589 _Primitive-or-lit-with-reg:
8590
8591 "or"/imm32/name
8592 Single-lit-var/imm32/inouts
8593 Single-int-var-in-some-register/imm32/outputs
8594 "81 1/subop/or"/imm32/subx-name
8595 3/imm32/rm32-is-first-output
8596 0/imm32/no-r32
8597 1/imm32/imm32-is-first-inout
8598 0/imm32/no-disp32
8599 0/imm32/output-is-write-only
8600 _Primitive-or-lit-with-mem/imm32/next
8601 _Primitive-or-lit-with-mem:
8602
8603 "or-with"/imm32/name
8604 Int-var-and-literal/imm32/inouts
8605 0/imm32/outputs
8606 "81 1/subop/or"/imm32/subx-name
8607 1/imm32/rm32-is-first-inout
8608 0/imm32/no-r32
8609 2/imm32/imm32-is-second-inout
8610 0/imm32/no-disp32
8611 0/imm32/output-is-write-only
8612 _Primitive-xor-with-eax/imm32/next
8613
8614 _Primitive-xor-with-eax:
8615
8616 "xor"/imm32/name
8617 Single-lit-var/imm32/inouts
8618 Single-int-var-in-eax/imm32/outputs
8619 "35/xor-with-eax"/imm32/subx-name
8620 0/imm32/no-rm32
8621 0/imm32/no-r32
8622 1/imm32/imm32-is-first-inout
8623 0/imm32/no-disp32
8624 0/imm32/output-is-write-only
8625 _Primitive-xor-reg-with-reg/imm32/next
8626 _Primitive-xor-reg-with-reg:
8627
8628 "xor"/imm32/name
8629 Single-int-var-in-some-register/imm32/inouts
8630 Single-int-var-in-some-register/imm32/outputs
8631 "31/xor-with"/imm32/subx-name
8632 3/imm32/rm32-is-first-output
8633 1/imm32/r32-is-first-inout
8634 0/imm32/no-imm32
8635 0/imm32/no-disp32
8636 0/imm32/output-is-write-only
8637 _Primitive-xor-reg-with-mem/imm32/next
8638 _Primitive-xor-reg-with-mem:
8639
8640 "xor-with"/imm32/name
8641 Two-args-int-stack-int-reg/imm32/inouts
8642 0/imm32/outputs
8643 "31/xor-with"/imm32/subx-name
8644 1/imm32/rm32-is-first-inout
8645 2/imm32/r32-is-second-inout
8646 0/imm32/no-imm32
8647 0/imm32/no-disp32
8648 0/imm32/output-is-write-only
8649 _Primitive-xor-mem-with-reg/imm32/next
8650 _Primitive-xor-mem-with-reg:
8651
8652 "xor"/imm32/name
8653 Single-int-var-in-mem/imm32/inouts
8654 Single-int-var-in-some-register/imm32/outputs
8655 "33/xor"/imm32/subx-name
8656 1/imm32/rm32-is-first-inout
8657 3/imm32/r32-is-first-output
8658 0/imm32/no-imm32
8659 0/imm32/no-disp32
8660 0/imm32/output-is-write-only
8661 _Primitive-xor-lit-with-reg/imm32/next
8662 _Primitive-xor-lit-with-reg:
8663
8664 "xor"/imm32/name
8665 Single-lit-var/imm32/inouts
8666 Single-int-var-in-some-register/imm32/outputs
8667 "81 6/subop/xor"/imm32/subx-name
8668 3/imm32/rm32-is-first-output
8669 0/imm32/no-r32
8670 1/imm32/imm32-is-first-inout
8671 0/imm32/no-disp32
8672 0/imm32/output-is-write-only
8673 _Primitive-xor-lit-with-mem/imm32/next
8674 _Primitive-xor-lit-with-mem:
8675
8676 "xor-with"/imm32/name
8677 Int-var-and-literal/imm32/inouts
8678 0/imm32/outputs
8679 "81 6/subop/xor"/imm32/subx-name
8680 1/imm32/rm32-is-first-inout
8681 0/imm32/no-r32
8682 2/imm32/imm32-is-first-inout
8683 0/imm32/no-disp32
8684 0/imm32/output-is-write-only
8685 _Primitive-copy-to-eax/imm32/next
8686
8687 _Primitive-copy-to-eax:
8688
8689 "copy"/imm32/name
8690 Single-lit-var/imm32/inouts
8691 Single-int-var-in-eax/imm32/outputs
8692 "b8/copy-to-eax"/imm32/subx-name
8693 0/imm32/no-rm32
8694 0/imm32/no-r32
8695 1/imm32/imm32-is-first-inout
8696 0/imm32/no-disp32
8697 1/imm32/output-is-write-only
8698 _Primitive-copy-to-ecx/imm32/next
8699 _Primitive-copy-to-ecx:
8700
8701 "copy"/imm32/name
8702 Single-lit-var/imm32/inouts
8703 Single-int-var-in-ecx/imm32/outputs
8704 "b9/copy-to-ecx"/imm32/subx-name
8705 0/imm32/no-rm32
8706 0/imm32/no-r32
8707 1/imm32/imm32-is-first-inout
8708 0/imm32/no-disp32
8709 1/imm32/output-is-write-only
8710 _Primitive-copy-to-edx/imm32/next
8711 _Primitive-copy-to-edx:
8712
8713 "copy"/imm32/name
8714 Single-lit-var/imm32/inouts
8715 Single-int-var-in-edx/imm32/outputs
8716 "ba/copy-to-edx"/imm32/subx-name
8717 0/imm32/no-rm32
8718 0/imm32/no-r32
8719 1/imm32/imm32-is-first-inout
8720 0/imm32/no-disp32
8721 1/imm32/output-is-write-only
8722 _Primitive-copy-to-ebx/imm32/next
8723 _Primitive-copy-to-ebx:
8724
8725 "copy"/imm32/name
8726 Single-lit-var/imm32/inouts
8727 Single-int-var-in-ebx/imm32/outputs
8728 "bb/copy-to-ebx"/imm32/subx-name
8729 0/imm32/no-rm32
8730 0/imm32/no-r32
8731 1/imm32/imm32-is-first-inout
8732 0/imm32/no-disp32
8733 1/imm32/output-is-write-only
8734 _Primitive-copy-to-esi/imm32/next
8735 _Primitive-copy-to-esi:
8736
8737 "copy"/imm32/name
8738 Single-lit-var/imm32/inouts
8739 Single-int-var-in-esi/imm32/outputs
8740 "be/copy-to-esi"/imm32/subx-name
8741 0/imm32/no-rm32
8742 0/imm32/no-r32
8743 1/imm32/imm32-is-first-inout
8744 0/imm32/no-disp32
8745 1/imm32/output-is-write-only
8746 _Primitive-copy-to-edi/imm32/next
8747 _Primitive-copy-to-edi:
8748
8749 "copy"/imm32/name
8750 Single-lit-var/imm32/inouts
8751 Single-int-var-in-edi/imm32/outputs
8752 "bf/copy-to-edi"/imm32/subx-name
8753 0/imm32/no-rm32
8754 0/imm32/no-r32
8755 1/imm32/imm32-is-first-inout
8756 0/imm32/no-disp32
8757 1/imm32/output-is-write-only
8758 _Primitive-copy-reg-to-reg/imm32/next
8759 _Primitive-copy-reg-to-reg:
8760
8761 "copy"/imm32/name
8762 Single-int-var-in-some-register/imm32/inouts
8763 Single-int-var-in-some-register/imm32/outputs
8764 "89/copy-to"/imm32/subx-name
8765 3/imm32/rm32-is-first-output
8766 1/imm32/r32-is-first-inout
8767 0/imm32/no-imm32
8768 0/imm32/no-disp32
8769 1/imm32/output-is-write-only
8770 _Primitive-copy-reg-to-mem/imm32/next
8771 _Primitive-copy-reg-to-mem:
8772
8773 "copy-to"/imm32/name
8774 Two-args-int-stack-int-reg/imm32/inouts
8775 0/imm32/outputs
8776 "89/copy-to"/imm32/subx-name
8777 1/imm32/rm32-is-first-inout
8778 2/imm32/r32-is-second-inout
8779 0/imm32/no-imm32
8780 0/imm32/no-disp32
8781 1/imm32/output-is-write-only
8782 _Primitive-copy-mem-to-reg/imm32/next
8783 _Primitive-copy-mem-to-reg:
8784
8785 "copy"/imm32/name
8786 Single-int-var-in-mem/imm32/inouts
8787 Single-int-var-in-some-register/imm32/outputs
8788 "8b/copy-from"/imm32/subx-name
8789 1/imm32/rm32-is-first-inout
8790 3/imm32/r32-is-first-output
8791 0/imm32/no-imm32
8792 0/imm32/no-disp32
8793 1/imm32/output-is-write-only
8794 _Primitive-copy-lit-to-reg/imm32/next
8795 _Primitive-copy-lit-to-reg:
8796
8797 "copy"/imm32/name
8798 Single-lit-var/imm32/inouts
8799 Single-int-var-in-some-register/imm32/outputs
8800 "c7 0/subop/copy"/imm32/subx-name
8801 3/imm32/rm32-is-first-output
8802 0/imm32/no-r32
8803 1/imm32/imm32-is-first-inout
8804 0/imm32/no-disp32
8805 1/imm32/output-is-write-only
8806 _Primitive-copy-lit-to-mem/imm32/next
8807 _Primitive-copy-lit-to-mem:
8808
8809 "copy-to"/imm32/name
8810 Int-var-and-literal/imm32/inouts
8811 0/imm32/outputs
8812 "c7 0/subop/copy"/imm32/subx-name
8813 1/imm32/rm32-is-first-inout
8814 0/imm32/no-r32
8815 2/imm32/imm32-is-first-inout
8816 0/imm32/no-disp32
8817 1/imm32/output-is-write-only
8818 _Primitive-address/imm32/next
8819
8820 _Primitive-address:
8821
8822 "address"/imm32/name
8823 Single-int-var-in-mem/imm32/inouts
8824 Single-addr-var-in-some-register/imm32/outputs
8825 "8d/copy-address"/imm32/subx-name
8826 1/imm32/rm32-is-first-inout
8827 3/imm32/r32-is-first-output
8828 0/imm32/no-imm32
8829 0/imm32/no-disp32
8830 1/imm32/output-is-write-only
8831 _Primitive-compare-mem-with-reg/imm32/next
8832
8833 _Primitive-compare-mem-with-reg:
8834
8835 "compare"/imm32/name
8836 Two-args-int-stack-int-reg/imm32/inouts
8837 0/imm32/outputs
8838 "39/compare->"/imm32/subx-name
8839 1/imm32/rm32-is-first-inout
8840 2/imm32/r32-is-second-inout
8841 0/imm32/no-imm32
8842 0/imm32/no-disp32
8843 0/imm32/output-is-write-only
8844 _Primitive-compare-reg-with-mem/imm32/next
8845 _Primitive-compare-reg-with-mem:
8846
8847 "compare"/imm32/name
8848 Two-args-int-reg-int-stack/imm32/inouts
8849 0/imm32/outputs
8850 "3b/compare<-"/imm32/subx-name
8851 2/imm32/rm32-is-second-inout
8852 1/imm32/r32-is-first-inout
8853 0/imm32/no-imm32
8854 0/imm32/no-disp32
8855 0/imm32/output-is-write-only
8856 _Primitive-compare-eax-with-literal/imm32/next
8857 _Primitive-compare-eax-with-literal:
8858
8859 "compare"/imm32/name
8860 Two-args-int-eax-int-literal/imm32/inouts
8861 0/imm32/outputs
8862 "3d/compare-eax-with"/imm32/subx-name
8863 0/imm32/no-rm32
8864 0/imm32/no-r32
8865 2/imm32/imm32-is-second-inout
8866 0/imm32/no-disp32
8867 0/imm32/output-is-write-only
8868 _Primitive-compare-reg-with-literal/imm32/next
8869 _Primitive-compare-reg-with-literal:
8870
8871 "compare"/imm32/name
8872 Int-var-in-register-and-literal/imm32/inouts
8873 0/imm32/outputs
8874 "81 7/subop/compare"/imm32/subx-name
8875 1/imm32/rm32-is-first-inout
8876 0/imm32/no-r32
8877 2/imm32/imm32-is-second-inout
8878 0/imm32/no-disp32
8879 0/imm32/output-is-write-only
8880 _Primitive-compare-mem-with-literal/imm32/next
8881 _Primitive-compare-mem-with-literal:
8882
8883 "compare"/imm32/name
8884 Int-var-and-literal/imm32/inouts
8885 0/imm32/outputs
8886 "81 7/subop/compare"/imm32/subx-name
8887 1/imm32/rm32-is-first-inout
8888 0/imm32/no-r32
8889 2/imm32/imm32-is-second-inout
8890 0/imm32/no-disp32
8891 0/imm32/output-is-write-only
8892 _Primitive-multiply-reg-by-mem/imm32/next
8893
8894 _Primitive-multiply-reg-by-mem:
8895
8896 "multiply"/imm32/name
8897 Single-int-var-in-mem/imm32/inouts
8898 Single-int-var-in-some-register/imm32/outputs
8899 "0f af/multiply"/imm32/subx-name
8900 1/imm32/rm32-is-first-inout
8901 3/imm32/r32-is-first-output
8902 0/imm32/no-imm32
8903 0/imm32/no-disp32
8904 0/imm32/output-is-write-only
8905 _Primitive-break-if-addr</imm32/next
8906
8907 _Primitive-break-if-addr<:
8908 "break-if-addr<"/imm32/name
8909 0/imm32/inouts
8910 0/imm32/outputs
8911 "0f 82/jump-if-addr< break/disp32"/imm32/subx-name
8912 0/imm32/no-rm32
8913 0/imm32/no-r32
8914 0/imm32/no-imm32
8915 0/imm32/no-disp32
8916 0/imm32/no-output
8917 _Primitive-break-if-addr>=/imm32/next
8918 _Primitive-break-if-addr>=:
8919 "break-if-addr>="/imm32/name
8920 0/imm32/inouts
8921 0/imm32/outputs
8922 "0f 83/jump-if-addr>= break/disp32"/imm32/subx-name
8923 0/imm32/no-rm32
8924 0/imm32/no-r32
8925 0/imm32/no-imm32
8926 0/imm32/no-disp32
8927 0/imm32/no-output
8928 _Primitive-break-if-=/imm32/next
8929 _Primitive-break-if-=:
8930 "break-if-="/imm32/name
8931 0/imm32/inouts
8932 0/imm32/outputs
8933 "0f 84/jump-if-= break/disp32"/imm32/subx-name
8934 0/imm32/no-rm32
8935 0/imm32/no-r32
8936 0/imm32/no-imm32
8937 0/imm32/no-disp32
8938 0/imm32/no-output
8939 _Primitive-break-if-!=/imm32/next
8940 _Primitive-break-if-!=:
8941 "break-if-!="/imm32/name
8942 0/imm32/inouts
8943 0/imm32/outputs
8944 "0f 85/jump-if-!= break/disp32"/imm32/subx-name
8945 0/imm32/no-rm32
8946 0/imm32/no-r32
8947 0/imm32/no-imm32
8948 0/imm32/no-disp32
8949 0/imm32/no-output
8950 _Primitive-break-if-addr<=/imm32/next
8951 _Primitive-break-if-addr<=:
8952 "break-if-addr<="/imm32/name
8953 0/imm32/inouts
8954 0/imm32/outputs
8955 "0f 86/jump-if-addr<= break/disp32"/imm32/subx-name
8956 0/imm32/no-rm32
8957 0/imm32/no-r32
8958 0/imm32/no-imm32
8959 0/imm32/no-disp32
8960 0/imm32/no-output
8961 _Primitive-break-if-addr>/imm32/next
8962 _Primitive-break-if-addr>:
8963 "break-if-addr>"/imm32/name
8964 0/imm32/inouts
8965 0/imm32/outputs
8966 "0f 87/jump-if-addr> break/disp32"/imm32/subx-name
8967 0/imm32/no-rm32
8968 0/imm32/no-r32
8969 0/imm32/no-imm32
8970 0/imm32/no-disp32
8971 0/imm32/no-output
8972 _Primitive-break-if-</imm32/next
8973 _Primitive-break-if-<:
8974 "break-if-<"/imm32/name
8975 0/imm32/inouts
8976 0/imm32/outputs
8977 "0f 8c/jump-if-< break/disp32"/imm32/subx-name
8978 0/imm32/no-rm32
8979 0/imm32/no-r32
8980 0/imm32/no-imm32
8981 0/imm32/no-disp32
8982 0/imm32/no-output
8983 _Primitive-break-if->=/imm32/next
8984 _Primitive-break-if->=:
8985 "break-if->="/imm32/name
8986 0/imm32/inouts
8987 0/imm32/outputs
8988 "0f 8d/jump-if->= break/disp32"/imm32/subx-name
8989 0/imm32/no-rm32
8990 0/imm32/no-r32
8991 0/imm32/no-imm32
8992 0/imm32/no-disp32
8993 0/imm32/no-output
8994 _Primitive-break-if-<=/imm32/next
8995 _Primitive-break-if-<=:
8996 "break-if-<="/imm32/name
8997 0/imm32/inouts
8998 0/imm32/outputs
8999 "0f 8e/jump-if-<= break/disp32"/imm32/subx-name
9000 0/imm32/no-rm32
9001 0/imm32/no-r32
9002 0/imm32/no-imm32
9003 0/imm32/no-disp32
9004 0/imm32/no-output
9005 _Primitive-break-if->/imm32/next
9006 _Primitive-break-if->:
9007 "break-if->"/imm32/name
9008 0/imm32/inouts
9009 0/imm32/outputs
9010 "0f 8f/jump-if-> break/disp32"/imm32/subx-name
9011 0/imm32/no-rm32
9012 0/imm32/no-r32
9013 0/imm32/no-imm32
9014 0/imm32/no-disp32
9015 0/imm32/no-output
9016 _Primitive-break/imm32/next
9017 _Primitive-break:
9018 "break"/imm32/name
9019 0/imm32/inouts
9020 0/imm32/outputs
9021 "e9/jump break/disp32"/imm32/subx-name
9022 0/imm32/no-rm32
9023 0/imm32/no-r32
9024 0/imm32/no-imm32
9025 0/imm32/no-disp32
9026 0/imm32/no-output
9027 _Primitive-loop-if-addr</imm32/next
9028 _Primitive-loop-if-addr<:
9029 "loop-if-addr<"/imm32/name
9030 0/imm32/inouts
9031 0/imm32/outputs
9032 "0f 82/jump-if-addr< loop/disp32"/imm32/subx-name
9033 0/imm32/no-rm32
9034 0/imm32/no-r32
9035 0/imm32/no-imm32
9036 0/imm32/no-disp32
9037 0/imm32/no-output
9038 _Primitive-loop-if-addr>=/imm32/next
9039 _Primitive-loop-if-addr>=:
9040 "loop-if-addr>="/imm32/name
9041 0/imm32/inouts
9042 0/imm32/outputs
9043 "0f 83/jump-if-addr>= loop/disp32"/imm32/subx-name
9044 0/imm32/no-rm32
9045 0/imm32/no-r32
9046 0/imm32/no-imm32
9047 0/imm32/no-disp32
9048 0/imm32/no-output
9049 _Primitive-loop-if-=/imm32/next
9050 _Primitive-loop-if-=:
9051 "loop-if-="/imm32/name
9052 0/imm32/inouts
9053 0/imm32/outputs
9054 "0f 84/jump-if-= loop/disp32"/imm32/subx-name
9055 0/imm32/no-rm32
9056 0/imm32/no-r32
9057 0/imm32/no-imm32
9058 0/imm32/no-disp32
9059 0/imm32/no-output
9060 _Primitive-loop-if-!=/imm32/next
9061 _Primitive-loop-if-!=:
9062 "loop-if-!="/imm32/name
9063 0/imm32/inouts
9064 0/imm32/outputs
9065 "0f 85/jump-if-!= loop/disp32"/imm32/subx-name
9066 0/imm32/no-rm32
9067 0/imm32/no-r32
9068 0/imm32/no-imm32
9069 0/imm32/no-disp32
9070 0/imm32/no-output
9071 _Primitive-loop-if-addr<=/imm32/next
9072 _Primitive-loop-if-addr<=:
9073 "loop-if-addr<="/imm32/name
9074 0/imm32/inouts
9075 0/imm32/outputs
9076 "0f 86/jump-if-addr<= loop/disp32"/imm32/subx-name
9077 0/imm32/no-rm32
9078 0/imm32/no-r32
9079 0/imm32/no-imm32
9080 0/imm32/no-disp32
9081 0/imm32/no-output
9082 _Primitive-loop-if-addr>/imm32/next
9083 _Primitive-loop-if-addr>:
9084 "loop-if-addr>"/imm32/name
9085 0/imm32/inouts
9086 0/imm32/outputs
9087 "0f 87/jump-if-addr> loop/disp32"/imm32/subx-name
9088 0/imm32/no-rm32
9089 0/imm32/no-r32
9090 0/imm32/no-imm32
9091 0/imm32/no-disp32
9092 0/imm32/no-output
9093 _Primitive-loop-if-</imm32/next
9094 _Primitive-loop-if-<:
9095 "loop-if-<"/imm32/name
9096 0/imm32/inouts
9097 0/imm32/outputs
9098 "0f 8c/jump-if-< loop/disp32"/imm32/subx-name
9099 0/imm32/no-rm32
9100 0/imm32/no-r32
9101 0/imm32/no-imm32
9102 0/imm32/no-disp32
9103 0/imm32/no-output
9104 _Primitive-loop-if->=/imm32/next
9105 _Primitive-loop-if->=:
9106 "loop-if->="/imm32/name
9107 0/imm32/inouts
9108 0/imm32/outputs
9109 "0f 8d/jump-if->= loop/disp32"/imm32/subx-name
9110 0/imm32/no-rm32
9111 0/imm32/no-r32
9112 0/imm32/no-imm32
9113 0/imm32/no-disp32
9114 0/imm32/no-output
9115 _Primitive-loop-if-<=/imm32/next
9116 _Primitive-loop-if-<=:
9117 "loop-if-<="/imm32/name
9118 0/imm32/inouts
9119 0/imm32/outputs
9120 "0f 8e/jump-if-<= loop/disp32"/imm32/subx-name
9121 0/imm32/no-rm32
9122 0/imm32/no-r32
9123 0/imm32/no-imm32
9124 0/imm32/no-disp32
9125 0/imm32/no-output
9126 _Primitive-loop-if->/imm32/next
9127 _Primitive-loop-if->:
9128 "loop-if->"/imm32/name
9129 0/imm32/inouts
9130 0/imm32/outputs
9131 "0f 8f/jump-if-> loop/disp32"/imm32/subx-name
9132 0/imm32/no-rm32
9133 0/imm32/no-r32
9134 0/imm32/no-imm32
9135 0/imm32/no-disp32
9136 0/imm32/no-output
9137 _Primitive-loop/imm32/next
9138 _Primitive-loop:
9139 "loop"/imm32/name
9140 0/imm32/inouts
9141 0/imm32/outputs
9142 "e9/jump loop/disp32"/imm32/subx-name
9143 0/imm32/no-rm32
9144 0/imm32/no-r32
9145 0/imm32/no-imm32
9146 0/imm32/no-disp32
9147 0/imm32/no-output
9148 _Primitive-break-if-addr<-named/imm32/next
9149
9150 _Primitive-break-if-addr<-named:
9151 "break-if-addr<"/imm32/name
9152 Single-lit-var/imm32/inouts
9153 0/imm32/outputs
9154 "0f 82/jump-if-addr<"/imm32/subx-name
9155 0/imm32/no-rm32
9156 0/imm32/no-r32
9157 0/imm32/no-imm32
9158 1/imm32/disp32-is-first-inout
9159 0/imm32/no-output
9160 _Primitive-break-if-addr>=-named/imm32/next
9161 _Primitive-break-if-addr>=-named:
9162 "break-if-addr>="/imm32/name
9163 Single-lit-var/imm32/inouts
9164 0/imm32/outputs
9165 "0f 83/jump-if-addr>="/imm32/subx-name
9166 0/imm32/no-rm32
9167 0/imm32/no-r32
9168 0/imm32/no-imm32
9169 1/imm32/disp32-is-first-inout
9170 0/imm32/no-output
9171 _Primitive-break-if-=-named/imm32/next
9172 _Primitive-break-if-=-named:
9173 "break-if-="/imm32/name
9174 Single-lit-var/imm32/inouts
9175 0/imm32/outputs
9176 "0f 84/jump-if-="/imm32/subx-name
9177 0/imm32/no-rm32
9178 0/imm32/no-r32
9179 0/imm32/no-imm32
9180 1/imm32/disp32-is-first-inout
9181 0/imm32/no-output
9182 _Primitive-break-if-!=-named/imm32/next
9183 _Primitive-break-if-!=-named:
9184 "break-if-!="/imm32/name
9185 Single-lit-var/imm32/inouts
9186 0/imm32/outputs
9187 "0f 85/jump-if-!="/imm32/subx-name
9188 0/imm32/no-rm32
9189 0/imm32/no-r32
9190 0/imm32/no-imm32
9191 1/imm32/disp32-is-first-inout
9192 0/imm32/no-output
9193 _Primitive-break-if-addr<=-named/imm32/next
9194 _Primitive-break-if-addr<=-named:
9195 "break-if-addr<="/imm32/name
9196 Single-lit-var/imm32/inouts
9197 0/imm32/outputs
9198 "0f 86/jump-if-addr<="/imm32/subx-name
9199 0/imm32/no-rm32
9200 0/imm32/no-r32
9201 0/imm32/no-imm32
9202 1/imm32/disp32-is-first-inout
9203 0/imm32/no-output
9204 _Primitive-break-if-addr>-named/imm32/next
9205 _Primitive-break-if-addr>-named:
9206 "break-if-addr>"/imm32/name
9207 Single-lit-var/imm32/inouts
9208 0/imm32/outputs
9209 "0f 87/jump-if-addr>"/imm32/subx-name
9210 0/imm32/no-rm32
9211 0/imm32/no-r32
9212 0/imm32/no-imm32
9213 1/imm32/disp32-is-first-inout
9214 0/imm32/no-output
9215 _Primitive-break-if-<-named/imm32/next
9216 _Primitive-break-if-<-named:
9217 "break-if-<"/imm32/name
9218 Single-lit-var/imm32/inouts
9219 0/imm32/outputs
9220 "0f 8c/jump-if-<"/imm32/subx-name
9221 0/imm32/no-rm32
9222 0/imm32/no-r32
9223 0/imm32/no-imm32
9224 1/imm32/disp32-is-first-inout
9225 0/imm32/no-output
9226 _Primitive-break-if->=-named/imm32/next
9227 _Primitive-break-if->=-named:
9228 "break-if->="/imm32/name
9229 Single-lit-var/imm32/inouts
9230 0/imm32/outputs
9231 "0f 8d/jump-if->="/imm32/subx-name
9232 0/imm32/no-rm32
9233 0/imm32/no-r32
9234 0/imm32/no-imm32
9235 1/imm32/disp32-is-first-inout
9236 0/imm32/no-output
9237 _Primitive-break-if-<=-named/imm32/next
9238 _Primitive-break-if-<=-named:
9239 "break-if-<="/imm32/name
9240 Single-lit-var/imm32/inouts
9241 0/imm32/outputs
9242 "0f 8e/jump-if-<="/imm32/subx-name
9243 0/imm32/no-rm32
9244 0/imm32/no-r32
9245 0/imm32/no-imm32
9246 1/imm32/disp32-is-first-inout
9247 0/imm32/no-output
9248 _Primitive-break-if->-named/imm32/next
9249 _Primitive-break-if->-named:
9250 "break-if->"/imm32/name
9251 Single-lit-var/imm32/inouts
9252 0/imm32/outputs
9253 "0f 8f/jump-if->"/imm32/subx-name
9254 0/imm32/no-rm32
9255 0/imm32/no-r32
9256 0/imm32/no-imm32
9257 1/imm32/disp32-is-first-inout
9258 0/imm32/no-output
9259 _Primitive-break-named/imm32/next
9260 _Primitive-break-named:
9261 "break"/imm32/name
9262 Single-lit-var/imm32/inouts
9263 0/imm32/outputs
9264 "e9/jump"/imm32/subx-name
9265 0/imm32/no-rm32
9266 0/imm32/no-r32
9267 0/imm32/no-imm32
9268 1/imm32/disp32-is-first-inout
9269 0/imm32/no-output
9270 _Primitive-loop-if-addr<-named/imm32/next
9271 _Primitive-loop-if-addr<-named:
9272 "loop-if-addr<"/imm32/name
9273 Single-lit-var/imm32/inouts
9274 0/imm32/outputs
9275 "0f 82/jump-if-addr<"/imm32/subx-name
9276 0/imm32/no-rm32
9277 0/imm32/no-r32
9278 0/imm32/no-imm32
9279 1/imm32/disp32-is-first-inout
9280 0/imm32/no-output
9281 _Primitive-loop-if-addr>=-named/imm32/next
9282 _Primitive-loop-if-addr>=-named:
9283 "loop-if-addr>="/imm32/name
9284 Single-lit-var/imm32/inouts
9285 0/imm32/outputs
9286 "0f 83/jump-if-addr>="/imm32/subx-name
9287 0/imm32/no-rm32
9288 0/imm32/no-r32
9289 0/imm32/no-imm32
9290 1/imm32/disp32-is-first-inout
9291 0/imm32/no-output
9292 _Primitive-loop-if-=-named/imm32/next
9293 _Primitive-loop-if-=-named:
9294 "loop-if-="/imm32/name
9295 Single-lit-var/imm32/inouts
9296 0/imm32/outputs
9297 "0f 84/jump-if-="/imm32/subx-name
9298 0/imm32/no-rm32
9299 0/imm32/no-r32
9300 0/imm32/no-imm32
9301 1/imm32/disp32-is-first-inout
9302 0/imm32/no-output
9303 _Primitive-loop-if-!=-named/imm32/next
9304 _Primitive-loop-if-!=-named:
9305 "loop-if-!="/imm32/name
9306 Single-lit-var/imm32/inouts
9307 0/imm32/outputs
9308 "0f 85/jump-if-!="/imm32/subx-name
9309 0/imm32/no-rm32
9310 0/imm32/no-r32
9311 0/imm32/no-imm32
9312 1/imm32/disp32-is-first-inout
9313 0/imm32/no-output
9314 _Primitive-loop-if-addr<=-named/imm32/next
9315 _Primitive-loop-if-addr<=-named:
9316 "loop-if-addr<="/imm32/name
9317 Single-lit-var/imm32/inouts
9318 0/imm32/outputs
9319 "0f 86/jump-if-addr<="/imm32/subx-name
9320 0/imm32/no-rm32
9321 0/imm32/no-r32
9322 0/imm32/no-imm32
9323 1/imm32/disp32-is-first-inout
9324 0/imm32/no-output
9325 _Primitive-loop-if-addr>-named/imm32/next
9326 _Primitive-loop-if-addr>-named:
9327 "loop-if-addr>"/imm32/name
9328 Single-lit-var/imm32/inouts
9329 0/imm32/outputs
9330 "0f 87/jump-if-addr>"/imm32/subx-name
9331 0/imm32/no-rm32
9332 0/imm32/no-r32
9333 0/imm32/no-imm32
9334 1/imm32/disp32-is-first-inout
9335 0/imm32/no-output
9336 _Primitive-loop-if-<-named/imm32/next
9337 _Primitive-loop-if-<-named:
9338 "loop-if-<"/imm32/name
9339 Single-lit-var/imm32/inouts
9340 0/imm32/outputs
9341 "0f 8c/jump-if-<"/imm32/subx-name
9342 0/imm32/no-rm32
9343 0/imm32/no-r32
9344 0/imm32/no-imm32
9345 1/imm32/disp32-is-first-inout
9346 0/imm32/no-output
9347 _Primitive-loop-if->=-named/imm32/next
9348 _Primitive-loop-if->=-named:
9349 "loop-if->="/imm32/name
9350 Single-lit-var/imm32/inouts
9351 0/imm32/outputs
9352 "0f 8d/jump-if->="/imm32/subx-name
9353 0/imm32/no-rm32
9354 0/imm32/no-r32
9355 0/imm32/no-imm32
9356 1/imm32/disp32-is-first-inout
9357 0/imm32/no-output
9358 _Primitive-loop-if-<=-named/imm32/next
9359 _Primitive-loop-if-<=-named:
9360 "loop-if-<="/imm32/name
9361 Single-lit-var/imm32/inouts
9362 0/imm32/outputs
9363 "0f 8e/jump-if-<="/imm32/subx-name
9364 0/imm32/no-rm32
9365 0/imm32/no-r32
9366 0/imm32/no-imm32
9367 1/imm32/disp32-is-first-inout
9368 0/imm32/no-output
9369 _Primitive-loop-if->-named/imm32/next
9370 _Primitive-loop-if->-named:
9371 "loop-if->"/imm32/name
9372 Single-lit-var/imm32/inouts
9373 0/imm32/outputs
9374 "0f 8f/jump-if->"/imm32/subx-name
9375 0/imm32/no-rm32
9376 0/imm32/no-r32
9377 0/imm32/no-imm32
9378 1/imm32/disp32-is-first-inout
9379 0/imm32/no-output
9380 _Primitive-loop-named/imm32/next
9381 _Primitive-loop-named:
9382 "loop"/imm32/name
9383 Single-lit-var/imm32/inouts
9384 0/imm32/outputs
9385 "e9/jump"/imm32/subx-name
9386 0/imm32/no-rm32
9387 0/imm32/no-r32
9388 0/imm32/no-imm32
9389 1/imm32/disp32-is-first-inout
9390 0/imm32/no-output
9391 0/imm32/next
9392
9393 Single-int-var-in-mem:
9394 Int-var-in-mem/imm32
9395 0/imm32/next
9396
9397 Int-var-in-mem:
9398 "arg1"/imm32/name
9399 Type-int/imm32
9400 1/imm32/some-block-depth
9401 1/imm32/some-stack-offset
9402 0/imm32/no-register
9403
9404 Two-args-int-stack-int-reg:
9405 Int-var-in-mem/imm32
9406 Single-int-var-in-some-register/imm32/next
9407
9408 Two-args-int-reg-int-stack:
9409 Int-var-in-some-register/imm32
9410 Single-int-var-in-mem/imm32/next
9411
9412 Two-args-int-eax-int-literal:
9413 Int-var-in-eax/imm32
9414 Single-lit-var/imm32/next
9415
9416 Int-var-and-literal:
9417 Int-var-in-mem/imm32
9418 Single-lit-var/imm32/next
9419
9420 Int-var-in-register-and-literal:
9421 Int-var-in-some-register/imm32
9422 Single-lit-var/imm32/next
9423
9424 Single-int-var-in-some-register:
9425 Int-var-in-some-register/imm32
9426 0/imm32/next
9427
9428 Single-addr-var-in-some-register:
9429 Addr-var-in-some-register/imm32
9430 0/imm32/next
9431
9432 Int-var-in-some-register:
9433 "arg1"/imm32/name
9434 Type-int/imm32
9435 1/imm32/some-block-depth
9436 0/imm32/no-stack-offset
9437 Any-register/imm32
9438
9439 Addr-var-in-some-register:
9440 "arg1"/imm32/name
9441 Type-addr/imm32
9442 1/imm32/some-block-depth
9443 0/imm32/no-stack-offset
9444 Any-register/imm32
9445
9446 Single-int-var-in-eax:
9447 Int-var-in-eax/imm32
9448 0/imm32/next
9449
9450 Int-var-in-eax:
9451 "arg1"/imm32/name
9452 Type-int/imm32
9453 1/imm32/some-block-depth
9454 0/imm32/no-stack-offset
9455 "eax"/imm32/register
9456
9457 Single-int-var-in-ecx:
9458 Int-var-in-ecx/imm32
9459 0/imm32/next
9460
9461 Int-var-in-ecx:
9462 "arg1"/imm32/name
9463 Type-int/imm32
9464 1/imm32/some-block-depth
9465 0/imm32/no-stack-offset
9466 "ecx"/imm32/register
9467
9468 Single-int-var-in-edx:
9469 Int-var-in-edx/imm32
9470 0/imm32/next
9471
9472 Int-var-in-edx:
9473 "arg1"/imm32/name
9474 Type-int/imm32
9475 1/imm32/some-block-depth
9476 0/imm32/no-stack-offset
9477 "edx"/imm32/register
9478
9479 Single-int-var-in-ebx:
9480 Int-var-in-ebx/imm32
9481 0/imm32/next
9482
9483 Int-var-in-ebx:
9484 "arg1"/imm32/name
9485 Type-int/imm32
9486 1/imm32/some-block-depth
9487 0/imm32/no-stack-offset
9488 "ebx"/imm32/register
9489
9490 Single-int-var-in-esi:
9491 Int-var-in-esi/imm32
9492 0/imm32/next
9493
9494 Int-var-in-esi:
9495 "arg1"/imm32/name
9496 Type-int/imm32
9497 1/imm32/some-block-depth
9498 0/imm32/no-stack-offset
9499 "esi"/imm32/register
9500
9501 Single-int-var-in-edi:
9502 Int-var-in-edi/imm32
9503 0/imm32/next
9504
9505 Int-var-in-edi:
9506 "arg1"/imm32/name
9507 Type-int/imm32
9508 1/imm32/some-block-depth
9509 0/imm32/no-stack-offset
9510 "edi"/imm32/register
9511
9512 Single-lit-var:
9513 Lit-var/imm32
9514 0/imm32/next
9515
9516 Lit-var:
9517 "literal"/imm32/name
9518 Type-literal/imm32
9519 1/imm32/some-block-depth
9520 0/imm32/no-stack-offset
9521 0/imm32/no-register
9522
9523 Type-int:
9524 1/imm32/left/int
9525 0/imm32/right/null
9526
9527 Type-literal:
9528 0/imm32/left/literal
9529 0/imm32/right/null
9530
9531 Type-addr:
9532 2/imm32/left/addr
9533 0/imm32/right/null
9534
9535 == code
9536 emit-subx-primitive:
9537
9538 55/push-ebp
9539 89/<- %ebp 4/r32/esp
9540
9541 50/push-eax
9542 51/push-ecx
9543
9544 8b/-> *(ebp+0x10) 1/r32/ecx
9545
9546 (emit-indent *(ebp+8) *Curr-block-depth)
9547 (write-buffered *(ebp+8) *(ecx+0xc))
9548
9549 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
9550
9551 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
9552
9553 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
9554
9555 (emit-subx-disp32 *(ebp+8) *(ecx+0x1c) *(ebp+0xc))
9556 (write-buffered *(ebp+8) Newline)
9557 $emit-subx-primitive:end:
9558
9559 59/pop-to-ecx
9560 58/pop-to-eax
9561
9562 89/<- %esp 5/r32/ebp
9563 5d/pop-to-ebp
9564 c3/return
9565
9566 emit-subx-rm32:
9567
9568 55/push-ebp
9569 89/<- %ebp 4/r32/esp
9570
9571 50/push-eax
9572
9573 81 7/subop/compare *(ebp+0xc) 0/imm32
9574 74/jump-if-= $emit-subx-rm32:end/disp8
9575
9576 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9577 (emit-subx-var-as-rm32 *(ebp+8) %eax)
9578 $emit-subx-rm32:end:
9579
9580 58/pop-to-eax
9581
9582 89/<- %esp 5/r32/ebp
9583 5d/pop-to-ebp
9584 c3/return
9585
9586 get-stmt-operand-from-arg-location:
9587
9588 55/push-ebp
9589 89/<- %ebp 4/r32/esp
9590
9591 51/push-ecx
9592
9593 8b/-> *(ebp+0xc) 0/r32/eax
9594
9595 8b/-> *(ebp+8) 1/r32/ecx
9596
9597 {
9598 3d/compare-eax-and 1/imm32
9599 75/jump-if-!= break/disp8
9600 $get-stmt-operand-from-arg-location:1:
9601 8b/-> *(ecx+8) 0/r32/eax
9602 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9603 }
9604
9605 {
9606 3d/compare-eax-and 2/imm32
9607 75/jump-if-!= break/disp8
9608 $get-stmt-operand-from-arg-location:2:
9609 8b/-> *(ecx+8) 0/r32/eax
9610 8b/-> *(eax+4) 0/r32/eax
9611 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9612 }
9613
9614 {
9615 3d/compare-eax-and 3/imm32
9616 75/jump-if-!= break/disp8
9617 $get-stmt-operand-from-arg-location:3:
9618 8b/-> *(ecx+0xc) 0/r32/eax
9619 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9620 }
9621
9622 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
9623 $get-stmt-operand-from-arg-location:end:
9624
9625 59/pop-to-ecx
9626
9627 89/<- %esp 5/r32/ebp
9628 5d/pop-to-ebp
9629 c3/return
9630
9631 $get-stmt-operand-from-arg-location:abort:
9632
9633 (write-buffered Stderr "invalid arg-location ")
9634 (print-int32-buffered Stderr %eax)
9635 (write-buffered Stderr Newline)
9636 (flush Stderr)
9637
9638 bb/copy-to-ebx 1/imm32
9639 b8/copy-to-eax 1/imm32/exit
9640 cd/syscall 0x80/imm8
9641
9642
9643 emit-subx-r32:
9644
9645 55/push-ebp
9646 89/<- %ebp 4/r32/esp
9647
9648 50/push-eax
9649 51/push-ecx
9650
9651 81 7/subop/compare *(ebp+0xc) 0/imm32
9652 0f 84/jump-if-= $emit-subx-r32:end/disp32
9653
9654 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9655 8b/-> *eax 0/r32/eax
9656 (maybe-get Registers *(eax+0x10) 8)
9657 (write-buffered *(ebp+8) Space)
9658 (print-int32-buffered *(ebp+8) *eax)
9659 (write-buffered *(ebp+8) "/r32")
9660 $emit-subx-r32:end:
9661
9662 59/pop-to-ecx
9663 58/pop-to-eax
9664
9665 89/<- %esp 5/r32/ebp
9666 5d/pop-to-ebp
9667 c3/return
9668
9669 emit-subx-imm32:
9670
9671 55/push-ebp
9672 89/<- %ebp 4/r32/esp
9673
9674 50/push-eax
9675 51/push-ecx
9676
9677 81 7/subop/compare *(ebp+0xc) 0/imm32
9678 74/jump-if-= $emit-subx-imm32:end/disp8
9679
9680 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9681 8b/-> *eax 0/r32/eax
9682 (write-buffered *(ebp+8) Space)
9683 (write-buffered *(ebp+8) *eax)
9684 (write-buffered *(ebp+8) "/imm32")
9685 $emit-subx-imm32:end:
9686
9687 59/pop-to-ecx
9688 58/pop-to-eax
9689
9690 89/<- %esp 5/r32/ebp
9691 5d/pop-to-ebp
9692 c3/return
9693
9694 emit-subx-disp32:
9695
9696 55/push-ebp
9697 89/<- %ebp 4/r32/esp
9698
9699 50/push-eax
9700 51/push-ecx
9701
9702 81 7/subop/compare *(ebp+0xc) 0/imm32
9703 0f 84/jump-if-= $emit-subx-disp32:end/disp32
9704
9705 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9706 8b/-> *eax 0/r32/eax
9707 (write-buffered *(ebp+8) Space)
9708 (write-buffered *(ebp+8) *eax)
9709
9710
9711 8b/-> *(ebp+0x10) 0/r32/eax
9712 8b/-> *(eax+4) 1/r32/ecx
9713 {
9714 (string-starts-with? %ecx "break")
9715 3d/compare-eax-and 0/imm32/false
9716 74/jump-if-= break/disp8
9717 (write-buffered *(ebp+8) ":break")
9718 }
9719
9720 {
9721 (string-starts-with? %ecx "loop")
9722 3d/compare-eax-and 0/imm32/false
9723 74/jump-if-= break/disp8
9724 (write-buffered *(ebp+8) ":loop")
9725 }
9726 (write-buffered *(ebp+8) "/disp32")
9727 $emit-subx-disp32:end:
9728
9729 59/pop-to-ecx
9730 58/pop-to-eax
9731
9732 89/<- %esp 5/r32/ebp
9733 5d/pop-to-ebp
9734 c3/return
9735
9736 emit-subx-call:
9737
9738 55/push-ebp
9739 89/<- %ebp 4/r32/esp
9740
9741 51/push-ecx
9742
9743 (emit-indent *(ebp+8) *Curr-block-depth)
9744 (write-buffered *(ebp+8) "(")
9745
9746 8b/-> *(ebp+0x10) 1/r32/ecx
9747 (write-buffered *(ebp+8) *(ecx+4))
9748
9749
9750 8b/-> *(ebp+0xc) 1/r32/ecx
9751 8b/-> *(ecx+8) 1/r32/ecx
9752 {
9753
9754 81 7/subop/compare %ecx 0/imm32
9755 74/jump-if-= break/disp8
9756
9757 (emit-subx-call-operand *(ebp+8) %ecx)
9758
9759 8b/-> *(ecx+4) 1/r32/ecx
9760 eb/jump loop/disp8
9761 }
9762
9763 (write-buffered *(ebp+8) ")\n")
9764 $emit-subx-call:end:
9765
9766 59/pop-to-ecx
9767
9768 89/<- %esp 5/r32/ebp
9769 5d/pop-to-ebp
9770 c3/return
9771
9772
9773
9774 emit-hailmary-call:
9775
9776 55/push-ebp
9777 89/<- %ebp 4/r32/esp
9778
9779 51/push-ecx
9780
9781 (emit-indent *(ebp+8) *Curr-block-depth)
9782 (write-buffered *(ebp+8) "(")
9783
9784 8b/-> *(ebp+0xc) 1/r32/ecx
9785
9786 (write-buffered *(ebp+8) *(ecx+4))
9787
9788
9789 8b/-> *(ecx+8) 1/r32/ecx
9790 {
9791
9792 81 7/subop/compare %ecx 0/imm32
9793 74/jump-if-= break/disp8
9794
9795 (emit-subx-call-operand *(ebp+8) %ecx)
9796
9797 8b/-> *(ecx+4) 1/r32/ecx
9798 eb/jump loop/disp8
9799 }
9800
9801 (write-buffered *(ebp+8) ")\n")
9802 $emit-hailmary-call:end:
9803
9804 59/pop-to-ecx
9805
9806 89/<- %esp 5/r32/ebp
9807 5d/pop-to-ebp
9808 c3/return
9809
9810 emit-subx-call-operand:
9811
9812
9813 55/push-ebp
9814 89/<- %ebp 4/r32/esp
9815
9816 50/push-eax
9817 51/push-ecx
9818 56/push-esi
9819
9820 8b/-> *(ebp+0xc) 1/r32/ecx
9821
9822 8b/-> *ecx 6/r32/esi
9823
9824 {
9825 $emit-subx-call-operand:check-for-register-indirect:
9826 81 7/subop/compare *(esi+0x10) 0/imm32
9827 74/jump-if-= break/disp8
9828 81 7/subop/compare *(ecx+8) 0/imm32/false
9829 74/jump-if-= break/disp8
9830 $emit-subx-call-operand:register-indirect:
9831 (write-buffered *(ebp+8) " *")
9832 (write-buffered *(ebp+8) *(esi+0x10))
9833 e9/jump $emit-subx-call-operand:end/disp32
9834 }
9835
9836 {
9837 $emit-subx-call-operand:check-for-register-direct:
9838 81 7/subop/compare *(esi+0x10) 0/imm32
9839 74/jump-if-= break/disp8
9840 81 7/subop/compare *(ecx+8) 0/imm32/false
9841 75/jump-if-!= break/disp8
9842 $emit-subx-call-operand:register-direct:
9843 (write-buffered *(ebp+8) " %")
9844 (write-buffered *(ebp+8) *(esi+0x10))
9845 e9/jump $emit-subx-call-operand:end/disp32
9846 }
9847
9848 {
9849 81 7/subop/compare *(esi+0xc) 0/imm32
9850 74/jump-if-= break/disp8
9851 $emit-subx-call-operand:stack:
9852 (write-buffered *(ebp+8) Space)
9853 (write-buffered *(ebp+8) "*(ebp+")
9854 (print-int32-buffered *(ebp+8) *(esi+0xc))
9855 (write-buffered *(ebp+8) ")")
9856 e9/jump $emit-subx-call-operand:end/disp32
9857 }
9858
9859 {
9860 8b/-> *(esi+4) 0/r32/eax
9861 81 7/subop/compare *eax 0/imm32
9862 75/jump-if-!= break/disp8
9863 $emit-subx-call-operand:literal:
9864 (write-buffered *(ebp+8) Space)
9865 (write-buffered *(ebp+8) *esi)
9866 }
9867 $emit-subx-call-operand:end:
9868
9869 5e/pop-to-esi
9870 59/pop-to-ecx
9871 58/pop-to-eax
9872
9873 89/<- %esp 5/r32/ebp
9874 5d/pop-to-ebp
9875 c3/return
9876
9877 emit-subx-var-as-rm32:
9878
9879 55/push-ebp
9880 89/<- %ebp 4/r32/esp
9881
9882 50/push-eax
9883 51/push-ecx
9884 56/push-esi
9885
9886 8b/-> *(ebp+0xc) 1/r32/ecx
9887
9888 8b/-> *ecx 6/r32/esi
9889
9890 {
9891 $emit-subx-var-as-rm32:check-for-register-indirect:
9892 81 7/subop/compare *(esi+0x10) 0/imm32
9893 74/jump-if-= break/disp8
9894 81 7/subop/compare *(ecx+8) 0/imm32/false
9895 74/jump-if-= break/disp8
9896 $emit-subx-var-as-rm32:register-indirect:
9897 (write-buffered *(ebp+8) " *")
9898 (write-buffered *(ebp+8) *(esi+0x10))
9899 }
9900
9901 {
9902 $emit-subx-var-as-rm32:check-for-register-direct:
9903 81 7/subop/compare *(esi+0x10) 0/imm32
9904 74/jump-if-= break/disp8
9905 81 7/subop/compare *(ecx+8) 0/imm32/false
9906 75/jump-if-!= break/disp8
9907 $emit-subx-var-as-rm32:register-direct:
9908 (write-buffered *(ebp+8) " %")
9909 (write-buffered *(ebp+8) *(esi+0x10))
9910 }
9911
9912 {
9913 81 7/subop/compare *(esi+0xc) 0/imm32
9914 74/jump-if-= break/disp8
9915 $emit-subx-var-as-rm32:stack:
9916 (write-buffered *(ebp+8) Space)
9917 (write-buffered *(ebp+8) "*(ebp+")
9918 (print-int32-buffered *(ebp+8) *(esi+0xc))
9919 (write-buffered *(ebp+8) ")")
9920 }
9921 $emit-subx-var-as-rm32:end:
9922
9923 5e/pop-to-esi
9924 59/pop-to-ecx
9925 58/pop-to-eax
9926
9927 89/<- %esp 5/r32/ebp
9928 5d/pop-to-ebp
9929 c3/return
9930
9931 find-matching-function:
9932
9933 55/push-ebp
9934 89/<- %ebp 4/r32/esp
9935
9936 51/push-ecx
9937
9938 8b/-> *(ebp+8) 1/r32/ecx
9939 {
9940
9941 81 7/subop/compare %ecx 0/imm32
9942 74/jump-if-= break/disp8
9943
9944 {
9945 (mu-stmt-matches-function? *(ebp+0xc) %ecx)
9946 3d/compare-eax-and 0/imm32/false
9947 74/jump-if-= break/disp8
9948 89/<- %eax 1/r32/ecx
9949 eb/jump $find-matching-function:end/disp8
9950 }
9951
9952 8b/-> *(ecx+0x14) 1/r32/ecx
9953 eb/jump loop/disp8
9954 }
9955
9956 b8/copy-to-eax 0/imm32
9957 $find-matching-function:end:
9958
9959 59/pop-to-ecx
9960
9961 89/<- %esp 5/r32/ebp
9962 5d/pop-to-ebp
9963 c3/return
9964
9965 find-matching-primitive:
9966
9967 55/push-ebp
9968 89/<- %ebp 4/r32/esp
9969
9970 51/push-ecx
9971
9972 8b/-> *(ebp+8) 1/r32/ecx
9973 {
9974 $find-matching-primitive:loop:
9975
9976 81 7/subop/compare %ecx 0/imm32
9977 0f 84/jump-if-= break/disp32
9978
9979
9980
9981
9982
9983
9984
9985 {
9986 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
9987 3d/compare-eax-and 0/imm32/false
9988 74/jump-if-= break/disp8
9989 89/<- %eax 1/r32/ecx
9990 eb/jump $find-matching-primitive:end/disp8
9991 }
9992 $find-matching-primitive:next-primitive:
9993
9994 8b/-> *(ecx+0x24) 1/r32/ecx
9995 e9/jump loop/disp32
9996 }
9997
9998 b8/copy-to-eax 0/imm32
9999 $find-matching-primitive:end:
10000
10001 59/pop-to-ecx
10002
10003 89/<- %esp 5/r32/ebp
10004 5d/pop-to-ebp
10005 c3/return
10006
10007 mu-stmt-matches-function?:
10008
10009 55/push-ebp
10010 89/<- %ebp 4/r32/esp
10011
10012 51/push-ecx
10013
10014 8b/-> *(ebp+8) 1/r32/ecx
10015 8b/-> *(ebp+0xc) 0/r32/eax
10016 (string-equal? *(ecx+4) *eax)
10017 $mu-stmt-matches-function?:end:
10018
10019 59/pop-to-ecx
10020
10021 89/<- %esp 5/r32/ebp
10022 5d/pop-to-ebp
10023 c3/return
10024
10025 mu-stmt-matches-primitive?:
10026
10027
10028
10029
10030
10031
10032 55/push-ebp
10033 89/<- %ebp 4/r32/esp
10034
10035 51/push-ecx
10036 52/push-edx
10037 53/push-ebx
10038 56/push-esi
10039 57/push-edi
10040
10041 8b/-> *(ebp+8) 1/r32/ecx
10042
10043 8b/-> *(ebp+0xc) 2/r32/edx
10044 {
10045 $mu-stmt-matches-primitive?:check-name:
10046
10047 (string-equal? *(ecx+4) *edx)
10048 3d/compare-eax-and 0/imm32/false
10049 75/jump-if-!= break/disp8
10050 b8/copy-to-eax 0/imm32
10051 e9/jump $mu-stmt-matches-primitive?:end/disp32
10052 }
10053 $mu-stmt-matches-primitive?:check-inouts:
10054
10055 8b/-> *(ecx+8) 6/r32/esi
10056 8b/-> *(edx+4) 7/r32/edi
10057 {
10058
10059 {
10060 81 7/subop/compare %esi 0/imm32
10061 75/jump-if-!= break/disp8
10062 $mu-stmt-matches-primitive?:stmt-inout-is-null:
10063 {
10064 81 7/subop/compare %edi 0/imm32
10065 75/jump-if-!= break/disp8
10066
10067 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
10068 }
10069
10070 b8/copy-to-eax 0/imm32/false
10071 e9/jump $mu-stmt-matches-primitive?:end/disp32
10072 }
10073
10074 {
10075 81 7/subop/compare %edi 0/imm32
10076 75/jump-if-!= break/disp8
10077 $mu-stmt-matches-primitive?:prim-inout-is-null:
10078 b8/copy-to-eax 0/imm32/false
10079 e9/jump $mu-stmt-matches-primitive?:end/disp32
10080 }
10081
10082 {
10083 (operand-matches-primitive? %esi *edi)
10084 3d/compare-eax-and 0/imm32/false
10085 75/jump-if-!= break/disp8
10086 b8/copy-to-eax 0/imm32/false
10087 e9/jump $mu-stmt-matches-primitive?:end/disp32
10088 }
10089
10090 8b/-> *(esi+4) 6/r32/esi
10091
10092 8b/-> *(edi+4) 7/r32/edi
10093 eb/jump loop/disp8
10094 }
10095 $mu-stmt-matches-primitive?:check-outputs:
10096
10097 8b/-> *(ecx+0xc) 6/r32/esi
10098 8b/-> *(edx+8) 7/r32/edi
10099 {
10100
10101 {
10102 $mu-stmt-matches-primitive?:check-output:
10103 81 7/subop/compare %esi 0/imm32
10104 75/jump-if-!= break/disp8
10105 {
10106 81 7/subop/compare %edi 0/imm32
10107 75/jump-if-!= break/disp8
10108
10109 b8/copy-to-eax 1/imm32
10110 e9/jump $mu-stmt-matches-primitive?:end/disp32
10111 }
10112
10113 b8/copy-to-eax 0/imm32
10114 e9/jump $mu-stmt-matches-primitive?:end/disp32
10115 }
10116
10117 {
10118 81 7/subop/compare %edi 0/imm32
10119 75/jump-if-!= break/disp8
10120 b8/copy-to-eax 0/imm32
10121 e9/jump $mu-stmt-matches-primitive?:end/disp32
10122 }
10123
10124 {
10125 (operand-matches-primitive? %esi *edi)
10126 3d/compare-eax-and 0/imm32/false
10127 75/jump-if-!= break/disp8
10128 b8/copy-to-eax 0/imm32
10129 e9/jump $mu-stmt-matches-primitive?:end/disp32
10130 }
10131
10132 8b/-> *(esi+4) 6/r32/esi
10133
10134 8b/-> *(edi+4) 7/r32/edi
10135 eb/jump loop/disp8
10136 }
10137 $mu-stmt-matches-primitive?:return-true:
10138 b8/copy-to-eax 1/imm32
10139 $mu-stmt-matches-primitive?:end:
10140
10141 5f/pop-to-edi
10142 5e/pop-to-esi
10143 5b/pop-to-ebx
10144 5a/pop-to-edx
10145 59/pop-to-ecx
10146
10147 89/<- %esp 5/r32/ebp
10148 5d/pop-to-ebp
10149 c3/return
10150
10151 operand-matches-primitive?:
10152
10153 55/push-ebp
10154 89/<- %ebp 4/r32/esp
10155
10156 51/push-ecx
10157 56/push-esi
10158 57/push-edi
10159
10160 8b/-> *(ebp+8) 1/r32/ecx
10161
10162 8b/-> *ecx 6/r32/esi
10163
10164 8b/-> *(ebp+0xc) 7/r32/edi
10165 $operand-matches-primitive?:check-type:
10166
10167 (subx-type-equal? *(esi+4) *(edi+4))
10168 3d/compare-eax-and 0/imm32/false
10169 b8/copy-to-eax 0/imm32/false
10170 0f 84/jump-if-= $operand-matches-primitive?:end/disp32
10171 {
10172 $operand-matches-primitive?:check-register:
10173
10174 {
10175 81 7/subop/compare *(edi+0x10) 0/imm32
10176 0f 85/jump-if-!= break/disp32
10177 81 7/subop/compare *(esi+0x10) 0/imm32
10178 74/jump-if-= break/disp8
10179 81 7/subop/compare *(ecx+8) 0/imm32/false
10180 74/jump-if-= break/disp8
10181 e9/jump $operand-matches-primitive?:return-true/disp32
10182 }
10183
10184 {
10185 81 7/subop/compare *(edi+0x10) 0/imm32
10186 0f 84/jump-if-= break/disp32
10187 81 7/subop/compare *(esi+0x10) 0/imm32
10188 0f 84/jump-if-= break/disp32
10189 81 7/subop/compare *(ecx+8) 0/imm32/false
10190 74/jump-if-= break/disp8
10191 e9/jump $operand-matches-primitive?:return-false/disp32
10192 }
10193
10194 {
10195
10196 8b/-> *(esi+0x10) 0/r32/eax
10197 39/compare *(edi+0x10) 0/r32/eax
10198 74/jump-if-= break/disp8
10199
10200 3d/compare-eax-and 0/imm32
10201 74/jump-if-= $operand-matches-primitive?:end/disp8
10202 81 7/subop/compare *(edi+0x10) 0/imm32
10203 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10204
10205 (string-equal? *(edi+0x10) Any-register)
10206 3d/compare-eax-and 0/imm32/false
10207 75/jump-if-!= break/disp8
10208
10209 (string-equal? *(esi+0x10) *(edi+0x10))
10210 3d/compare-eax-and 0/imm32/false
10211 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10212 }
10213 }
10214 $operand-matches-primitive?:return-true:
10215 b8/copy-to-eax 1/imm32/true
10216 eb/jump $operand-matches-primitive?:end/disp8
10217 $operand-matches-primitive?:return-false:
10218 b8/copy-to-eax 0/imm32/false
10219 $operand-matches-primitive?:end:
10220
10221 5f/pop-to-edi
10222 5e/pop-to-esi
10223 59/pop-to-ecx
10224
10225 89/<- %esp 5/r32/ebp
10226 5d/pop-to-ebp
10227 c3/return
10228
10229 subx-type-equal?:
10230
10231 55/push-ebp
10232 89/<- %ebp 4/r32/esp
10233
10234 51/push-ecx
10235
10236 (is-simple-mu-type? *(ebp+8) 0)
10237 89/<- %ecx 0/r32/eax
10238
10239 (is-simple-mu-type? *(ebp+0xc) 0)
10240
10241 39/compare %eax 1/r32/ecx
10242 0f 94/set-byte-if-= %al
10243 81 4/subop/and %eax 0xff/imm32
10244 $subx-type-equal?:end:
10245
10246 59/pop-to-ecx
10247
10248 89/<- %esp 5/r32/ebp
10249 5d/pop-to-ebp
10250 c3/return
10251
10252 is-simple-mu-type?:
10253
10254 55/push-ebp
10255 89/<- %ebp 4/r32/esp
10256
10257 51/push-ecx
10258
10259 8b/-> *(ebp+0xc) 1/r32/ecx
10260
10261 8b/-> *(ebp+8) 0/r32/eax
10262 39/compare *eax 1/r32/ecx
10263 0f 94/set-byte-if-= %al
10264 81 4/subop/and %eax 0xff/imm32
10265 $is-simple-mu-type?:end:
10266
10267 59/pop-to-ecx
10268
10269 89/<- %esp 5/r32/ebp
10270 5d/pop-to-ebp
10271 c3/return
10272
10273 test-emit-subx-stmt-primitive:
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292 55/push-ebp
10293 89/<- %ebp 4/r32/esp
10294
10295 (clear-stream _test-output-stream)
10296 (clear-stream $_test-output-buffered-file->buffer)
10297
10298 68/push 0/imm32/right/null
10299 68/push 1/imm32/left/int
10300 89/<- %ecx 4/r32/esp
10301
10302 68/push 0/imm32/no-register
10303 68/push -8/imm32/stack-offset
10304 68/push 1/imm32/block-depth
10305 51/push-ecx
10306 68/push "foo"/imm32
10307 89/<- %ecx 4/r32/esp
10308
10309 68/push 0/imm32/is-deref:false
10310 68/push 0/imm32/next
10311 51/push-ecx/var-foo
10312 89/<- %ebx 4/r32/esp
10313
10314 68/push 0/imm32/next
10315 68/push 0/imm32/outputs
10316 53/push-ebx/operands
10317 68/push "increment"/imm32/operation
10318 68/push 1/imm32
10319 89/<- %esi 4/r32/esp
10320
10321 68/push 0/imm32/next
10322 68/push 0/imm32/output-is-write-only
10323 68/push 0/imm32/no-disp32
10324 68/push 0/imm32/no-imm32
10325 68/push 0/imm32/no-r32
10326 68/push 1/imm32/rm32-is-first-inout
10327 68/push "ff 0/subop/increment"/imm32/subx-name
10328 68/push 0/imm32/outputs
10329 53/push-ebx/inouts
10330 68/push "increment"/imm32/name
10331 89/<- %ebx 4/r32/esp
10332
10333 c7 0/subop/copy *Curr-block-depth 0/imm32
10334 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10335 (flush _test-output-buffered-file)
10336 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10342
10343 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive")
10344
10345 89/<- %esp 5/r32/ebp
10346 5d/pop-to-ebp
10347 c3/return
10348
10349 test-emit-subx-stmt-primitive-register:
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368 55/push-ebp
10369 89/<- %ebp 4/r32/esp
10370
10371 (clear-stream _test-output-stream)
10372 (clear-stream $_test-output-buffered-file->buffer)
10373
10374 68/push 0/imm32/right/null
10375 68/push 1/imm32/left/int
10376 89/<- %ecx 4/r32/esp
10377
10378 68/push "eax"/imm32/register
10379 68/push 0/imm32/no-stack-offset
10380 68/push 1/imm32/block-depth
10381 51/push-ecx
10382 68/push "foo"/imm32
10383 89/<- %ecx 4/r32/esp
10384
10385 68/push 0/imm32/is-deref:false
10386 68/push 0/imm32/next
10387 51/push-ecx/var-foo
10388 89/<- %ebx 4/r32/esp
10389
10390 68/push 0/imm32/next
10391 53/push-ebx/outputs
10392 68/push 0/imm32/inouts
10393 68/push "increment"/imm32/operation
10394 68/push 1/imm32
10395 89/<- %esi 4/r32/esp
10396
10397 68/push Any-register/imm32
10398 68/push 0/imm32/no-stack-offset
10399 68/push 1/imm32/block-depth
10400 ff 6/subop/push *(ecx+4)
10401 68/push "dummy"/imm32
10402 89/<- %ebx 4/r32/esp
10403
10404 68/push 0/imm32/is-deref:false
10405 68/push 0/imm32/next
10406 53/push-ebx/formal-var
10407 89/<- %ebx 4/r32/esp
10408
10409 68/push 0/imm32/next
10410 68/push 0/imm32/output-is-write-only
10411 68/push 0/imm32/no-disp32
10412 68/push 0/imm32/no-imm32
10413 68/push 0/imm32/no-r32
10414 68/push 3/imm32/rm32-in-first-output
10415 68/push "ff 0/subop/increment"/imm32/subx-name
10416 53/push-ebx/outputs
10417 68/push 0/imm32/inouts
10418 68/push "increment"/imm32/name
10419 89/<- %ebx 4/r32/esp
10420
10421 c7 0/subop/copy *Curr-block-depth 0/imm32
10422 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10423 (flush _test-output-buffered-file)
10424 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10430
10431 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register")
10432
10433 89/<- %esp 5/r32/ebp
10434 5d/pop-to-ebp
10435 c3/return
10436
10437 test-emit-subx-stmt-select-primitive:
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459 55/push-ebp
10460 89/<- %ebp 4/r32/esp
10461
10462 (clear-stream _test-output-stream)
10463 (clear-stream $_test-output-buffered-file->buffer)
10464
10465 68/push 0/imm32/right/null
10466 68/push 1/imm32/left/int
10467 89/<- %ecx 4/r32/esp
10468
10469 68/push "eax"/imm32/register
10470 68/push 0/imm32/no-stack-offset
10471 68/push 1/imm32/block-depth
10472 51/push-ecx
10473 68/push "foo"/imm32
10474 89/<- %ecx 4/r32/esp
10475
10476 68/push 0/imm32/is-deref:false
10477 68/push 0/imm32/next
10478 51/push-ecx/var-foo
10479 89/<- %edi 4/r32/esp
10480
10481 68/push 0/imm32/next
10482 57/push-edi/outputs
10483 68/push 0/imm32/inouts
10484 68/push "increment"/imm32/operation
10485 68/push 1/imm32
10486 89/<- %esi 4/r32/esp
10487
10488 68/push Any-register/imm32
10489 68/push 0/imm32/no-stack-offset
10490 68/push 1/imm32/block-depth
10491 ff 6/subop/push *(ecx+4)
10492 68/push "dummy"/imm32
10493 89/<- %ebx 4/r32/esp
10494
10495 68/push 0/imm32/is-deref:false
10496 68/push 0/imm32/next
10497 53/push-ebx/formal-var
10498 89/<- %ebx 4/r32/esp
10499
10500 68/push 0/imm32/next
10501 68/push 0/imm32/output-is-write-only
10502 68/push 0/imm32/no-disp32
10503 68/push 0/imm32/no-imm32
10504 68/push 0/imm32/no-r32
10505 68/push 3/imm32/rm32-in-first-output
10506 68/push "ff 0/subop/increment"/imm32/subx-name
10507 53/push-ebx/outputs/formal-outputs
10508 68/push 0/imm32/inouts
10509 68/push "increment"/imm32/name
10510 89/<- %ebx 4/r32/esp
10511
10512 53/push-ebx/next
10513 68/push 0/imm32/output-is-write-only
10514 68/push 0/imm32/no-disp32
10515 68/push 0/imm32/no-imm32
10516 68/push 0/imm32/no-r32
10517 68/push 1/imm32/rm32-is-first-inout
10518 68/push "ff 0/subop/increment"/imm32/subx-name
10519 68/push 0/imm32/outputs
10520 57/push-edi/inouts/real-outputs
10521 68/push "increment"/imm32/name
10522 89/<- %ebx 4/r32/esp
10523
10524 c7 0/subop/copy *Curr-block-depth 0/imm32
10525 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10526 (flush _test-output-buffered-file)
10527 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10533
10534 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive")
10535
10536 89/<- %esp 5/r32/ebp
10537 5d/pop-to-ebp
10538 c3/return
10539
10540 test-emit-subx-stmt-select-primitive-2:
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562 55/push-ebp
10563 89/<- %ebp 4/r32/esp
10564
10565 (clear-stream _test-output-stream)
10566 (clear-stream $_test-output-buffered-file->buffer)
10567
10568 68/push 0/imm32/right/null
10569 68/push 1/imm32/left/int
10570 89/<- %ecx 4/r32/esp
10571
10572 68/push "eax"/imm32/register
10573 68/push 0/imm32/no-stack-offset
10574 68/push 1/imm32/block-depth
10575 51/push-ecx
10576 68/push "foo"/imm32
10577 89/<- %ecx 4/r32/esp
10578
10579 68/push 0/imm32/is-deref:false
10580 68/push 0/imm32/next
10581 51/push-ecx/var-foo
10582 89/<- %edi 4/r32/esp
10583
10584 68/push 0/imm32/next
10585 68/push 0/imm32/outputs
10586 57/push-edi/inouts
10587 68/push "increment"/imm32/operation
10588 68/push 1/imm32
10589 89/<- %esi 4/r32/esp
10590
10591 68/push Any-register/imm32
10592 68/push 0/imm32/no-stack-offset
10593 68/push 1/imm32/block-depth
10594 ff 6/subop/push *(ecx+4)
10595 68/push "dummy"/imm32
10596 89/<- %ebx 4/r32/esp
10597
10598 68/push 0/imm32/is-deref:false
10599 68/push 0/imm32/next
10600 53/push-ebx/formal-var
10601 89/<- %ebx 4/r32/esp
10602
10603 68/push 0/imm32/next
10604 68/push 0/imm32/output-is-write-only
10605 68/push 0/imm32/no-disp32
10606 68/push 0/imm32/no-imm32
10607 68/push 0/imm32/no-r32
10608 68/push 3/imm32/rm32-in-first-output
10609 68/push "ff 0/subop/increment"/imm32/subx-name
10610 53/push-ebx/outputs/formal-outputs
10611 68/push 0/imm32/inouts
10612 68/push "increment"/imm32/name
10613 89/<- %ebx 4/r32/esp
10614
10615 53/push-ebx/next
10616 68/push 0/imm32/output-is-write-only
10617 68/push 0/imm32/no-disp32
10618 68/push 0/imm32/no-imm32
10619 68/push 0/imm32/no-r32
10620 68/push 1/imm32/rm32-is-first-inout
10621 68/push "ff 0/subop/increment"/imm32/subx-name
10622 68/push 0/imm32/outputs
10623 57/push-edi/inouts/real-outputs
10624 68/push "increment"/imm32/name
10625 89/<- %ebx 4/r32/esp
10626
10627 c7 0/subop/copy *Curr-block-depth 0/imm32
10628 (emit-subx-stmt _test-output-buffered-file %esi %ebx 0)
10629 (flush _test-output-buffered-file)
10630 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10636
10637 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2")
10638
10639 89/<- %esp 5/r32/ebp
10640 5d/pop-to-ebp
10641 c3/return
10642
10643 test-increment-register:
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659 55/push-ebp
10660 89/<- %ebp 4/r32/esp
10661
10662 (clear-stream _test-output-stream)
10663 (clear-stream $_test-output-buffered-file->buffer)
10664
10665 68/push 0/imm32/right/null
10666 68/push 1/imm32/left/int
10667 89/<- %ecx 4/r32/esp
10668
10669 68/push "eax"/imm32/register
10670 68/push 0/imm32/no-stack-offset
10671 68/push 1/imm32/block-depth
10672 51/push-ecx
10673 68/push "foo"/imm32
10674 89/<- %ecx 4/r32/esp
10675
10676 68/push 0/imm32/is-deref:false
10677 68/push 0/imm32/next
10678 51/push-ecx/var-foo
10679 89/<- %edi 4/r32/esp
10680
10681 68/push 0/imm32/next
10682 57/push-edi/outputs
10683 68/push 0/imm32/inouts
10684 68/push "increment"/imm32/operation
10685 68/push 1/imm32/regular-stmt
10686 89/<- %esi 4/r32/esp
10687
10688 c7 0/subop/copy *Curr-block-depth 0/imm32
10689 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10690 (flush _test-output-buffered-file)
10691 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10697
10698 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
10699
10700 89/<- %esp 5/r32/ebp
10701 5d/pop-to-ebp
10702 c3/return
10703
10704 test-increment-var:
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720 55/push-ebp
10721 89/<- %ebp 4/r32/esp
10722
10723 (clear-stream _test-output-stream)
10724 (clear-stream $_test-output-buffered-file->buffer)
10725
10726 68/push 0/imm32/right/null
10727 68/push 1/imm32/left/int
10728 89/<- %ecx 4/r32/esp
10729
10730 68/push "eax"/imm32/register
10731 68/push 0/imm32/no-stack-offset
10732 68/push 1/imm32/block-depth
10733 51/push-ecx
10734 68/push "foo"/imm32
10735 89/<- %ecx 4/r32/esp
10736
10737 68/push 0/imm32/is-deref:false
10738 68/push 0/imm32/next
10739 51/push-ecx/var-foo
10740 89/<- %edi 4/r32/esp
10741
10742 68/push 0/imm32/next
10743 57/push-edi/outputs
10744 68/push 0/imm32/inouts
10745 68/push "increment"/imm32/operation
10746 68/push 1/imm32
10747 89/<- %esi 4/r32/esp
10748
10749 c7 0/subop/copy *Curr-block-depth 0/imm32
10750 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10751 (flush _test-output-buffered-file)
10752 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10758
10759 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var")
10760
10761 89/<- %esp 5/r32/ebp
10762 5d/pop-to-ebp
10763 c3/return
10764
10765 test-add-reg-to-reg:
10766
10767
10768
10769
10770
10771 55/push-ebp
10772 89/<- %ebp 4/r32/esp
10773
10774 (clear-stream _test-output-stream)
10775 (clear-stream $_test-output-buffered-file->buffer)
10776
10777 68/push 0/imm32/right/null
10778 68/push 1/imm32/left/int
10779 89/<- %ecx 4/r32/esp
10780
10781 68/push "eax"/imm32/register
10782 68/push 0/imm32/no-stack-offset
10783 68/push 1/imm32/block-depth
10784 51/push-ecx
10785 68/push "var1"/imm32
10786 89/<- %ecx 4/r32/esp
10787
10788 68/push "ecx"/imm32/register
10789 68/push 0/imm32/no-stack-offset
10790 68/push 1/imm32/block-depth
10791 ff 6/subop/push *(ecx+4)
10792 68/push "var2"/imm32
10793 89/<- %edx 4/r32/esp
10794
10795 68/push 0/imm32/is-deref:false
10796 68/push 0/imm32/next
10797 52/push-edx/var-var2
10798 89/<- %esi 4/r32/esp
10799
10800 68/push 0/imm32/is-deref:false
10801 68/push 0/imm32/next
10802 51/push-ecx/var-var1
10803 89/<- %edi 4/r32/esp
10804
10805 68/push 0/imm32/next
10806 57/push-edi/outputs
10807 56/push-esi/inouts
10808 68/push "add"/imm32/operation
10809 68/push 1/imm32
10810 89/<- %esi 4/r32/esp
10811
10812 c7 0/subop/copy *Curr-block-depth 0/imm32
10813 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10814 (flush _test-output-buffered-file)
10815 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10821
10822 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
10823
10824 89/<- %esp 5/r32/ebp
10825 5d/pop-to-ebp
10826 c3/return
10827
10828 test-add-reg-to-mem:
10829
10830
10831
10832
10833
10834 55/push-ebp
10835 89/<- %ebp 4/r32/esp
10836
10837 (clear-stream _test-output-stream)
10838 (clear-stream $_test-output-buffered-file->buffer)
10839
10840 68/push 0/imm32/right/null
10841 68/push 1/imm32/left/int
10842 89/<- %ecx 4/r32/esp
10843
10844 68/push 0/imm32/no-register
10845 68/push 8/imm32/stack-offset
10846 68/push 1/imm32/block-depth
10847 51/push-ecx
10848 68/push "var1"/imm32
10849 89/<- %ecx 4/r32/esp
10850
10851 68/push "ecx"/imm32/register
10852 68/push 0/imm32/no-stack-offset
10853 68/push 1/imm32/block-depth
10854 ff 6/subop/push *(ecx+4)
10855 68/push "var2"/imm32
10856 89/<- %edx 4/r32/esp
10857
10858 68/push 0/imm32/is-deref:false
10859 68/push 0/imm32/next
10860 52/push-edx/var-var2
10861 89/<- %esi 4/r32/esp
10862
10863 56/push-esi/next
10864 51/push-ecx/var-var1
10865 89/<- %esi 4/r32/esp
10866
10867 68/push 0/imm32/next
10868 68/push 0/imm32/outputs
10869 56/push-esi/inouts
10870 68/push "add-to"/imm32/operation
10871 68/push 1/imm32
10872 89/<- %esi 4/r32/esp
10873
10874 c7 0/subop/copy *Curr-block-depth 0/imm32
10875 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10876 (flush _test-output-buffered-file)
10877 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10883
10884 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
10885
10886 89/<- %esp 5/r32/ebp
10887 5d/pop-to-ebp
10888 c3/return
10889
10890 test-add-mem-to-reg:
10891
10892
10893
10894
10895
10896 55/push-ebp
10897 89/<- %ebp 4/r32/esp
10898
10899 (clear-stream _test-output-stream)
10900 (clear-stream $_test-output-buffered-file->buffer)
10901
10902 68/push 0/imm32/right/null
10903 68/push 1/imm32/left/int
10904 89/<- %ecx 4/r32/esp
10905
10906 68/push "eax"/imm32/register
10907 68/push 0/imm32/no-stack-offset
10908 68/push 1/imm32/block-depth
10909 51/push-ecx
10910 68/push "var1"/imm32
10911 89/<- %ecx 4/r32/esp
10912
10913 68/push 0/imm32/no-register
10914 68/push 8/imm32/stack-offset
10915 68/push 1/imm32/block-depth
10916 ff 6/subop/push *(ecx+4)
10917 68/push "var2"/imm32
10918 89/<- %edx 4/r32/esp
10919
10920 68/push 0/imm32/is-deref:false
10921 68/push 0/imm32/next
10922 52/push-edx/var-var2
10923 89/<- %esi 4/r32/esp
10924
10925 68/push 0/imm32/is-deref:false
10926 68/push 0/imm32/next
10927 51/push-ecx/var-var1
10928 89/<- %edi 4/r32/esp
10929
10930 68/push 0/imm32/next
10931 57/push-edi/outputs
10932 56/push-esi/inouts
10933 68/push "add"/imm32/operation
10934 68/push 1/imm32
10935 89/<- %esi 4/r32/esp
10936
10937 c7 0/subop/copy *Curr-block-depth 0/imm32
10938 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
10939 (flush _test-output-buffered-file)
10940 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
10946
10947 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
10948
10949 89/<- %esp 5/r32/ebp
10950 5d/pop-to-ebp
10951 c3/return
10952
10953 test-add-literal-to-eax:
10954
10955
10956
10957
10958
10959 55/push-ebp
10960 89/<- %ebp 4/r32/esp
10961
10962 (clear-stream _test-output-stream)
10963 (clear-stream $_test-output-buffered-file->buffer)
10964
10965 68/push 0/imm32/right/null
10966 68/push 1/imm32/left/int
10967 89/<- %ecx 4/r32/esp
10968
10969 68/push "eax"/imm32/register
10970 68/push 0/imm32/no-stack-offset
10971 68/push 1/imm32/block-depth
10972 51/push-ecx
10973 68/push "var1"/imm32
10974 89/<- %ecx 4/r32/esp
10975
10976 68/push 0/imm32/right/null
10977 68/push 0/imm32/left/literal
10978 89/<- %edx 4/r32/esp
10979
10980 68/push 0/imm32/no-register
10981 68/push 0/imm32/no-stack-offset
10982 68/push 1/imm32/block-depth
10983 52/push-edx
10984 68/push "0x34"/imm32
10985 89/<- %edx 4/r32/esp
10986
10987 68/push 0/imm32/is-deref:false
10988 68/push 0/imm32/next
10989 52/push-edx/var-var2
10990 89/<- %esi 4/r32/esp
10991
10992 68/push 0/imm32/is-deref:false
10993 68/push 0/imm32/next
10994 51/push-ecx/var-var1
10995 89/<- %edi 4/r32/esp
10996
10997 68/push 0/imm32/next
10998 57/push-edi/outputs
10999 56/push-esi/inouts
11000 68/push "add"/imm32/operation
11001 68/push 1/imm32
11002 89/<- %esi 4/r32/esp
11003
11004 c7 0/subop/copy *Curr-block-depth 0/imm32
11005 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11006 (flush _test-output-buffered-file)
11007 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11013
11014 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
11015
11016 89/<- %esp 5/r32/ebp
11017 5d/pop-to-ebp
11018 c3/return
11019
11020 test-add-literal-to-reg:
11021
11022
11023
11024
11025
11026 55/push-ebp
11027 89/<- %ebp 4/r32/esp
11028
11029 (clear-stream _test-output-stream)
11030 (clear-stream $_test-output-buffered-file->buffer)
11031
11032 68/push 0/imm32/right/null
11033 68/push 1/imm32/left/int
11034 89/<- %ecx 4/r32/esp
11035
11036 68/push "ecx"/imm32/register
11037 68/push 0/imm32/no-stack-offset
11038 68/push 1/imm32/block-depth
11039 51/push-ecx
11040 68/push "var1"/imm32
11041 89/<- %ecx 4/r32/esp
11042
11043 68/push 0/imm32/right/null
11044 68/push 0/imm32/left/literal
11045 89/<- %edx 4/r32/esp
11046
11047 68/push 0/imm32/no-register
11048 68/push 0/imm32/no-stack-offset
11049 68/push 1/imm32/block-depth
11050 52/push-edx
11051 68/push "0x34"/imm32
11052 89/<- %edx 4/r32/esp
11053
11054 68/push 0/imm32/is-deref:false
11055 68/push 0/imm32/next
11056 52/push-edx/var-var2
11057 89/<- %esi 4/r32/esp
11058
11059 68/push 0/imm32/is-deref:false
11060 68/push 0/imm32/next
11061 51/push-ecx/var-var1
11062 89/<- %edi 4/r32/esp
11063
11064 68/push 0/imm32/next
11065 57/push-edi/outputs
11066 56/push-esi/inouts
11067 68/push "add"/imm32/operation
11068 68/push 1/imm32
11069 89/<- %esi 4/r32/esp
11070
11071 c7 0/subop/copy *Curr-block-depth 0/imm32
11072 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11073 (flush _test-output-buffered-file)
11074 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11080
11081 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
11082
11083 89/<- %esp 5/r32/ebp
11084 5d/pop-to-ebp
11085 c3/return
11086
11087 test-add-literal-to-mem:
11088
11089
11090
11091
11092
11093 55/push-ebp
11094 89/<- %ebp 4/r32/esp
11095
11096 (clear-stream _test-output-stream)
11097 (clear-stream $_test-output-buffered-file->buffer)
11098
11099 68/push 0/imm32/right/null
11100 68/push 1/imm32/left/int
11101 89/<- %ecx 4/r32/esp
11102
11103 68/push 0/imm32/no-register
11104 68/push 8/imm32/stack-offset
11105 68/push 1/imm32/block-depth
11106 51/push-ecx
11107 68/push "var1"/imm32
11108 89/<- %ecx 4/r32/esp
11109
11110 68/push 0/imm32/right/null
11111 68/push 0/imm32/left/literal
11112 89/<- %edx 4/r32/esp
11113
11114 68/push 0/imm32/no-register
11115 68/push 0/imm32/no-stack-offset
11116 68/push 1/imm32/block-depth
11117 52/push-edx
11118 68/push "0x34"/imm32
11119 89/<- %edx 4/r32/esp
11120
11121 68/push 0/imm32/is-deref:false
11122 68/push 0/imm32/next
11123 52/push-edx/var-var2
11124 89/<- %esi 4/r32/esp
11125
11126 68/push 0/imm32/is-deref:false
11127 56/push-esi/next
11128 51/push-ecx/var-var1
11129 89/<- %esi 4/r32/esp
11130
11131 68/push 0/imm32/next
11132 68/push 0/imm32/outputs
11133 56/push-esi/inouts
11134 68/push "add-to"/imm32/operation
11135 68/push 1/imm32
11136 89/<- %esi 4/r32/esp
11137
11138 c7 0/subop/copy *Curr-block-depth 0/imm32
11139 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11140 (flush _test-output-buffered-file)
11141 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11147
11148 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
11149
11150 89/<- %esp 5/r32/ebp
11151 5d/pop-to-ebp
11152 c3/return
11153
11154 test-compare-mem-with-reg:
11155
11156
11157
11158
11159
11160 55/push-ebp
11161 89/<- %ebp 4/r32/esp
11162
11163 (clear-stream _test-output-stream)
11164 (clear-stream $_test-output-buffered-file->buffer)
11165
11166 68/push 0/imm32/right/null
11167 68/push 1/imm32/left/int
11168 89/<- %ecx 4/r32/esp
11169
11170 68/push "eax"/imm32/register
11171 68/push 0/imm32/no-stack-offset
11172 68/push 1/imm32/block-depth
11173 51/push-ecx
11174 68/push "var2"/imm32
11175 89/<- %ecx 4/r32/esp
11176
11177 68/push 0/imm32/no-register
11178 68/push 8/imm32/stack-offset
11179 68/push 1/imm32/block-depth
11180 ff 6/subop/push *(ecx+4)
11181 68/push "var1"/imm32
11182 89/<- %edx 4/r32/esp
11183
11184 68/push 0/imm32/is-deref:false
11185 68/push 0/imm32/next
11186 51/push-ecx/var-var2
11187 89/<- %esi 4/r32/esp
11188
11189 68/push 0/imm32/is-deref:false
11190 56/push-esi
11191 52/push-edx/var-var1
11192 89/<- %esi 4/r32/esp
11193
11194 68/push 0/imm32/next
11195 68/push 0/imm32/outputs
11196 56/push-esi/inouts
11197 68/push "compare"/imm32/operation
11198 68/push 1/imm32
11199 89/<- %esi 4/r32/esp
11200
11201 c7 0/subop/copy *Curr-block-depth 0/imm32
11202 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11203 (flush _test-output-buffered-file)
11204 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11210
11211 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg")
11212
11213 89/<- %esp 5/r32/ebp
11214 5d/pop-to-ebp
11215 c3/return
11216
11217 test-compare-reg-with-mem:
11218
11219
11220
11221
11222
11223 55/push-ebp
11224 89/<- %ebp 4/r32/esp
11225
11226 (clear-stream _test-output-stream)
11227 (clear-stream $_test-output-buffered-file->buffer)
11228
11229 68/push 0/imm32/right/null
11230 68/push 1/imm32/left/int
11231 89/<- %ecx 4/r32/esp
11232
11233 68/push "eax"/imm32/register
11234 68/push 0/imm32/no-stack-offset
11235 68/push 1/imm32/block-depth
11236 51/push-ecx
11237 68/push "var1"/imm32
11238 89/<- %ecx 4/r32/esp
11239
11240 68/push 0/imm32/no-register
11241 68/push 8/imm32/stack-offset
11242 68/push 1/imm32/block-depth
11243 ff 6/subop/push *(ecx+4)
11244 68/push "var2"/imm32
11245 89/<- %edx 4/r32/esp
11246
11247 68/push 0/imm32/is-deref:false
11248 68/push 0/imm32/next
11249 52/push-edx/var-var2
11250 89/<- %esi 4/r32/esp
11251
11252 68/push 0/imm32/is-deref:false
11253 56/push-esi
11254 51/push-ecx/var-var1
11255 89/<- %esi 4/r32/esp
11256
11257 68/push 0/imm32/next
11258 68/push 0/imm32/outputs
11259 56/push-esi/inouts
11260 68/push "compare"/imm32/operation
11261 68/push 1/imm32
11262 89/<- %esi 4/r32/esp
11263
11264 c7 0/subop/copy *Curr-block-depth 0/imm32
11265 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11266 (flush _test-output-buffered-file)
11267 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11273
11274 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem")
11275
11276 89/<- %esp 5/r32/ebp
11277 5d/pop-to-ebp
11278 c3/return
11279
11280 test-compare-mem-with-literal:
11281
11282
11283
11284
11285
11286 55/push-ebp
11287 89/<- %ebp 4/r32/esp
11288
11289 (clear-stream _test-output-stream)
11290 (clear-stream $_test-output-buffered-file->buffer)
11291
11292 68/push 0/imm32/right/null
11293 68/push 1/imm32/left/int
11294 89/<- %ecx 4/r32/esp
11295
11296 68/push 0/imm32/no-register
11297 68/push 8/imm32/stack-offset
11298 68/push 1/imm32/block-depth
11299 51/push-ecx
11300 68/push "var1"/imm32
11301 89/<- %ecx 4/r32/esp
11302
11303 68/push 0/imm32/right/null
11304 68/push 0/imm32/left/literal
11305 89/<- %edx 4/r32/esp
11306
11307 68/push 0/imm32/no-register
11308 68/push 0/imm32/no-stack-offset
11309 68/push 1/imm32/block-depth
11310 52/push-edx
11311 68/push "0x34"/imm32
11312 89/<- %edx 4/r32/esp
11313
11314 68/push 0/imm32/is-deref:false
11315 68/push 0/imm32/next
11316 52/push-edx/var-var2
11317 89/<- %esi 4/r32/esp
11318
11319 68/push 0/imm32/is-deref:false
11320 56/push-esi/next
11321 51/push-ecx/var-var1
11322 89/<- %esi 4/r32/esp
11323
11324 68/push 0/imm32/next
11325 68/push 0/imm32/outputs
11326 56/push-esi/inouts
11327 68/push "compare"/imm32/operation
11328 68/push 1/imm32
11329 89/<- %esi 4/r32/esp
11330
11331 c7 0/subop/copy *Curr-block-depth 0/imm32
11332 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11333 (flush _test-output-buffered-file)
11334 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11340
11341 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal")
11342
11343 89/<- %esp 5/r32/ebp
11344 5d/pop-to-ebp
11345 c3/return
11346
11347 test-compare-eax-with-literal:
11348
11349
11350
11351
11352
11353 55/push-ebp
11354 89/<- %ebp 4/r32/esp
11355
11356 (clear-stream _test-output-stream)
11357 (clear-stream $_test-output-buffered-file->buffer)
11358
11359 68/push 0/imm32/right/null
11360 68/push 1/imm32/left/int
11361 89/<- %ecx 4/r32/esp
11362
11363 68/push "eax"/imm32/register
11364 68/push 0/imm32/no-stack-offset
11365 68/push 1/imm32/block-depth
11366 51/push-ecx
11367 68/push "var1"/imm32
11368 89/<- %ecx 4/r32/esp
11369
11370 68/push 0/imm32/right/null
11371 68/push 0/imm32/left/literal
11372 89/<- %edx 4/r32/esp
11373
11374 68/push 0/imm32/no-register
11375 68/push 0/imm32/no-stack-offset
11376 68/push 1/imm32/block-depth
11377 52/push-edx
11378 68/push "0x34"/imm32
11379 89/<- %edx 4/r32/esp
11380
11381 68/push 0/imm32/is-deref:false
11382 68/push 0/imm32/next
11383 52/push-edx/var-var2
11384 89/<- %esi 4/r32/esp
11385
11386 68/push 0/imm32/is-deref:false
11387 56/push-esi/next
11388 51/push-ecx/var-var1
11389 89/<- %esi 4/r32/esp
11390
11391 68/push 0/imm32/next
11392 68/push 0/imm32/outputs
11393 56/push-esi/inouts
11394 68/push "compare"/imm32/operation
11395 68/push 1/imm32/regular-stmt
11396 89/<- %esi 4/r32/esp
11397
11398 c7 0/subop/copy *Curr-block-depth 0/imm32
11399 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11400 (flush _test-output-buffered-file)
11401 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11407
11408 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal")
11409
11410 89/<- %esp 5/r32/ebp
11411 5d/pop-to-ebp
11412 c3/return
11413
11414 test-compare-reg-with-literal:
11415
11416
11417
11418
11419
11420 55/push-ebp
11421 89/<- %ebp 4/r32/esp
11422
11423 (clear-stream _test-output-stream)
11424 (clear-stream $_test-output-buffered-file->buffer)
11425
11426 68/push 0/imm32/right/null
11427 68/push 1/imm32/left/int
11428 89/<- %ecx 4/r32/esp
11429
11430 68/push "ecx"/imm32/register
11431 68/push 0/imm32/no-stack-offset
11432 68/push 1/imm32/block-depth
11433 51/push-ecx
11434 68/push "var1"/imm32
11435 89/<- %ecx 4/r32/esp
11436
11437 68/push 0/imm32/right/null
11438 68/push 0/imm32/left/literal
11439 89/<- %edx 4/r32/esp
11440
11441 68/push 0/imm32/no-register
11442 68/push 0/imm32/no-stack-offset
11443 68/push 1/imm32/block-depth
11444 52/push-edx
11445 68/push "0x34"/imm32
11446 89/<- %edx 4/r32/esp
11447
11448 68/push 0/imm32/is-deref:false
11449 68/push 0/imm32/next
11450 52/push-edx/var-var2
11451 89/<- %esi 4/r32/esp
11452
11453 68/push 0/imm32/is-deref:false
11454 56/push-esi/next
11455 51/push-ecx/var-var1
11456 89/<- %esi 4/r32/esp
11457
11458 68/push 0/imm32/next
11459 68/push 0/imm32/outputs
11460 56/push-esi/inouts
11461 68/push "compare"/imm32/operation
11462 68/push 1/imm32/regular-stmt
11463 89/<- %esi 4/r32/esp
11464
11465 c7 0/subop/copy *Curr-block-depth 0/imm32
11466 (emit-subx-stmt _test-output-buffered-file %esi Primitives 0)
11467 (flush _test-output-buffered-file)
11468 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11474
11475 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal")
11476
11477 89/<- %esp 5/r32/ebp
11478 5d/pop-to-ebp
11479 c3/return
11480
11481 test-emit-subx-stmt-function-call:
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502 55/push-ebp
11503 89/<- %ebp 4/r32/esp
11504
11505 (clear-stream _test-output-stream)
11506 (clear-stream $_test-output-buffered-file->buffer)
11507
11508 68/push 0/imm32/right/null
11509 68/push 1/imm32/left/int
11510 89/<- %ecx 4/r32/esp
11511
11512 68/push 0/imm32/no-register
11513 68/push -8/imm32/stack-offset
11514 68/push 0/imm32/block-depth
11515 51/push-ecx
11516 68/push "foo"/imm32
11517 89/<- %ecx 4/r32/esp
11518
11519 68/push 0/imm32/is-deref:false
11520 68/push 0/imm32/next
11521 51/push-ecx/var-foo
11522 89/<- %esi 4/r32/esp
11523
11524 68/push 0/imm32/next
11525 68/push 0/imm32/outputs
11526 56/push-esi/inouts
11527 68/push "f"/imm32/operation
11528 68/push 1/imm32
11529 89/<- %esi 4/r32/esp
11530
11531 68/push 0/imm32/next
11532 68/push 0/imm32/body
11533 68/push 0/imm32/outputs
11534 51/push-ecx/inouts
11535 68/push "f2"/imm32/subx-name
11536 68/push "f"/imm32/name
11537 89/<- %ebx 4/r32/esp
11538
11539 c7 0/subop/copy *Curr-block-depth 0/imm32
11540 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
11541 (flush _test-output-buffered-file)
11542 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11548
11549 (check-next-stream-line-equal _test-output-stream "(f2 *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call")
11550
11551 89/<- %esp 5/r32/ebp
11552 5d/pop-to-ebp
11553 c3/return
11554
11555 test-emit-subx-stmt-function-call-with-literal-arg:
11556
11557
11558
11559
11560
11561
11562 55/push-ebp
11563 89/<- %ebp 4/r32/esp
11564
11565 (clear-stream _test-output-stream)
11566 (clear-stream $_test-output-buffered-file->buffer)
11567
11568 68/push 0/imm32/right/null
11569 68/push 0/imm32/left/literal
11570 89/<- %ecx 4/r32/esp
11571
11572 68/push 0/imm32/no-register
11573 68/push 0/imm32/no-stack-offset
11574 68/push 0/imm32/block-depth
11575 51/push-ecx
11576 68/push "34"/imm32
11577 89/<- %ecx 4/r32/esp
11578
11579 68/push 0/imm32/is-deref:false
11580 68/push 0/imm32/next
11581 51/push-ecx/var-foo
11582 89/<- %esi 4/r32/esp
11583
11584 68/push 0/imm32/next
11585 68/push 0/imm32/outputs
11586 56/push-esi/inouts
11587 68/push "f"/imm32/operation
11588 68/push 1/imm32
11589 89/<- %esi 4/r32/esp
11590
11591 68/push 0/imm32/next
11592 68/push 0/imm32/body
11593 68/push 0/imm32/outputs
11594 51/push-ecx/inouts
11595 68/push "f2"/imm32/subx-name
11596 68/push "f"/imm32/name
11597 89/<- %ebx 4/r32/esp
11598
11599 c7 0/subop/copy *Curr-block-depth 0/imm32
11600 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
11601 (flush _test-output-buffered-file)
11602 +-- 6 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
11608
11609 (check-next-stream-line-equal _test-output-stream "(f2 34)" "F - test-emit-subx-stmt-function-call-with-literal-arg")
11610
11611 89/<- %esp 5/r32/ebp
11612 5d/pop-to-ebp
11613 c3/return
11614
11615 emit-indent:
11616
11617 55/push-ebp
11618 89/<- %ebp 4/r32/esp
11619
11620 50/push-eax
11621
11622 8b/-> *(ebp+0xc) 0/r32/eax
11623 {
11624
11625 3d/compare-eax-with 0/imm32
11626 7e/jump-if-<= break/disp8
11627 (write-buffered *(ebp+8) " ")
11628 48/decrement-eax
11629 eb/jump loop/disp8
11630 }
11631 $emit-indent:end:
11632
11633 58/pop-to-eax
11634
11635 89/<- %esp 5/r32/ebp
11636 5d/pop-to-ebp
11637 c3/return
11638
11639 emit-subx-prologue:
11640
11641 55/push-ebp
11642 89/<- %ebp 4/r32/esp
11643
11644 (write-buffered *(ebp+8) " # . prologue\n")
11645 (write-buffered *(ebp+8) " 55/push-ebp\n")
11646 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n")
11647 $emit-subx-prologue:end:
11648
11649 89/<- %esp 5/r32/ebp
11650 5d/pop-to-ebp
11651 c3/return
11652
11653 emit-subx-epilogue:
11654
11655 55/push-ebp
11656 89/<- %ebp 4/r32/esp
11657
11658 (write-buffered *(ebp+8) " # . epilogue\n")
11659 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n")
11660 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n")
11661 (write-buffered *(ebp+8) " c3/return\n")
11662 $emit-subx-epilogue:end:
11663
11664 89/<- %esp 5/r32/ebp
11665 5d/pop-to-ebp
11666 c3/return