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-unused:
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 Tree-is-atom:
368 0/imm32
369
370 Tree-value:
371 4/imm32
372
373 Tree-left:
374 4/imm32
375 Tree-right:
376 8/imm32
377
378 Tree-size:
379 0xc/imm32
380
381
382
383 Type-id:
384 0x1c/imm32/write
385 0/imm32/read
386 0x100/imm32/size
387
388 "literal"/imm32
389 "int"/imm32
390 "addr"/imm32
391 "array"/imm32
392 "handle"/imm32
393 "boolean"/imm32
394 "constant"/imm32
395 "offset"/imm32
396 0/imm32
397
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 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
403 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
404 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32
405
406
407
408
409 Typeinfo-id:
410 0/imm32
411 Typeinfo-fields:
412 4/imm32
413
414
415
416
417
418 Typeinfo-total-size-in-bytes:
419 8/imm32
420 Typeinfo-next:
421 0xc/imm32
422 Typeinfo-size:
423 0x10/imm32
424
425
426
427 Typeinfo-fields-row-size:
428 8/imm32
429
430
431
432
433
434
435
436
437 Typeinfo-entry-input-var:
438 0/imm32
439 Typeinfo-entry-index:
440 4/imm32
441 Typeinfo-entry-output-var:
442 8/imm32
443 Typeinfo-entry-size:
444 0xc/imm32
445
446 == code
447
448 Entry:
449
450 89/<- %ebp 4/r32/esp
451 (new-segment *Heap-size Heap)
452
453 {
454
455 81 7/subop/compare *ebp 1/imm32
456 7e/jump-if-<= break/disp8
457
458 (kernel-string-equal? *(ebp+8) "test")
459 3d/compare-eax-and 0/imm32/false
460 74/jump-if-= break/disp8
461
462 (run-tests)
463
464 8b/-> *Num-test-failures 3/r32/ebx
465 eb/jump $mu-main:end/disp8
466 }
467
468 (convert-mu Stdin Stdout)
469 (flush Stdout)
470
471 bb/copy-to-ebx 0/imm32
472 $mu-main:end:
473 b8/copy-to-eax 1/imm32/exit
474 cd/syscall 0x80/imm8
475
476 convert-mu:
477
478 55/push-ebp
479 89/<- %ebp 4/r32/esp
480
481 c7 0/subop/copy *Next-block-index 1/imm32
482 c7 0/subop/copy *Type-id 0x1c/imm32
483 c7 0/subop/copy *_Program-functions 0/imm32
484 c7 0/subop/copy *_Program-types 0/imm32
485
486 (parse-mu *(ebp+8))
487 (populate-mu-type-sizes)
488 (check-mu-types)
489 (emit-subx *(ebp+0xc))
490 $convert-mu:end:
491
492 89/<- %esp 5/r32/ebp
493 5d/pop-to-ebp
494 c3/return
495
496 test-convert-empty-input:
497
498
499 55/push-ebp
500 89/<- %ebp 4/r32/esp
501
502 (clear-stream _test-input-stream)
503 (clear-stream $_test-input-buffered-file->buffer)
504 (clear-stream _test-output-stream)
505 (clear-stream $_test-output-buffered-file->buffer)
506
507 (convert-mu _test-input-buffered-file _test-output-buffered-file)
508 (flush _test-output-buffered-file)
509 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
510
511 89/<- %esp 5/r32/ebp
512 5d/pop-to-ebp
513 c3/return
514
515 test-convert-function-skeleton:
516
517 55/push-ebp
518 89/<- %ebp 4/r32/esp
519
520 (clear-stream _test-input-stream)
521 (clear-stream $_test-input-buffered-file->buffer)
522 (clear-stream _test-output-stream)
523 (clear-stream $_test-output-buffered-file->buffer)
524
525 (write _test-input-stream "fn foo {\n")
526 (write _test-input-stream "}\n")
527
528 (convert-mu _test-input-buffered-file _test-output-buffered-file)
529 (flush _test-output-buffered-file)
530 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
536
537 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
538 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1")
539 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2")
540 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
541 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4")
542 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
543 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
544 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7")
545
546 89/<- %esp 5/r32/ebp
547 5d/pop-to-ebp
548 c3/return
549
550 test-convert-multiple-function-skeletons:
551
552 55/push-ebp
553 89/<- %ebp 4/r32/esp
554
555 (clear-stream _test-input-stream)
556 (clear-stream $_test-input-buffered-file->buffer)
557 (clear-stream _test-output-stream)
558 (clear-stream $_test-output-buffered-file->buffer)
559
560 (write _test-input-stream "fn foo {\n")
561 (write _test-input-stream "}\n")
562 (write _test-input-stream "fn bar {\n")
563 (write _test-input-stream "}\n")
564
565 (convert-mu _test-input-buffered-file _test-output-buffered-file)
566 (flush _test-output-buffered-file)
567 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
573
574 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
575 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1")
576 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
577 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
578 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4")
579 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
580 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
581 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7")
582
583 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
584 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11")
585 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
586 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
587 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14")
588 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
589 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
590 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17")
591
592 89/<- %esp 5/r32/ebp
593 5d/pop-to-ebp
594 c3/return
595
596 test-convert-function-with-arg:
597
598 55/push-ebp
599 89/<- %ebp 4/r32/esp
600
601 (clear-stream _test-input-stream)
602 (clear-stream $_test-input-buffered-file->buffer)
603 (clear-stream _test-output-stream)
604 (clear-stream $_test-output-buffered-file->buffer)
605
606 (write _test-input-stream "fn foo n: int {\n")
607 (write _test-input-stream "}\n")
608
609 (convert-mu _test-input-buffered-file _test-output-buffered-file)
610 (flush _test-output-buffered-file)
611 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
617
618 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0")
619 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1")
620 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2")
621 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3")
622 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4")
623 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5")
624 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6")
625 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7")
626
627 89/<- %esp 5/r32/ebp
628 5d/pop-to-ebp
629 c3/return
630
631 test-convert-function-with-arg-and-body:
632
633 55/push-ebp
634 89/<- %ebp 4/r32/esp
635
636 (clear-stream _test-input-stream)
637 (clear-stream $_test-input-buffered-file->buffer)
638 (clear-stream _test-output-stream)
639 (clear-stream $_test-output-buffered-file->buffer)
640
641 (write _test-input-stream "fn foo n: int {\n")
642 (write _test-input-stream " increment n\n")
643 (write _test-input-stream "}\n")
644
645 (convert-mu _test-input-buffered-file _test-output-buffered-file)
646 (flush _test-output-buffered-file)
647 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
653
654 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0")
655 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1")
656 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2")
657 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3")
658 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4")
659 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5")
660 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6")
661 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7")
662 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8")
663 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9")
664 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10")
665 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11")
666 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12")
667
668 89/<- %esp 5/r32/ebp
669 5d/pop-to-ebp
670 c3/return
671
672 test-convert-function-distinguishes-args:
673
674 55/push-ebp
675 89/<- %ebp 4/r32/esp
676
677 (clear-stream _test-input-stream)
678 (clear-stream $_test-input-buffered-file->buffer)
679 (clear-stream _test-output-stream)
680 (clear-stream $_test-output-buffered-file->buffer)
681
682 (write _test-input-stream "fn foo a: int, b: int {\n")
683 (write _test-input-stream " increment b\n")
684 (write _test-input-stream "}\n")
685
686 (convert-mu _test-input-buffered-file _test-output-buffered-file)
687 (flush _test-output-buffered-file)
688 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
694
695 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0")
696 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1")
697 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2")
698 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3")
699 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4")
700 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5")
701 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6")
702 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7")
703 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8")
704 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9")
705 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10")
706 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11")
707 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12")
708
709 89/<- %esp 5/r32/ebp
710 5d/pop-to-ebp
711 c3/return
712
713 test-convert-function-returns-result:
714
715 55/push-ebp
716 89/<- %ebp 4/r32/esp
717
718 (clear-stream _test-input-stream)
719 (clear-stream $_test-input-buffered-file->buffer)
720 (clear-stream _test-output-stream)
721 (clear-stream $_test-output-buffered-file->buffer)
722
723 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
724 (write _test-input-stream " result <- copy a\n")
725 (write _test-input-stream " result <- increment\n")
726 (write _test-input-stream "}\n")
727
728 (convert-mu _test-input-buffered-file _test-output-buffered-file)
729 (flush _test-output-buffered-file)
730 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
736
737 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0")
738 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1")
739 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2")
740 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3")
741 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4")
742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-returns-result/5")
743 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/6")
744 (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/7")
745 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/8")
746 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-returns-result/9")
747 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/10")
748 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/11")
749 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/12")
750 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/13")
751
752 89/<- %esp 5/r32/ebp
753 5d/pop-to-ebp
754 c3/return
755
756 test-convert-function-with-literal-arg:
757
758 55/push-ebp
759 89/<- %ebp 4/r32/esp
760
761 (clear-stream _test-input-stream)
762 (clear-stream $_test-input-buffered-file->buffer)
763 (clear-stream _test-output-stream)
764 (clear-stream $_test-output-buffered-file->buffer)
765
766 (write _test-input-stream "fn foo a: int, b: int -> result/eax: int {\n")
767 (write _test-input-stream " result <- copy a\n")
768 (write _test-input-stream " result <- add 1\n")
769 (write _test-input-stream "}\n")
770
771 (convert-mu _test-input-buffered-file _test-output-buffered-file)
772 (flush _test-output-buffered-file)
773 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
779
780 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0")
781 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1")
782 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2")
783 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3")
784 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4")
785 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5")
786 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/6")
787 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/7")
788 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/8")
789 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/9")
790 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/10")
791 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/11")
792 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/12")
793 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/13")
794
795 89/<- %esp 5/r32/ebp
796 5d/pop-to-ebp
797 c3/return
798
799 test-convert-function-with-literal-arg-2:
800
801 55/push-ebp
802 89/<- %ebp 4/r32/esp
803
804 (clear-stream _test-input-stream)
805 (clear-stream $_test-input-buffered-file->buffer)
806 (clear-stream _test-output-stream)
807 (clear-stream $_test-output-buffered-file->buffer)
808
809 (write _test-input-stream "fn foo a: int, b: int -> result/ebx: int {\n")
810 (write _test-input-stream " result <- copy a\n")
811 (write _test-input-stream " result <- add 1\n")
812 (write _test-input-stream "}\n")
813
814 (convert-mu _test-input-buffered-file _test-output-buffered-file)
815 (flush _test-output-buffered-file)
816 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
822
823 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0")
824 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1")
825 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2")
826 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3")
827 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4")
828 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5")
829 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/6")
830 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/7")
831 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/8")
832 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/9")
833 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/10")
834 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/11")
835 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/12")
836 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/13")
837
838 89/<- %esp 5/r32/ebp
839 5d/pop-to-ebp
840 c3/return
841
842 test-convert-function-call-with-literal-arg:
843
844 55/push-ebp
845 89/<- %ebp 4/r32/esp
846
847 (clear-stream _test-input-stream)
848 (clear-stream $_test-input-buffered-file->buffer)
849 (clear-stream _test-output-stream)
850 (clear-stream $_test-output-buffered-file->buffer)
851
852 (write _test-input-stream "fn main -> result/ebx: int {\n")
853 (write _test-input-stream " result <- do-add 3 4\n")
854 (write _test-input-stream "}\n")
855 (write _test-input-stream "fn do-add a: int, b: int -> result/ebx: int {\n")
856 (write _test-input-stream " result <- copy a\n")
857 (write _test-input-stream " result <- add b\n")
858 (write _test-input-stream "}\n")
859
860 (convert-mu _test-input-buffered-file _test-output-buffered-file)
861 (flush _test-output-buffered-file)
862 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
868
869 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0")
870 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1")
871 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2")
872 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3")
873 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4")
874 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5")
875 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/6")
876 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/7")
877 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/8")
878 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/9")
879 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/10")
880 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/11")
881 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/12")
882 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/13")
883 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/14")
884 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/15")
885 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/16")
886 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/17")
887 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/18")
888 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/19")
889 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/20")
890 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/21")
891 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/22")
892 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/23")
893 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/24")
894 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/25")
895 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/26")
896
897 89/<- %esp 5/r32/ebp
898 5d/pop-to-ebp
899 c3/return
900
901 test-convert-function-with-local-var-in-mem:
902
903 55/push-ebp
904 89/<- %ebp 4/r32/esp
905
906 (clear-stream _test-input-stream)
907 (clear-stream $_test-input-buffered-file->buffer)
908 (clear-stream _test-output-stream)
909 (clear-stream $_test-output-buffered-file->buffer)
910
911 (write _test-input-stream "fn foo {\n")
912 (write _test-input-stream " var x: int\n")
913 (write _test-input-stream " increment x\n")
914 (write _test-input-stream "}\n")
915
916 (convert-mu _test-input-buffered-file _test-output-buffered-file)
917 (flush _test-output-buffered-file)
918 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
924
925 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0")
926 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1")
927 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2")
928 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3")
929 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4")
930 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5")
931 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6")
932 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7")
933 (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")
934 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9")
935 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10")
936 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11")
937 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12")
938 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13")
939 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14")
940
941 89/<- %esp 5/r32/ebp
942 5d/pop-to-ebp
943 c3/return
944
945 test-convert-function-with-local-var-with-compound-type-in-mem:
946
947 55/push-ebp
948 89/<- %ebp 4/r32/esp
949
950 (clear-stream _test-input-stream)
951 (clear-stream $_test-input-buffered-file->buffer)
952 (clear-stream _test-output-stream)
953 (clear-stream $_test-output-buffered-file->buffer)
954
955 (write _test-input-stream "fn foo {\n")
956 (write _test-input-stream " var x: (addr int)\n")
957 (write _test-input-stream " copy-to x, 0\n")
958 (write _test-input-stream "}\n")
959
960 (convert-mu _test-input-buffered-file _test-output-buffered-file)
961 (flush _test-output-buffered-file)
962 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
968
969 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0")
970 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1")
971 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2")
972 (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")
973 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4")
974 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5")
975 (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")
976 (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")
977 (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")
978 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9")
979 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10")
980 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11")
981 (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")
982 (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")
983 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14")
984
985 89/<- %esp 5/r32/ebp
986 5d/pop-to-ebp
987 c3/return
988
989 test-convert-function-with-local-var-in-reg:
990
991 55/push-ebp
992 89/<- %ebp 4/r32/esp
993
994 (clear-stream _test-input-stream)
995 (clear-stream $_test-input-buffered-file->buffer)
996 (clear-stream _test-output-stream)
997 (clear-stream $_test-output-buffered-file->buffer)
998
999 (write _test-input-stream "fn foo {\n")
1000 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1001 (write _test-input-stream " x <- increment\n")
1002 (write _test-input-stream "}\n")
1003
1004 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1005 (flush _test-output-buffered-file)
1006 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1012
1013 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0")
1014 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1")
1015 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2")
1016 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3")
1017 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4")
1018 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5")
1019 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6")
1020 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7")
1021 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8")
1022 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9")
1023 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10")
1024 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11")
1025 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12")
1026 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13")
1027 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14")
1028 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15")
1029
1030 89/<- %esp 5/r32/ebp
1031 5d/pop-to-ebp
1032 c3/return
1033
1034 test-convert-function-with-second-local-var-in-same-reg:
1035
1036 55/push-ebp
1037 89/<- %ebp 4/r32/esp
1038
1039 (clear-stream _test-input-stream)
1040 (clear-stream $_test-input-buffered-file->buffer)
1041 (clear-stream _test-output-stream)
1042 (clear-stream $_test-output-buffered-file->buffer)
1043
1044 (write _test-input-stream "fn foo {\n")
1045 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1046 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1047 (write _test-input-stream " y <- increment\n")
1048 (write _test-input-stream "}\n")
1049
1050 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1051 (flush _test-output-buffered-file)
1052 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1058
1059 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0")
1060 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1")
1061 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2")
1062 (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")
1063 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4")
1064 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5")
1065 (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")
1066 (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")
1067 (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")
1068 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9")
1069 (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")
1070 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11")
1071 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12")
1072 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13")
1073 (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")
1074 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15")
1075 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16")
1076
1077 89/<- %esp 5/r32/ebp
1078 5d/pop-to-ebp
1079 c3/return
1080
1081 test-convert-function-with-local-var-dereferenced:
1082
1083 55/push-ebp
1084 89/<- %ebp 4/r32/esp
1085
1086 (clear-stream _test-input-stream)
1087 (clear-stream $_test-input-buffered-file->buffer)
1088 (clear-stream _test-output-stream)
1089 (clear-stream $_test-output-buffered-file->buffer)
1090
1091 (write _test-input-stream "fn foo {\n")
1092 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n")
1093 (write _test-input-stream " increment *x\n")
1094 (write _test-input-stream "}\n")
1095
1096 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1097 (flush _test-output-buffered-file)
1098 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1104
1105 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0")
1106 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1")
1107 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2")
1108 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3")
1109 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4")
1110 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5")
1111 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6")
1112 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7")
1113 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8")
1114 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9")
1115 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10")
1116 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11")
1117 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12")
1118 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13")
1119 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14")
1120 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15")
1121
1122 89/<- %esp 5/r32/ebp
1123 5d/pop-to-ebp
1124 c3/return
1125
1126 test-convert-compare-register-with-literal:
1127
1128 55/push-ebp
1129 89/<- %ebp 4/r32/esp
1130
1131 (clear-stream _test-input-stream)
1132 (clear-stream $_test-input-buffered-file->buffer)
1133 (clear-stream _test-output-stream)
1134 (clear-stream $_test-output-buffered-file->buffer)
1135
1136 (write _test-input-stream "fn foo {\n")
1137 (write _test-input-stream " var x/ecx: int <- copy 0\n")
1138 (write _test-input-stream " compare x, 0\n")
1139 (write _test-input-stream "}\n")
1140
1141 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1142 (flush _test-output-buffered-file)
1143 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1149
1150 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0")
1151 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1")
1152 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2")
1153 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3")
1154 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4")
1155 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5")
1156 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1157 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7")
1158 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8")
1159 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1160 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10")
1161 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11")
1162 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12")
1163 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13")
1164 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14")
1165 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15")
1166
1167 89/<- %esp 5/r32/ebp
1168 5d/pop-to-ebp
1169 c3/return
1170
1171 test-convert-function-with-local-var-in-block:
1172
1173 55/push-ebp
1174 89/<- %ebp 4/r32/esp
1175
1176 (clear-stream _test-input-stream)
1177 (clear-stream $_test-input-buffered-file->buffer)
1178 (clear-stream _test-output-stream)
1179 (clear-stream $_test-output-buffered-file->buffer)
1180
1181 (write _test-input-stream "fn foo {\n")
1182 (write _test-input-stream " {\n")
1183 (write _test-input-stream " var x: int\n")
1184 (write _test-input-stream " increment x\n")
1185 (write _test-input-stream " }\n")
1186 (write _test-input-stream "}\n")
1187
1188 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1189 (flush _test-output-buffered-file)
1190 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1196
1197 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0")
1198 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1")
1199 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2")
1200 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3")
1201 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4")
1202 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5")
1203 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6")
1204 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7")
1205 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8")
1206 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9")
1207 (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")
1208 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11")
1209 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12")
1210 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13")
1211 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14")
1212 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15")
1213 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16")
1214 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17")
1215 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18")
1216
1217 89/<- %esp 5/r32/ebp
1218 5d/pop-to-ebp
1219 c3/return
1220
1221 test-convert-function-with-local-var-in-named-block:
1222
1223 55/push-ebp
1224 89/<- %ebp 4/r32/esp
1225
1226 (clear-stream _test-input-stream)
1227 (clear-stream $_test-input-buffered-file->buffer)
1228 (clear-stream _test-output-stream)
1229 (clear-stream $_test-output-buffered-file->buffer)
1230
1231 (write _test-input-stream "fn foo {\n")
1232 (write _test-input-stream " $bar: {\n")
1233 (write _test-input-stream " var x: int\n")
1234 (write _test-input-stream " increment x\n")
1235 (write _test-input-stream " }\n")
1236 (write _test-input-stream "}\n")
1237
1238 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1239 (flush _test-output-buffered-file)
1240 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1246
1247 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0")
1248 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1")
1249 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2")
1250 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3")
1251 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4")
1252 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5")
1253 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6")
1254 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7")
1255 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8")
1256 (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")
1257 (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")
1258 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11")
1259 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12")
1260 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13")
1261 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14")
1262 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15")
1263 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16")
1264 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17")
1265 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18")
1266
1267 89/<- %esp 5/r32/ebp
1268 5d/pop-to-ebp
1269 c3/return
1270
1271 test-always-shadow-outermost-reg-vars-in-function:
1272
1273 55/push-ebp
1274 89/<- %ebp 4/r32/esp
1275
1276 (clear-stream _test-input-stream)
1277 (clear-stream $_test-input-buffered-file->buffer)
1278 (clear-stream _test-output-stream)
1279 (clear-stream $_test-output-buffered-file->buffer)
1280
1281 (write _test-input-stream "fn foo {\n")
1282 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1283 (write _test-input-stream "}\n")
1284
1285 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1286 (flush _test-output-buffered-file)
1287 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1293
1294 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0")
1295 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1")
1296 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2")
1297 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3")
1298 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4")
1299 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5")
1300 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6")
1301 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8")
1302 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9")
1303 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12")
1304 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13")
1305 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14")
1306 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15")
1307 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16")
1308 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17")
1309
1310 89/<- %esp 5/r32/ebp
1311 5d/pop-to-ebp
1312 c3/return
1313
1314 _pending-test-clobber-dead-local:
1315
1316 55/push-ebp
1317 89/<- %ebp 4/r32/esp
1318
1319 (clear-stream _test-input-stream)
1320 (clear-stream $_test-input-buffered-file->buffer)
1321 (clear-stream _test-output-stream)
1322 (clear-stream $_test-output-buffered-file->buffer)
1323
1324 (write _test-input-stream "fn foo {\n")
1325 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1326 (write _test-input-stream " {\n")
1327 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1328 (write _test-input-stream " }\n")
1329 (write _test-input-stream "}\n")
1330
1331 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1332 (flush _test-output-buffered-file)
1333 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1339
1340 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-clobber-dead-local/0")
1341 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-clobber-dead-local/1")
1342 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-clobber-dead-local/2")
1343 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-clobber-dead-local/3")
1344 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/4")
1345 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-clobber-dead-local/5")
1346 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-clobber-dead-local/6")
1347 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-clobber-dead-local/7")
1348 (check-next-stream-line-equal _test-output-stream " {" "F - test-clobber-dead-local/8")
1349 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-clobber-dead-local/9")
1350 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-clobber-dead-local/10")
1351 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/11")
1352 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-clobber-dead-local/12")
1353 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-clobber-dead-local/13")
1354 (check-next-stream-line-equal _test-output-stream " }" "F - test-clobber-dead-local/14")
1355 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-clobber-dead-local/15")
1356 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-clobber-dead-local/16")
1357 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-clobber-dead-local/17")
1358 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-clobber-dead-local/18")
1359 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-clobber-dead-local/19")
1360
1361 89/<- %esp 5/r32/ebp
1362 5d/pop-to-ebp
1363 c3/return
1364
1365 test-shadow-live-local:
1366
1367 55/push-ebp
1368 89/<- %ebp 4/r32/esp
1369
1370 (clear-stream _test-input-stream)
1371 (clear-stream $_test-input-buffered-file->buffer)
1372 (clear-stream _test-output-stream)
1373 (clear-stream $_test-output-buffered-file->buffer)
1374
1375 (write _test-input-stream "fn foo {\n")
1376 (write _test-input-stream " var x/ecx: int <- copy 3\n")
1377 (write _test-input-stream " {\n")
1378 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1379 (write _test-input-stream " }\n")
1380 (write _test-input-stream " x <- increment\n")
1381 (write _test-input-stream "}\n")
1382
1383 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1384 (flush _test-output-buffered-file)
1385 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1391
1392 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-local/0")
1393 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-local/1")
1394 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-local/2")
1395 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-local/3")
1396 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/4")
1397 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-local/5")
1398 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/6")
1399 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-local/7")
1400 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-local/8")
1401 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-local/9")
1402 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-local/10")
1403 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-local/11")
1404 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/12")
1405 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/13")
1406 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-local/14")
1407 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-local/15")
1408 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-local/16")
1409 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-local/17")
1410 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-local/18")
1411 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-local/19")
1412 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-local/20")
1413 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-local/21")
1414 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-local/21")
1415
1416 89/<- %esp 5/r32/ebp
1417 5d/pop-to-ebp
1418 c3/return
1419
1420 test-shadow-live-output:
1421
1422 55/push-ebp
1423 89/<- %ebp 4/r32/esp
1424
1425 (clear-stream _test-input-stream)
1426 (clear-stream $_test-input-buffered-file->buffer)
1427 (clear-stream _test-output-stream)
1428 (clear-stream $_test-output-buffered-file->buffer)
1429
1430 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1431 (write _test-input-stream " x <- copy 3\n")
1432 (write _test-input-stream " {\n")
1433 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1434 (write _test-input-stream " }\n")
1435 (write _test-input-stream " x <- increment\n")
1436 (write _test-input-stream "}\n")
1437
1438 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1439 (flush _test-output-buffered-file)
1440 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1446
1447 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-live-output/0")
1448 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-live-output/1")
1449 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-live-output/2")
1450 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-live-output/3")
1451 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/4")
1452 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-live-output/5")
1453 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-live-output/7")
1454 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-live-output/8")
1455 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-live-output/9")
1456 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-live-output/10")
1457 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-live-output/11")
1458 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-live-output/12")
1459 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/13")
1460 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-live-output/14")
1461 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-live-output/15")
1462 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-live-output/17")
1463 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-live-output/18")
1464 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-live-output/19")
1465 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-live-output/20")
1466 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-live-output/21")
1467 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-live-output/21")
1468
1469 89/<- %esp 5/r32/ebp
1470 5d/pop-to-ebp
1471 c3/return
1472
1473 _pending-test-local-clobbered-by-output:
1474
1475
1476 55/push-ebp
1477 89/<- %ebp 4/r32/esp
1478
1479 (clear-stream _test-input-stream)
1480 (clear-stream $_test-input-buffered-file->buffer)
1481 (clear-stream _test-output-stream)
1482 (clear-stream $_test-output-buffered-file->buffer)
1483
1484 (write _test-input-stream "fn foo -> x/ecx: int {\n")
1485 (write _test-input-stream " var y/ecx: int <- copy 4\n")
1486 (write _test-input-stream " x <- copy y\n")
1487 (write _test-input-stream "}\n")
1488
1489 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1490 (flush _test-output-buffered-file)
1491 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1497
1498 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-local-clobbered-by-output/0")
1499 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-local-clobbered-by-output/1")
1500 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-local-clobbered-by-output/2")
1501 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-local-clobbered-by-output/3")
1502 (check-next-stream-line-equal _test-output-stream " {" "F - test-local-clobbered-by-output/4")
1503 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-local-clobbered-by-output/5")
1504 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-local-clobbered-by-output/6")
1505 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-local-clobbered-by-output/7")
1506 (check-next-stream-line-equal _test-output-stream " }" "F - test-local-clobbered-by-output/8")
1507 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-local-clobbered-by-output/9")
1508 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-local-clobbered-by-output/10")
1509 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-local-clobbered-by-output/11")
1510 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-local-clobbered-by-output/12")
1511 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-local-clobbered-by-output/13")
1512
1513 89/<- %esp 5/r32/ebp
1514 5d/pop-to-ebp
1515 c3/return
1516
1517 test-convert-function-with-branches-in-block:
1518
1519 55/push-ebp
1520 89/<- %ebp 4/r32/esp
1521
1522 (clear-stream _test-input-stream)
1523 (clear-stream $_test-input-buffered-file->buffer)
1524 (clear-stream _test-output-stream)
1525 (clear-stream $_test-output-buffered-file->buffer)
1526
1527 (write _test-input-stream "fn foo x: int {\n")
1528 (write _test-input-stream " {\n")
1529 (write _test-input-stream " break-if->=\n")
1530 (write _test-input-stream " loop-if-addr<\n")
1531 (write _test-input-stream " increment x\n")
1532 (write _test-input-stream " loop\n")
1533 (write _test-input-stream " }\n")
1534 (write _test-input-stream "}\n")
1535
1536 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1537 (flush _test-output-buffered-file)
1538 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1544
1545 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0")
1546 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1")
1547 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2")
1548 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3")
1549 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4")
1550 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5")
1551 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6")
1552 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7")
1553 (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/8")
1554 (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/9")
1555 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/10")
1556 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/11")
1557 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12")
1558 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/13")
1559 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/14")
1560 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/15")
1561 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/16")
1562 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/17")
1563 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/18")
1564 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/19")
1565
1566 89/<- %esp 5/r32/ebp
1567 5d/pop-to-ebp
1568 c3/return
1569
1570 test-convert-function-with-branches-in-named-block:
1571
1572 55/push-ebp
1573 89/<- %ebp 4/r32/esp
1574
1575 (clear-stream _test-input-stream)
1576 (clear-stream $_test-input-buffered-file->buffer)
1577 (clear-stream _test-output-stream)
1578 (clear-stream $_test-output-buffered-file->buffer)
1579
1580 (write _test-input-stream "fn foo x: int {\n")
1581 (write _test-input-stream " $bar: {\n")
1582 (write _test-input-stream " break-if->= $bar\n")
1583 (write _test-input-stream " loop-if-addr< $bar\n")
1584 (write _test-input-stream " increment x\n")
1585 (write _test-input-stream " loop\n")
1586 (write _test-input-stream " }\n")
1587 (write _test-input-stream "}\n")
1588
1589 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1590 (flush _test-output-buffered-file)
1591 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1597
1598 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0")
1599 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1")
1600 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2")
1601 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3")
1602 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4")
1603 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5")
1604 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6")
1605 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7")
1606 (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")
1607 (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")
1608 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/10")
1609 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/11")
1610 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/12")
1611 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/13")
1612 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/14")
1613 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/15")
1614 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/16")
1615 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/17")
1616 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/18")
1617 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/19")
1618
1619 89/<- %esp 5/r32/ebp
1620 5d/pop-to-ebp
1621 c3/return
1622
1623 test-convert-function-with-var-in-nested-block:
1624
1625 55/push-ebp
1626 89/<- %ebp 4/r32/esp
1627
1628 (clear-stream _test-input-stream)
1629 (clear-stream $_test-input-buffered-file->buffer)
1630 (clear-stream _test-output-stream)
1631 (clear-stream $_test-output-buffered-file->buffer)
1632
1633 (write _test-input-stream "fn foo x: int {\n")
1634 (write _test-input-stream " {\n")
1635 (write _test-input-stream " {\n")
1636 (write _test-input-stream " var x: int\n")
1637 (write _test-input-stream " increment x\n")
1638 (write _test-input-stream " }\n")
1639 (write _test-input-stream " }\n")
1640 (write _test-input-stream "}\n")
1641
1642 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1643 (flush _test-output-buffered-file)
1644 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1650
1651 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0")
1652 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1")
1653 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2")
1654 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3")
1655 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4")
1656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5")
1657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6")
1658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7")
1659 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8")
1660 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9")
1661 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10")
1662 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11")
1663 (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")
1664 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13")
1665 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14")
1666 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15")
1667 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16")
1668 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17")
1669 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18")
1670 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19")
1671 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20")
1672 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21")
1673 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22")
1674
1675 89/<- %esp 5/r32/ebp
1676 5d/pop-to-ebp
1677 c3/return
1678
1679 test-convert-function-with-multiple-vars-in-nested-blocks:
1680
1681 55/push-ebp
1682 89/<- %ebp 4/r32/esp
1683
1684 (clear-stream _test-input-stream)
1685 (clear-stream $_test-input-buffered-file->buffer)
1686 (clear-stream _test-output-stream)
1687 (clear-stream $_test-output-buffered-file->buffer)
1688
1689 (write _test-input-stream "fn foo x: int {\n")
1690 (write _test-input-stream " {\n")
1691 (write _test-input-stream " var x/eax: int <- copy 0\n")
1692 (write _test-input-stream " {\n")
1693 (write _test-input-stream " var y: int\n")
1694 (write _test-input-stream " x <- add y\n")
1695 (write _test-input-stream " }\n")
1696 (write _test-input-stream " }\n")
1697 (write _test-input-stream "}\n")
1698
1699 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1700 (flush _test-output-buffered-file)
1701 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1707
1708 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0")
1709 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1")
1710 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2")
1711 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3")
1712 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4")
1713 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5")
1714 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6")
1715 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7")
1716 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8")
1717 (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")
1718 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10")
1719 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11")
1720 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12")
1721 (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")
1722 (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")
1723 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15")
1724 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16")
1725 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17")
1726 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18")
1727 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19")
1728 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20")
1729 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21")
1730 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22")
1731 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23")
1732 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24")
1733 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25")
1734
1735 89/<- %esp 5/r32/ebp
1736 5d/pop-to-ebp
1737 c3/return
1738
1739 test-convert-function-with-branches-and-local-vars:
1740
1741
1742
1743
1744 55/push-ebp
1745 89/<- %ebp 4/r32/esp
1746
1747 (clear-stream _test-input-stream)
1748 (clear-stream $_test-input-buffered-file->buffer)
1749 (clear-stream _test-output-stream)
1750 (clear-stream $_test-output-buffered-file->buffer)
1751
1752 (write _test-input-stream "fn foo {\n")
1753 (write _test-input-stream " {\n")
1754 (write _test-input-stream " var x: int\n")
1755 (write _test-input-stream " break-if->=\n")
1756 (write _test-input-stream " increment x\n")
1757 (write _test-input-stream " }\n")
1758 (write _test-input-stream "}\n")
1759
1760 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1761 (flush _test-output-buffered-file)
1762 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1768
1769 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0")
1770 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1")
1771 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2")
1772 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3")
1773 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4")
1774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5")
1775 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6")
1776 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7")
1777 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8")
1778 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9")
1779 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10")
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/11")
1781 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12")
1782 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13")
1783 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14")
1784 (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")
1785 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16")
1786 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17")
1787 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18")
1788 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19")
1789 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20")
1790 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21")
1791 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22")
1792 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23")
1793
1794 89/<- %esp 5/r32/ebp
1795 5d/pop-to-ebp
1796 c3/return
1797
1798 test-convert-function-with-conditional-loops-and-local-vars:
1799
1800
1801
1802
1803 55/push-ebp
1804 89/<- %ebp 4/r32/esp
1805
1806 (clear-stream _test-input-stream)
1807 (clear-stream $_test-input-buffered-file->buffer)
1808 (clear-stream _test-output-stream)
1809 (clear-stream $_test-output-buffered-file->buffer)
1810
1811 (write _test-input-stream "fn foo {\n")
1812 (write _test-input-stream " {\n")
1813 (write _test-input-stream " var x: int\n")
1814 (write _test-input-stream " loop-if->=\n")
1815 (write _test-input-stream " increment x\n")
1816 (write _test-input-stream " }\n")
1817 (write _test-input-stream "}\n")
1818
1819 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1820 (flush _test-output-buffered-file)
1821 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1827
1828 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0")
1829 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1")
1830 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2")
1831 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3")
1832 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4")
1833 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5")
1834 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6")
1835 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7")
1836 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8")
1837 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9")
1838 (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")
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/11")
1840 (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")
1841 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13")
1842 (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")
1843 (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")
1844 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16")
1845 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17")
1846 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18")
1847 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19")
1848 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20")
1849 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21")
1850 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22")
1851 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23")
1852
1853 89/<- %esp 5/r32/ebp
1854 5d/pop-to-ebp
1855 c3/return
1856
1857 test-convert-function-with-unconditional-loops-and-local-vars:
1858
1859
1860
1861
1862 55/push-ebp
1863 89/<- %ebp 4/r32/esp
1864
1865 (clear-stream _test-input-stream)
1866 (clear-stream $_test-input-buffered-file->buffer)
1867 (clear-stream _test-output-stream)
1868 (clear-stream $_test-output-buffered-file->buffer)
1869
1870 (write _test-input-stream "fn foo {\n")
1871 (write _test-input-stream " {\n")
1872 (write _test-input-stream " var x: int\n")
1873 (write _test-input-stream " loop\n")
1874 (write _test-input-stream " increment x\n")
1875 (write _test-input-stream " }\n")
1876 (write _test-input-stream "}\n")
1877
1878 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1879 (flush _test-output-buffered-file)
1880 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1886
1887 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0")
1888 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1")
1889 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2")
1890 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3")
1891 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4")
1892 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5")
1893 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6")
1894 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7")
1895 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8")
1896 (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")
1897 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10")
1898
1899 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11")
1900 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12")
1901 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13")
1902 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14")
1903 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15")
1904 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16")
1905 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17")
1906 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18")
1907
1908 89/<- %esp 5/r32/ebp
1909 5d/pop-to-ebp
1910 c3/return
1911
1912 test-convert-function-with-branches-and-loops-and-local-vars:
1913
1914 55/push-ebp
1915 89/<- %ebp 4/r32/esp
1916
1917 (clear-stream _test-input-stream)
1918 (clear-stream $_test-input-buffered-file->buffer)
1919 (clear-stream _test-output-stream)
1920 (clear-stream $_test-output-buffered-file->buffer)
1921
1922 (write _test-input-stream "fn foo {\n")
1923 (write _test-input-stream " {\n")
1924 (write _test-input-stream " var x: int\n")
1925 (write _test-input-stream " break-if->=\n")
1926 (write _test-input-stream " increment x\n")
1927 (write _test-input-stream " loop\n")
1928 (write _test-input-stream " }\n")
1929 (write _test-input-stream "}\n")
1930
1931 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1932 (flush _test-output-buffered-file)
1933 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
1939
1940 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0")
1941 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1")
1942 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2")
1943 (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")
1944 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4")
1945 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5")
1946 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6")
1947 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7")
1948 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8")
1949 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9")
1950 (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")
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/11")
1952 (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")
1953 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13")
1954 (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")
1955 (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")
1956 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16")
1957 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17")
1958 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18")
1959 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19")
1960 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20")
1961 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21")
1962 (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")
1963 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23")
1964 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24")
1965
1966 89/<- %esp 5/r32/ebp
1967 5d/pop-to-ebp
1968 c3/return
1969
1970 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars:
1971
1972 55/push-ebp
1973 89/<- %ebp 4/r32/esp
1974
1975 (clear-stream _test-input-stream)
1976 (clear-stream $_test-input-buffered-file->buffer)
1977 (clear-stream _test-output-stream)
1978 (clear-stream $_test-output-buffered-file->buffer)
1979
1980 (write _test-input-stream "fn foo {\n")
1981 (write _test-input-stream " a: {\n")
1982 (write _test-input-stream " var x: int\n")
1983 (write _test-input-stream " {\n")
1984 (write _test-input-stream " var y: int\n")
1985 (write _test-input-stream " break-if->= a\n")
1986 (write _test-input-stream " increment x\n")
1987 (write _test-input-stream " loop\n")
1988 (write _test-input-stream " }\n")
1989 (write _test-input-stream " }\n")
1990 (write _test-input-stream "}\n")
1991
1992 (convert-mu _test-input-buffered-file _test-output-buffered-file)
1993 (flush _test-output-buffered-file)
1994 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2000
2001 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0")
2002 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1")
2003 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2")
2004 (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")
2005 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4")
2006 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5")
2007 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6")
2008 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7")
2009 (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")
2010 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9")
2011 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10")
2012 (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")
2013 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12")
2014 (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")
2015 (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")
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/15")
2017 (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")
2018 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17")
2019 (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")
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/19")
2021 (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")
2022 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21")
2023 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22")
2024 (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")
2025 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24")
2026 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25")
2027 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26")
2028 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27")
2029 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28")
2030 (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")
2031 (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")
2032 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31")
2033
2034 89/<- %esp 5/r32/ebp
2035 5d/pop-to-ebp
2036 c3/return
2037
2038 test-convert-function-with-nonlocal-unconditional-break-and-local-vars:
2039
2040 55/push-ebp
2041 89/<- %ebp 4/r32/esp
2042
2043 (clear-stream _test-input-stream)
2044 (clear-stream $_test-input-buffered-file->buffer)
2045 (clear-stream _test-output-stream)
2046 (clear-stream $_test-output-buffered-file->buffer)
2047
2048 (write _test-input-stream "fn foo {\n")
2049 (write _test-input-stream " a: {\n")
2050 (write _test-input-stream " var x: int\n")
2051 (write _test-input-stream " {\n")
2052 (write _test-input-stream " var y: int\n")
2053 (write _test-input-stream " break a\n")
2054 (write _test-input-stream " increment x\n")
2055 (write _test-input-stream " }\n")
2056 (write _test-input-stream " }\n")
2057 (write _test-input-stream "}\n")
2058
2059 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2060 (flush _test-output-buffered-file)
2061 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2067
2068 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0")
2069 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1")
2070 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2")
2071 (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")
2072 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4")
2073 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5")
2074 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6")
2075 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7")
2076 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8")
2077 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9")
2078 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10")
2079 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11")
2080 (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")
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/13")
2082 (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")
2083 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15")
2084 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16")
2085 (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")
2086 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18")
2087 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19")
2088 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20")
2089 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21")
2090 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22")
2091 (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")
2092 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24")
2093 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25")
2094
2095 89/<- %esp 5/r32/ebp
2096 5d/pop-to-ebp
2097 c3/return
2098
2099 test-convert-function-with-unconditional-break-and-local-vars:
2100
2101 55/push-ebp
2102 89/<- %ebp 4/r32/esp
2103
2104 (clear-stream _test-input-stream)
2105 (clear-stream $_test-input-buffered-file->buffer)
2106 (clear-stream _test-output-stream)
2107 (clear-stream $_test-output-buffered-file->buffer)
2108
2109 (write _test-input-stream "fn foo {\n")
2110 (write _test-input-stream " {\n")
2111 (write _test-input-stream " var x: int\n")
2112 (write _test-input-stream " {\n")
2113 (write _test-input-stream " var y: int\n")
2114 (write _test-input-stream " break\n")
2115 (write _test-input-stream " increment x\n")
2116 (write _test-input-stream " }\n")
2117 (write _test-input-stream " }\n")
2118 (write _test-input-stream "}\n")
2119
2120 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2121 (flush _test-output-buffered-file)
2122 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2128
2129 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0")
2130 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1")
2131 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2")
2132 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3")
2133 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4")
2134 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5")
2135 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6")
2136 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7")
2137 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8")
2138 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9")
2139 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10")
2140 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11")
2141 (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")
2142 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13")
2143 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14")
2144 (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")
2145 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16")
2146 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17")
2147 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18")
2148 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19")
2149 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20")
2150 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21")
2151 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22")
2152 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23")
2153
2154 89/<- %esp 5/r32/ebp
2155 5d/pop-to-ebp
2156 c3/return
2157
2158 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars:
2159
2160 55/push-ebp
2161 89/<- %ebp 4/r32/esp
2162
2163 (clear-stream _test-input-stream)
2164 (clear-stream $_test-input-buffered-file->buffer)
2165 (clear-stream _test-output-stream)
2166 (clear-stream $_test-output-buffered-file->buffer)
2167
2168 (write _test-input-stream "fn foo {\n")
2169 (write _test-input-stream " a: {\n")
2170 (write _test-input-stream " var x: int\n")
2171 (write _test-input-stream " {\n")
2172 (write _test-input-stream " var y: int\n")
2173 (write _test-input-stream " loop a\n")
2174 (write _test-input-stream " increment x\n")
2175 (write _test-input-stream " }\n")
2176 (write _test-input-stream " }\n")
2177 (write _test-input-stream "}\n")
2178
2179 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2180 (flush _test-output-buffered-file)
2181 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2187
2188 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0")
2189 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1")
2190 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2")
2191 (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")
2192 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4")
2193 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5")
2194 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6")
2195 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7")
2196 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8")
2197 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9")
2198 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10")
2199 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11")
2200 (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")
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/13")
2202 (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")
2203 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15")
2204 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16")
2205 (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")
2206 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18")
2207 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19")
2208 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20")
2209 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21")
2210 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22")
2211 (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")
2212 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24")
2213 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25")
2214
2215 89/<- %esp 5/r32/ebp
2216 5d/pop-to-ebp
2217 c3/return
2218
2219 test-convert-function-with-local-array-var-in-mem:
2220
2221 55/push-ebp
2222 89/<- %ebp 4/r32/esp
2223
2224 (clear-stream _test-input-stream)
2225 (clear-stream $_test-input-buffered-file->buffer)
2226 (clear-stream _test-output-stream)
2227 (clear-stream $_test-output-buffered-file->buffer)
2228
2229 (write _test-input-stream "fn foo {\n")
2230 (write _test-input-stream " var x: (array int 3)\n")
2231 (write _test-input-stream "}\n")
2232
2233 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2234 (flush _test-output-buffered-file)
2235 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2241
2242 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0")
2243 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1")
2244 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2")
2245 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3")
2246 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4")
2247 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5")
2248
2249 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7")
2250 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8")
2251
2252 (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")
2253
2254 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10")
2255 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11")
2256 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12")
2257 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13")
2258 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14")
2259 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15")
2260
2261 89/<- %esp 5/r32/ebp
2262 5d/pop-to-ebp
2263 c3/return
2264
2265 test-convert-address:
2266
2267 55/push-ebp
2268 89/<- %ebp 4/r32/esp
2269
2270 (clear-stream _test-input-stream)
2271 (clear-stream $_test-input-buffered-file->buffer)
2272 (clear-stream _test-output-stream)
2273 (clear-stream $_test-output-buffered-file->buffer)
2274
2275 (write _test-input-stream "fn foo {\n")
2276 (write _test-input-stream " var a: int\n")
2277 (write _test-input-stream " var b/eax: (addr int) <- address a\n")
2278 (write _test-input-stream "}\n")
2279
2280 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2281 (flush _test-output-buffered-file)
2282 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2288
2289 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0")
2290 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1")
2291 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2")
2292 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3")
2293 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4")
2294 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5")
2295 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6")
2296 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7")
2297 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8")
2298 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9")
2299 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10")
2300 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11")
2301 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12")
2302 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13")
2303 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14")
2304 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15")
2305 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16")
2306
2307 89/<- %esp 5/r32/ebp
2308 5d/pop-to-ebp
2309 c3/return
2310
2311 test-convert-length-of-array:
2312
2313 55/push-ebp
2314 89/<- %ebp 4/r32/esp
2315
2316 (clear-stream _test-input-stream)
2317 (clear-stream $_test-input-buffered-file->buffer)
2318 (clear-stream _test-output-stream)
2319 (clear-stream $_test-output-buffered-file->buffer)
2320
2321 (write _test-input-stream "fn foo a: (addr array int) {\n")
2322 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n")
2323 (write _test-input-stream " var c/eax: int <- length b\n")
2324 (write _test-input-stream "}\n")
2325
2326 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2327 (flush _test-output-buffered-file)
2328 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2334
2335 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0")
2336 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1")
2337 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2")
2338 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3")
2339 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4")
2340 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5")
2341 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6")
2342 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7")
2343 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/9")
2344 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/11")
2345 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/12")
2346 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/13")
2347 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/14")
2348 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/15")
2349 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/16")
2350 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/17")
2351
2352 89/<- %esp 5/r32/ebp
2353 5d/pop-to-ebp
2354 c3/return
2355
2356 test-convert-length-of-array-on-stack:
2357
2358 55/push-ebp
2359 89/<- %ebp 4/r32/esp
2360
2361 (clear-stream _test-input-stream)
2362 (clear-stream $_test-input-buffered-file->buffer)
2363 (clear-stream _test-output-stream)
2364 (clear-stream $_test-output-buffered-file->buffer)
2365
2366 (write _test-input-stream "fn foo {\n")
2367 (write _test-input-stream " var a: (array int 3)\n")
2368 (write _test-input-stream " var b/eax: int <- length a\n")
2369 (write _test-input-stream "}\n")
2370
2371 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2372 (flush _test-output-buffered-file)
2373 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2379
2380 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0")
2381 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1")
2382 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2")
2383 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3")
2384 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4")
2385 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5")
2386
2387 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6")
2388 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7")
2389 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8")
2390 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9")
2391 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/10")
2392 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/11")
2393 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/12")
2394 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/13")
2395 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/14")
2396 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/15")
2397 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/16")
2398 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/17")
2399
2400 89/<- %esp 5/r32/ebp
2401 5d/pop-to-ebp
2402 c3/return
2403
2404 test-convert-index-into-array:
2405
2406 55/push-ebp
2407 89/<- %ebp 4/r32/esp
2408
2409 (clear-stream _test-input-stream)
2410 (clear-stream $_test-input-buffered-file->buffer)
2411 (clear-stream _test-output-stream)
2412 (clear-stream $_test-output-buffered-file->buffer)
2413
2414 (write _test-input-stream "fn foo {\n")
2415 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2416 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2417 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2418 (write _test-input-stream "}\n")
2419
2420 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2421 (flush _test-output-buffered-file)
2422 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2428
2429 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0")
2430 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1")
2431 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2")
2432 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3")
2433 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4")
2434 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5")
2435 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6")
2436 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7")
2437 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8")
2438 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9")
2439 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/11")
2440 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/13")
2441 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/14")
2442 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/15")
2443 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/16")
2444 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/17")
2445 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/18")
2446 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/19")
2447 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/20")
2448
2449 89/<- %esp 5/r32/ebp
2450 5d/pop-to-ebp
2451 c3/return
2452
2453 test-convert-index-into-array-with-literal:
2454
2455 55/push-ebp
2456 89/<- %ebp 4/r32/esp
2457
2458 (clear-stream _test-input-stream)
2459 (clear-stream $_test-input-buffered-file->buffer)
2460 (clear-stream _test-output-stream)
2461 (clear-stream $_test-output-buffered-file->buffer)
2462
2463 (write _test-input-stream "fn foo {\n")
2464 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2465 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2466 (write _test-input-stream "}\n")
2467
2468 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2469 (flush _test-output-buffered-file)
2470 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2476
2477 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0")
2478 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1")
2479 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2")
2480 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3")
2481 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4")
2482 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5")
2483 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6")
2484 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7")
2485
2486 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8")
2487 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9")
2488 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10")
2489 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11")
2490 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12")
2491 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13")
2492 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14")
2493 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15")
2494
2495 89/<- %esp 5/r32/ebp
2496 5d/pop-to-ebp
2497 c3/return
2498
2499 test-convert-index-into-array-on-stack:
2500
2501 55/push-ebp
2502 89/<- %ebp 4/r32/esp
2503
2504 (clear-stream _test-input-stream)
2505 (clear-stream $_test-input-buffered-file->buffer)
2506 (clear-stream _test-output-stream)
2507 (clear-stream $_test-output-buffered-file->buffer)
2508
2509 (write _test-input-stream "fn foo {\n")
2510 (write _test-input-stream " var arr: (array int 3)\n")
2511 (write _test-input-stream " var idx/eax: int <- copy 2\n")
2512 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
2513 (write _test-input-stream "}\n")
2514
2515 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2516 (flush _test-output-buffered-file)
2517 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2523
2524 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0")
2525 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1")
2526 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2")
2527 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3")
2528 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4")
2529 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5")
2530
2531 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6")
2532 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7")
2533
2534 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8")
2535 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9")
2536
2537 (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")
2538
2539 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11")
2540
2541 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12")
2542
2543 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13")
2544 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14")
2545 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15")
2546 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16")
2547 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17")
2548 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18")
2549
2550 89/<- %esp 5/r32/ebp
2551 5d/pop-to-ebp
2552 c3/return
2553
2554 test-convert-index-into-array-on-stack-with-literal:
2555
2556 55/push-ebp
2557 89/<- %ebp 4/r32/esp
2558
2559 (clear-stream _test-input-stream)
2560 (clear-stream $_test-input-buffered-file->buffer)
2561 (clear-stream _test-output-stream)
2562 (clear-stream $_test-output-buffered-file->buffer)
2563
2564 (write _test-input-stream "fn foo {\n")
2565 (write _test-input-stream " var arr: (array int 3)\n")
2566 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n")
2567 (write _test-input-stream "}\n")
2568
2569 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2570 (flush _test-output-buffered-file)
2571 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2577
2578 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0")
2579 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1")
2580 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2")
2581 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3")
2582 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4")
2583 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5")
2584
2585 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6")
2586 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7")
2587
2588 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8")
2589
2590 (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")
2591
2592 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10")
2593
2594 (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")
2595
2596 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12")
2597 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13")
2598 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14")
2599 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15")
2600 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16")
2601 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17")
2602
2603 89/<- %esp 5/r32/ebp
2604 5d/pop-to-ebp
2605 c3/return
2606
2607 test-convert-index-into-array-using-offset:
2608
2609 55/push-ebp
2610 89/<- %ebp 4/r32/esp
2611
2612 (clear-stream _test-input-stream)
2613 (clear-stream $_test-input-buffered-file->buffer)
2614 (clear-stream _test-output-stream)
2615 (clear-stream $_test-output-buffered-file->buffer)
2616
2617 (write _test-input-stream "fn foo {\n")
2618 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2619 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
2620 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2621 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2622 (write _test-input-stream "}\n")
2623
2624 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2625 (flush _test-output-buffered-file)
2626 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2632
2633 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0")
2634 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1")
2635 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2")
2636 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3")
2637 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4")
2638 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5")
2639 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6")
2640 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7")
2641 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8")
2642 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9")
2643 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10")
2644 (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")
2645 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12")
2646 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13")
2647 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14")
2648 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15")
2649 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16")
2650 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17")
2651 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18")
2652 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19")
2653
2654 89/<- %esp 5/r32/ebp
2655 5d/pop-to-ebp
2656 c3/return
2657
2658 test-convert-index-into-array-using-offset-on-stack:
2659
2660 55/push-ebp
2661 89/<- %ebp 4/r32/esp
2662
2663 (clear-stream _test-input-stream)
2664 (clear-stream $_test-input-buffered-file->buffer)
2665 (clear-stream _test-output-stream)
2666 (clear-stream $_test-output-buffered-file->buffer)
2667
2668 (write _test-input-stream "fn foo {\n")
2669 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n")
2670 (write _test-input-stream " var idx: int\n")
2671 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n")
2672 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n")
2673 (write _test-input-stream "}\n")
2674
2675 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2676 (flush _test-output-buffered-file)
2677 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2683
2684 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0")
2685 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1")
2686 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2")
2687 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3")
2688 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4")
2689 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5")
2690 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6")
2691 (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")
2692 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8")
2693 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9")
2694 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset-on-stack/10")
2695 (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")
2696 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12")
2697 (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")
2698 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14")
2699 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15")
2700 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16")
2701 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17")
2702 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18")
2703 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19")
2704 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20")
2705
2706 89/<- %esp 5/r32/ebp
2707 5d/pop-to-ebp
2708 c3/return
2709
2710 test-convert-function-and-type-definition:
2711
2712 55/push-ebp
2713 89/<- %ebp 4/r32/esp
2714
2715 (clear-stream _test-input-stream)
2716 (clear-stream $_test-input-buffered-file->buffer)
2717 (clear-stream _test-output-stream)
2718 (clear-stream $_test-output-buffered-file->buffer)
2719
2720 (write _test-input-stream "fn foo a: (addr t) {\n")
2721 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n")
2722 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n")
2723 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n")
2724 (write _test-input-stream "}\n")
2725 (write _test-input-stream "type t {\n")
2726 (write _test-input-stream " x: int\n")
2727 (write _test-input-stream " y: int\n")
2728 (write _test-input-stream "}\n")
2729
2730 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2731 (flush _test-output-buffered-file)
2732 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2738
2739 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0")
2740 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1")
2741 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2")
2742 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3")
2743 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4")
2744 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5")
2745 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6")
2746 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7")
2747 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8")
2748 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9")
2749 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11")
2750 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13")
2751 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14")
2752 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15")
2753 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16")
2754 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17")
2755 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18")
2756 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19")
2757 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20")
2758
2759 89/<- %esp 5/r32/ebp
2760 5d/pop-to-ebp
2761 c3/return
2762
2763 test-convert-function-with-local-var-with-user-defined-type:
2764
2765 55/push-ebp
2766 89/<- %ebp 4/r32/esp
2767
2768 (clear-stream _test-input-stream)
2769 (clear-stream $_test-input-buffered-file->buffer)
2770 (clear-stream _test-output-stream)
2771 (clear-stream $_test-output-buffered-file->buffer)
2772
2773 (write _test-input-stream "fn foo {\n")
2774 (write _test-input-stream " var a: t\n")
2775 (write _test-input-stream "}\n")
2776 (write _test-input-stream "type t {\n")
2777 (write _test-input-stream " x: int\n")
2778 (write _test-input-stream " y: int\n")
2779 (write _test-input-stream "}\n")
2780
2781 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2782 (flush _test-output-buffered-file)
2783 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2789
2790 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0")
2791 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1")
2792 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2")
2793 (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")
2794 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4")
2795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5")
2796 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6")
2797 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7")
2798 (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")
2799 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9")
2800 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10")
2801 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11")
2802 (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")
2803 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13")
2804 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14")
2805
2806 89/<- %esp 5/r32/ebp
2807 5d/pop-to-ebp
2808 c3/return
2809
2810 test-convert-function-call-with-arg-of-user-defined-type:
2811
2812 55/push-ebp
2813 89/<- %ebp 4/r32/esp
2814
2815 (clear-stream _test-input-stream)
2816 (clear-stream $_test-input-buffered-file->buffer)
2817 (clear-stream _test-output-stream)
2818 (clear-stream $_test-output-buffered-file->buffer)
2819
2820 (write _test-input-stream "fn f {\n")
2821 (write _test-input-stream " var a: t\n")
2822 (write _test-input-stream " foo a\n")
2823 (write _test-input-stream "}\n")
2824 (write _test-input-stream "fn foo x: t {\n")
2825 (write _test-input-stream "}\n")
2826 (write _test-input-stream "type t {\n")
2827 (write _test-input-stream " x: int\n")
2828 (write _test-input-stream " y: int\n")
2829 (write _test-input-stream "}\n")
2830
2831 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2832 (flush _test-output-buffered-file)
2833 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2839
2840 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0")
2841 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1")
2842 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2")
2843 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3")
2844 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4")
2845 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5")
2846
2847 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6")
2848 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7")
2849
2850 (check-next-stream-line-equal _test-output-stream " (foo *(ebp+0xfffffff8) *(ebp+0xfffffffc))" "F - test-convert-function-call-with-arg-of-user-defined-type/8")
2851
2852 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/9")
2853 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10")
2854 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11")
2855 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12")
2856 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13")
2857 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14")
2858 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15")
2859 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16")
2860 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17")
2861 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18")
2862 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19")
2863 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20")
2864 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21")
2865 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22")
2866 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23")
2867
2868 89/<- %esp 5/r32/ebp
2869 5d/pop-to-ebp
2870 c3/return
2871
2872 test-convert-function-call-with-arg-of-user-defined-type-register-indirect:
2873
2874 55/push-ebp
2875 89/<- %ebp 4/r32/esp
2876
2877 (clear-stream _test-input-stream)
2878 (clear-stream $_test-input-buffered-file->buffer)
2879 (clear-stream _test-output-stream)
2880 (clear-stream $_test-output-buffered-file->buffer)
2881
2882 (write _test-input-stream "fn f {\n")
2883 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n")
2884 (write _test-input-stream " foo *a\n")
2885 (write _test-input-stream "}\n")
2886 (write _test-input-stream "fn foo x: t {\n")
2887 (write _test-input-stream "}\n")
2888 (write _test-input-stream "type t {\n")
2889 (write _test-input-stream " x: int\n")
2890 (write _test-input-stream " y: int\n")
2891 (write _test-input-stream "}\n")
2892
2893 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2894 (flush _test-output-buffered-file)
2895 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2901
2902 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0")
2903 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1")
2904 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2")
2905 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3")
2906 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4")
2907 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5")
2908
2909 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/6")
2910 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7")
2911
2912 (check-next-stream-line-equal _test-output-stream " (foo *(eax+0x00000000) *(eax+0x00000004))" "F - test-convert-function-call-with-arg-of-user-defined-type/8")
2913
2914 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/9")
2915 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10")
2916 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11")
2917 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12")
2918 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13")
2919 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14")
2920 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15")
2921 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16")
2922 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17")
2923 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18")
2924 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19")
2925 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20")
2926 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21")
2927 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22")
2928 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23")
2929
2930 89/<- %esp 5/r32/ebp
2931 5d/pop-to-ebp
2932 c3/return
2933
2934
2935
2936 test-convert-function-call-with-arg-of-user-defined-type-by-reference:
2937
2938 55/push-ebp
2939 89/<- %ebp 4/r32/esp
2940
2941 (clear-stream _test-input-stream)
2942 (clear-stream $_test-input-buffered-file->buffer)
2943 (clear-stream _test-output-stream)
2944 (clear-stream $_test-output-buffered-file->buffer)
2945
2946 (write _test-input-stream "fn f {\n")
2947 (write _test-input-stream " var a: t\n")
2948 (write _test-input-stream " var b/eax: (addr t) <- address a\n")
2949 (write _test-input-stream " foo b\n")
2950 (write _test-input-stream "}\n")
2951 (write _test-input-stream "fn foo x: (addr t) {\n")
2952 (write _test-input-stream " var x/ecx: (addr int) <- copy x\n")
2953 (write _test-input-stream " increment *x\n")
2954 (write _test-input-stream "}\n")
2955 (write _test-input-stream "type t {\n")
2956 (write _test-input-stream " x: int\n")
2957 (write _test-input-stream " y: int\n")
2958 (write _test-input-stream "}\n")
2959
2960 (convert-mu _test-input-buffered-file _test-output-buffered-file)
2961 (flush _test-output-buffered-file)
2962 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
2968
2969 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0")
2970 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1")
2971 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/2")
2972 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/3")
2973 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4")
2974 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/5")
2975
2976 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/6")
2977 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/7")
2978
2979 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/8")
2980 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/9")
2981
2982 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10")
2983
2984 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/11")
2985 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/12")
2986 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13")
2987 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/14")
2988 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15")
2989 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/16")
2990 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/17")
2991 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18")
2992 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19")
2993 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20")
2994 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/21")
2995 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/22")
2996 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23")
2997 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/24")
2998 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/25")
2999 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0x00000001/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/26")
3000 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/27")
3001 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/28")
3002 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29")
3003 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30")
3004 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31")
3005 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/32")
3006 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/33")
3007 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/34")
3008
3009 89/<- %esp 5/r32/ebp
3010 5d/pop-to-ebp
3011 c3/return
3012
3013 test-convert-get-of-type-on-stack:
3014
3015 55/push-ebp
3016 89/<- %ebp 4/r32/esp
3017
3018 (clear-stream _test-input-stream)
3019 (clear-stream $_test-input-buffered-file->buffer)
3020 (clear-stream _test-output-stream)
3021 (clear-stream $_test-output-buffered-file->buffer)
3022
3023 (write _test-input-stream "fn foo {\n")
3024 (write _test-input-stream " var a: t\n")
3025 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n")
3026 (write _test-input-stream "}\n")
3027 (write _test-input-stream "type t {\n")
3028 (write _test-input-stream " x: int\n")
3029 (write _test-input-stream " y: int\n")
3030 (write _test-input-stream "}\n")
3031
3032 (convert-mu _test-input-buffered-file _test-output-buffered-file)
3033 (flush _test-output-buffered-file)
3034 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
3040
3041 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-of-type-on-stack/0")
3042 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-of-type-on-stack/1")
3043 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-of-type-on-stack/2")
3044 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-of-type-on-stack/3")
3045 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-of-type-on-stack/4")
3046 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-of-type-on-stack/5")
3047
3048 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/6")
3049 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-of-type-on-stack/7")
3050
3051 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-of-type-on-stack/8")
3052
3053 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-of-type-on-stack/9")
3054
3055 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-of-type-on-stack/10")
3056
3057 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-of-type-on-stack/11")
3058 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-of-type-on-stack/12")
3059 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-of-type-on-stack/13")
3060 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-of-type-on-stack/14")
3061 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-of-type-on-stack/15")
3062 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-of-type-on-stack/16")
3063 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-of-type-on-stack/17")
3064
3065 89/<- %esp 5/r32/ebp
3066 5d/pop-to-ebp
3067 c3/return
3068
3069 test-convert-array-of-user-defined-types:
3070
3071 55/push-ebp
3072 89/<- %ebp 4/r32/esp
3073
3074 (clear-stream _test-input-stream)
3075 (clear-stream $_test-input-buffered-file->buffer)
3076 (clear-stream _test-output-stream)
3077 (clear-stream $_test-output-buffered-file->buffer)
3078
3079 (write _test-input-stream "type t {\n")
3080 (write _test-input-stream " x: int\n")
3081 (write _test-input-stream " y: int\n")
3082 (write _test-input-stream "}\n")
3083 (write _test-input-stream "fn foo {\n")
3084 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n")
3085 (write _test-input-stream " var idx/ecx: int <- copy 3\n")
3086 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n")
3087 (write _test-input-stream "}\n")
3088
3089 (convert-mu _test-input-buffered-file _test-output-buffered-file)
3090 (flush _test-output-buffered-file)
3091 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
3097
3098 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0")
3099 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1")
3100 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2")
3101 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3")
3102 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4")
3103 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5")
3104 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6")
3105 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7")
3106 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8")
3107 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9")
3108 (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")
3109 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13")
3110 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14")
3111 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15")
3112 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16")
3113 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17")
3114 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18")
3115 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19")
3116 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20")
3117
3118 89/<- %esp 5/r32/ebp
3119 5d/pop-to-ebp
3120 c3/return
3121
3122
3123
3124
3125
3126 parse-mu:
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159 55/push-ebp
3160 89/<- %ebp 4/r32/esp
3161
3162 50/push-eax
3163 51/push-ecx
3164 52/push-edx
3165 53/push-ebx
3166 56/push-esi
3167 57/push-edi
3168
3169 81 5/subop/subtract %esp 0x200/imm32
3170 68/push 0x200/imm32/size
3171 68/push 0/imm32/read
3172 68/push 0/imm32/write
3173 89/<- %ecx 4/r32/esp
3174
3175 68/push 0/imm32/end
3176 68/push 0/imm32/start
3177 89/<- %edx 4/r32/esp
3178
3179 bf/copy-to-edi _Program-functions/imm32
3180
3181 be/copy-to-esi _Program-types/imm32
3182
3183 81 5/subop/subtract %esp 0x400/imm32
3184 68/push 0x400/imm32/size
3185 68/push 0/imm32/top
3186 89/<- %ebx 4/r32/esp
3187 {
3188 $parse-mu:line-loop:
3189 (clear-stream %ecx)
3190 (read-line-buffered *(ebp+8) %ecx)
3191
3192 81 7/subop/compare *ecx 0/imm32
3193 0f 84/jump-if-= break/disp32
3194 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3200 (next-mu-token %ecx %edx)
3201
3202 (slice-empty? %edx)
3203 3d/compare-eax-and 0/imm32/false
3204 0f 85/jump-if-!= loop/disp32
3205
3206
3207 8b/-> *edx 0/r32/eax
3208 8a/copy-byte *eax 0/r32/AL
3209 81 4/subop/and %eax 0xff/imm32
3210
3211 3d/compare-eax-and 0x23/imm32/hash
3212 0f 84/jump-if-= loop/disp32
3213
3214 {
3215 $parse-mu:fn:
3216 (slice-equal? %edx "fn")
3217 3d/compare-eax-and 0/imm32/false
3218 0f 84/jump-if-= break/disp32
3219
3220 (allocate Heap *Function-size)
3221 (clear-stack %ebx)
3222 (populate-mu-function-header %ecx %eax %ebx)
3223 (populate-mu-function-body *(ebp+8) %eax %ebx)
3224
3225 89/<- *edi 0/r32/eax
3226
3227 8d/address-> *(eax+0x14) 7/r32/edi
3228 e9/jump $parse-mu:line-loop/disp32
3229 }
3230
3231 {
3232 $parse-mu:type:
3233 (slice-equal? %edx "type")
3234 3d/compare-eax-and 0/imm32
3235 0f 84/jump-if-= break/disp32
3236 (next-mu-token %ecx %edx)
3237
3238 (pos-or-insert-slice Type-id %edx)
3239
3240 (find-or-create-typeinfo %eax)
3241
3242 (populate-mu-type *(ebp+8) %eax)
3243 e9/jump $parse-mu:line-loop/disp32
3244 }
3245
3246 e9/jump $parse-mu:error1/disp32
3247 }
3248 $parse-mu:end:
3249
3250 81 0/subop/add %esp 0x630/imm32
3251
3252 5f/pop-to-edi
3253 5e/pop-to-esi
3254 5b/pop-to-ebx
3255 5a/pop-to-edx
3256 59/pop-to-ecx
3257 58/pop-to-eax
3258
3259 89/<- %esp 5/r32/ebp
3260 5d/pop-to-ebp
3261 c3/return
3262
3263 $parse-mu:error1:
3264
3265 (write-buffered Stderr "unexpected top-level command: ")
3266 (write-slice-buffered Stderr %edx)
3267 (write-buffered Stderr "\n")
3268 (flush Stderr)
3269
3270 bb/copy-to-ebx 1/imm32
3271 b8/copy-to-eax 1/imm32/exit
3272 cd/syscall 0x80/imm8
3273
3274
3275 $parse-mu:error2:
3276
3277 (print-int32-buffered Stderr *ebx)
3278 (write-buffered Stderr " vars not reclaimed after fn '")
3279 (write-slice-buffered Stderr *eax)
3280 (write-buffered Stderr "'\n")
3281 (flush Stderr)
3282
3283 bb/copy-to-ebx 1/imm32
3284 b8/copy-to-eax 1/imm32/exit
3285 cd/syscall 0x80/imm8
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299 populate-mu-function-header:
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328 55/push-ebp
3329 89/<- %ebp 4/r32/esp
3330
3331 50/push-eax
3332 51/push-ecx
3333 52/push-edx
3334 53/push-ebx
3335 57/push-edi
3336
3337 8b/-> *(ebp+0xc) 7/r32/edi
3338
3339 68/push 0/imm32/end
3340 68/push 0/imm32/start
3341 89/<- %ecx 4/r32/esp
3342
3343 (next-mu-token *(ebp+8) %ecx)
3344
3345
3346
3347 (slice-equal? %ecx "{")
3348 3d/compare-eax-and 0/imm32/false
3349 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3350
3351 (slice-equal? %ecx "->")
3352 3d/compare-eax-and 0/imm32/false
3353 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3354
3355 (slice-equal? %ecx "}")
3356 3d/compare-eax-and 0/imm32/false
3357 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3358
3359 (slice-to-string Heap %ecx)
3360 89/<- *edi 0/r32/eax
3361
3362 {
3363 $populate-mu-function-header:check-for-inout:
3364 (next-mu-token *(ebp+8) %ecx)
3365
3366 (slice-equal? %ecx "{")
3367 3d/compare-eax-and 0/imm32/false
3368 0f 85/jump-if-!= $populate-mu-function-header:done/disp32
3369
3370 (slice-equal? %ecx "->")
3371 3d/compare-eax-and 0/imm32/false
3372 0f 85/jump-if-!= break/disp32
3373
3374 (slice-equal? %ecx "}")
3375 3d/compare-eax-and 0/imm32/false
3376 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3377
3378 (parse-var-with-type %ecx *(ebp+8))
3379 89/<- %ebx 0/r32/eax
3380
3381 81 7/subop/compare *(ebx+0x10) 0/imm32
3382 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32
3383
3384
3385
3386 (append-list Heap %ebx *(edi+8))
3387 89/<- *(edi+8) 0/r32/eax
3388
3389 (push *(ebp+0x10) %ebx)
3390
3391 e9/jump loop/disp32
3392 }
3393
3394 {
3395 $populate-mu-function-header:check-for-out:
3396 (next-mu-token *(ebp+8) %ecx)
3397
3398 (slice-equal? %ecx "{")
3399 3d/compare-eax-and 0/imm32/false
3400 0f 85/jump-if-!= break/disp32
3401
3402 (slice-equal? %ecx "->")
3403 3d/compare-eax-and 0/imm32/false
3404 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3405
3406 (slice-equal? %ecx "}")
3407 3d/compare-eax-and 0/imm32/false
3408 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32
3409
3410 (parse-var-with-type %ecx *(ebp+8))
3411 89/<- %ebx 0/r32/eax
3412
3413 81 7/subop/compare *(ebx+0x10) 0/imm32
3414 0f 84/jump-if-= $populate-mu-function-header:error3/disp32
3415 (append-list Heap %ebx *(edi+0xc))
3416 89/<- *(edi+0xc) 0/r32/eax
3417 e9/jump loop/disp32
3418 }
3419 $populate-mu-function-header:done:
3420 (check-no-tokens-left *(ebp+8))
3421 $populate-mu-function-header:end:
3422
3423 81 0/subop/add %esp 8/imm32
3424
3425 5f/pop-to-edi
3426 5b/pop-to-ebx
3427 5a/pop-to-edx
3428 59/pop-to-ecx
3429 58/pop-to-eax
3430
3431 89/<- %esp 5/r32/ebp
3432 5d/pop-to-ebp
3433 c3/return
3434
3435 $populate-mu-function-header:error1:
3436
3437 (write-buffered Stderr "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '")
3438 (flush Stderr)
3439 (rewind-stream *(ebp+8))
3440 (write-stream 2 *(ebp+8))
3441 (write-buffered Stderr "'\n")
3442 (flush Stderr)
3443
3444 bb/copy-to-ebx 1/imm32
3445 b8/copy-to-eax 1/imm32/exit
3446 cd/syscall 0x80/imm8
3447
3448
3449 $populate-mu-function-header:error2:
3450
3451 (write-buffered Stderr "function input '")
3452 (write-buffered Stderr *ebx)
3453 (write-buffered Stderr "' cannot be in a register")
3454 (flush Stderr)
3455
3456 bb/copy-to-ebx 1/imm32
3457 b8/copy-to-eax 1/imm32/exit
3458 cd/syscall 0x80/imm8
3459
3460
3461 $populate-mu-function-header:error3:
3462
3463 (write-buffered Stderr "function input '")
3464 (write-buffered Stderr *eax)
3465 (write-buffered Stderr " must be in a register'")
3466 (flush Stderr)
3467 (rewind-stream *(ebp+8))
3468 (write-stream 2 *(ebp+8))
3469 (write-buffered Stderr "'\n")
3470 (flush Stderr)
3471
3472 bb/copy-to-ebx 1/imm32
3473 b8/copy-to-eax 1/imm32/exit
3474 cd/syscall 0x80/imm8
3475
3476
3477 test-function-header-with-arg:
3478
3479 55/push-ebp
3480 89/<- %ebp 4/r32/esp
3481
3482 (clear-stream _test-input-stream)
3483 (write _test-input-stream "foo n: int {\n")
3484
3485 2b/subtract *Function-size 4/r32/esp
3486 89/<- %ecx 4/r32/esp
3487 (zero-out %ecx *Function-size)
3488
3489 81 5/subop/subtract %esp 0x10/imm32
3490 68/push 0x10/imm32/size
3491 68/push 0/imm32/top
3492 89/<- %ebx 4/r32/esp
3493
3494 (populate-mu-function-header _test-input-stream %ecx %ebx)
3495
3496 (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name")
3497
3498 8b/-> *(ecx+8) 2/r32/edx
3499
3500 8b/-> *edx 3/r32/ebx
3501 (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0")
3502 8b/-> *(ebx+4) 3/r32/ebx
3503 (check-ints-equal *ebx 1 "F - test-function-header-with-arg/inout:0/type:0")
3504 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-arg/inout:0/type:1")
3505 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-arg/inout:0/type:2")
3506
3507 89/<- %esp 5/r32/ebp
3508 5d/pop-to-ebp
3509 c3/return
3510
3511 test-function-header-with-multiple-args:
3512
3513 55/push-ebp
3514 89/<- %ebp 4/r32/esp
3515
3516 (clear-stream _test-input-stream)
3517 (write _test-input-stream "foo a: int, b: int c: int {\n")
3518
3519 2b/subtract *Function-size 4/r32/esp
3520 89/<- %ecx 4/r32/esp
3521 (zero-out %ecx *Function-size)
3522
3523 81 5/subop/subtract %esp 0x10/imm32
3524 68/push 0x10/imm32/size
3525 68/push 0/imm32/top
3526 89/<- %ebx 4/r32/esp
3527
3528 (populate-mu-function-header _test-input-stream %ecx %ebx)
3529
3530 (check-strings-equal *ecx "foo")
3531
3532 8b/-> *(ecx+8) 2/r32/edx
3533 $test-function-header-with-multiple-args:inout0:
3534
3535 8b/-> *edx 3/r32/ebx
3536 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0")
3537 8b/-> *(ebx+4) 3/r32/ebx
3538 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:0/type:0")
3539 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1")
3540 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args/inout:0/type:2")
3541
3542 8b/-> *(edx+4) 2/r32/edx
3543 $test-function-header-with-multiple-args:inout1:
3544
3545 8b/-> *edx 3/r32/ebx
3546 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args/inout:1")
3547 8b/-> *(ebx+4) 3/r32/ebx
3548 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:1/type:0")
3549 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1")
3550 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args/inout:1/type:2")
3551
3552 8b/-> *(edx+4) 2/r32/edx
3553 $test-function-header-with-multiple-args:inout2:
3554
3555 8b/-> *edx 3/r32/ebx
3556 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args/inout:2")
3557 8b/-> *(ebx+4) 3/r32/ebx
3558 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args/inout:2/type:0")
3559 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1")
3560 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args/inout:2/type:2")
3561
3562 89/<- %esp 5/r32/ebp
3563 5d/pop-to-ebp
3564 c3/return
3565
3566 test-function-with-multiple-args-and-outputs:
3567
3568 55/push-ebp
3569 89/<- %ebp 4/r32/esp
3570
3571 (clear-stream _test-input-stream)
3572 (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n")
3573
3574 2b/subtract *Function-size 4/r32/esp
3575 89/<- %ecx 4/r32/esp
3576 (zero-out %ecx *Function-size)
3577
3578 81 5/subop/subtract %esp 0x10/imm32
3579 68/push 0x10/imm32/size
3580 68/push 0/imm32/top
3581 89/<- %ebx 4/r32/esp
3582
3583 (populate-mu-function-header _test-input-stream %ecx %ebx)
3584
3585 (check-strings-equal *ecx "foo")
3586
3587 8b/-> *(ecx+8) 2/r32/edx
3588
3589 8b/-> *edx 3/r32/ebx
3590 (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0")
3591 8b/-> *(ebx+4) 3/r32/ebx
3592 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0")
3593 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1")
3594 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2")
3595
3596 8b/-> *(edx+4) 2/r32/edx
3597
3598 8b/-> *edx 3/r32/ebx
3599 (check-strings-equal *ebx "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1")
3600 8b/-> *(ebx+4) 3/r32/ebx
3601 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0")
3602 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1")
3603 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2")
3604
3605 8b/-> *(edx+4) 2/r32/edx
3606
3607 8b/-> *edx 3/r32/ebx
3608 (check-strings-equal *ebx "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2")
3609 8b/-> *(ebx+4) 3/r32/ebx
3610 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0")
3611 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1")
3612 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2")
3613
3614 8b/-> *(ecx+0xc) 2/r32/edx
3615
3616 8b/-> *edx 3/r32/ebx
3617 (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0")
3618 (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3619 8b/-> *(ebx+4) 3/r32/ebx
3620 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0")
3621 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1")
3622 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2")
3623
3624 8b/-> *(edx+4) 2/r32/edx
3625
3626 8b/-> *edx 3/r32/ebx
3627 (check-strings-equal *ebx "y" "F - test-function-header-with-multiple-args-and-outputs/output:1")
3628 (check-strings-equal *(ebx+0x10) "edx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register")
3629 8b/-> *(ebx+4) 3/r32/ebx
3630 (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0")
3631 (check-ints-equal *(ebx+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1")
3632 (check-ints-equal *(ebx+8) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2")
3633
3634 89/<- %esp 5/r32/ebp
3635 5d/pop-to-ebp
3636 c3/return
3637
3638
3639
3640
3641
3642
3643
3644
3645 parse-var-with-type:
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663 55/push-ebp
3664 89/<- %ebp 4/r32/esp
3665
3666 51/push-ecx
3667 52/push-edx
3668 53/push-ebx
3669 56/push-esi
3670 57/push-edi
3671
3672 8b/-> *(ebp+8) 6/r32/esi
3673
3674 8b/-> *(esi+4) 1/r32/ecx
3675 49/decrement-ecx
3676 8a/copy-byte *ecx 1/r32/CL
3677 81 4/subop/and %ecx 0xff/imm32
3678 81 7/subop/compare %ecx 0x3a/imm32/colon
3679 0f 85/jump-if-!= $parse-var-with-type:abort/disp32
3680
3681 ff 1/subop/decrement *(esi+4)
3682
3683 68/push 0/imm32/end
3684 68/push 0/imm32/start
3685 89/<- %ecx 4/r32/esp
3686 $parse-var-with-type:parse-name:
3687 (next-token-from-slice *esi *(esi+4) 0x2f %ecx)
3688 $parse-var-with-type:create-var:
3689
3690 (new-var-from-slice Heap %ecx)
3691 89/<- %edi 0/r32/eax
3692
3693 $parse-var-with-type:save-register:
3694
3695 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx)
3696
3697 {
3698 $parse-var-with-type:write-register:
3699 (slice-empty? %ecx)
3700 3d/compare-eax-and 0/imm32/false
3701 75/jump-if-!= break/disp8
3702 (slice-to-string Heap %ecx)
3703 89/<- *(edi+0x10) 0/r32/eax
3704 }
3705 $parse-var-with-type:save-type:
3706 (parse-type Heap *(ebp+0xc))
3707
3708
3709
3710
3711 89/<- *(edi+4) 0/r32/eax
3712 $parse-var-with-type:end:
3713
3714 89/<- %eax 7/r32/edi
3715
3716 81 0/subop/add %esp 8/imm32
3717
3718 5f/pop-to-edi
3719 5e/pop-to-esi
3720 5b/pop-to-ebx
3721 5a/pop-to-edx
3722 59/pop-to-ecx
3723
3724 89/<- %esp 5/r32/ebp
3725 5d/pop-to-ebp
3726 c3/return
3727
3728 $parse-var-with-type:abort:
3729
3730 (write-buffered Stderr "var should have form 'name: type' in '")
3731 (flush Stderr)
3732 (rewind-stream *(ebp+0xc))
3733 (write-stream 2 *(ebp+0xc))
3734 (write-buffered Stderr "'\n")
3735 (flush Stderr)
3736
3737 bb/copy-to-ebx 1/imm32
3738 b8/copy-to-eax 1/imm32/exit
3739 cd/syscall 0x80/imm8
3740
3741
3742 parse-type:
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761 55/push-ebp
3762 89/<- %ebp 4/r32/esp
3763
3764 51/push-ecx
3765 52/push-edx
3766
3767 68/push 0/imm32
3768 68/push 0/imm32
3769 89/<- %ecx 4/r32/esp
3770
3771 (next-mu-token *(ebp+0xc) %ecx)
3772
3773
3774
3775
3776
3777 (slice-equal? %ecx "")
3778 3d/compare-eax-and 0/imm32/false
3779 0f 85/jump-if-!= $parse-type:abort/disp32
3780
3781 (slice-equal? %ecx "{")
3782 3d/compare-eax-and 0/imm32/false
3783 0f 85/jump-if-!= $parse-type:abort/disp32
3784
3785 (slice-equal? %ecx "}")
3786 3d/compare-eax-and 0/imm32/false
3787 0f 85/jump-if-!= $parse-type:abort/disp32
3788
3789 (slice-equal? %ecx "->")
3790 3d/compare-eax-and 0/imm32/false
3791 0f 85/jump-if-!= $parse-type:abort/disp32
3792
3793 (slice-equal? %ecx ")")
3794 3d/compare-eax-and 0/imm32/false
3795 b8/copy-to-eax 0/imm32
3796 0f 85/jump-if-!= $parse-type:end/disp32
3797
3798 (allocate *(ebp+8) *Tree-size)
3799 $aa-alloc:
3800 89/<- %edx 0/r32/eax
3801 {
3802
3803 (slice-equal? %ecx "(")
3804 3d/compare-eax-and 0/imm32/false
3805 75/jump-if-!= break/disp8
3806
3807 {
3808 $parse-type:int:
3809 (is-hex-int? %ecx)
3810 3d/compare-eax-and 0/imm32/false
3811 74/jump-if-= break/disp8
3812 (parse-hex-int-from-slice %ecx)
3813 89/<- *(edx+4) 0/r32/eax
3814 e9/jump $parse-type:return-edx/disp32
3815 }
3816 $parse-type:atom:
3817
3818 c7 0/subop/copy *edx 1/imm32/true
3819
3820 (pos-or-insert-slice Type-id %ecx)
3821
3822
3823
3824
3825 89/<- *(edx+4) 0/r32/eax
3826 e9/jump $parse-type:return-edx/disp32
3827 }
3828 $parse-type:non-atom:
3829
3830
3831 (parse-type *(ebp+8) *(ebp+0xc))
3832
3833
3834 89/<- *(edx+4) 0/r32/eax
3835
3836 (parse-type-tree *(ebp+8) *(ebp+0xc))
3837
3838
3839
3840
3841 89/<- *(edx+8) 0/r32/eax
3842 $parse-type:return-edx:
3843 89/<- %eax 2/r32/edx
3844 $parse-type:end:
3845
3846 81 0/subop/add %esp 8/imm32
3847
3848 5a/pop-to-edx
3849 59/pop-to-ecx
3850
3851 89/<- %esp 5/r32/ebp
3852 5d/pop-to-ebp
3853 c3/return
3854
3855 $parse-type:abort:
3856
3857 (write-buffered Stderr "unexpected token when parsing type: '")
3858 (write-slice-buffered Stderr %ecx)
3859 (write-buffered Stderr "'\n")
3860 (flush Stderr)
3861
3862 bb/copy-to-ebx 1/imm32
3863 b8/copy-to-eax 1/imm32/exit
3864 cd/syscall 0x80/imm8
3865
3866
3867 parse-type-tree:
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878 55/push-ebp
3879 89/<- %ebp 4/r32/esp
3880
3881 51/push-ecx
3882 52/push-edx
3883
3884 (parse-type *(ebp+8) *(ebp+0xc))
3885
3886 3d/compare-eax-and 0/imm32
3887 74/jump-if-= $parse-type-tree:end/disp8
3888
3889 89/<- %ecx 0/r32/eax
3890
3891 (allocate *(ebp+8) *Tree-size)
3892 89/<- %edx 0/r32/eax
3893
3894 89/<- *(edx+4) 1/r32/ecx
3895
3896 (parse-type-tree *(ebp+8) *(ebp+0xc))
3897 89/<- *(edx+8) 0/r32/eax
3898 $parse-type-tree:return-edx:
3899 89/<- %eax 2/r32/edx
3900 $parse-type-tree:end:
3901
3902 5a/pop-to-edx
3903 59/pop-to-ecx
3904
3905 89/<- %esp 5/r32/ebp
3906 5d/pop-to-ebp
3907 c3/return
3908
3909 next-mu-token:
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954 55/push-ebp
3955 89/<- %ebp 4/r32/esp
3956
3957 50/push-eax
3958 51/push-ecx
3959 56/push-esi
3960 57/push-edi
3961
3962 8b/-> *(ebp+8) 6/r32/esi
3963
3964 8b/-> *(ebp+0xc) 7/r32/edi
3965 $next-mu-token:start:
3966 (skip-chars-matching-whitespace %esi)
3967 $next-mu-token:check0:
3968
3969
3970 8b/-> *(esi+4) 1/r32/ecx
3971
3972 3b/compare<- *esi 1/r32/ecx
3973 c7 0/subop/copy *edi 0/imm32
3974 c7 0/subop/copy *(edi+4) 0/imm32
3975 0f 8d/jump-if->= $next-mu-token:end/disp32
3976
3977 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
3978 89/<- *edi 0/r32/eax
3979
3980 31/xor-with %eax 0/r32/eax
3981 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
3982 {
3983 $next-mu-token:check-for-comma:
3984
3985 3d/compare-eax-and 0x2c/imm32/comma
3986 75/jump-if-!= break/disp8
3987
3988 ff 0/subop/increment *(esi+4)
3989
3990 e9/jump $next-mu-token:start/disp32
3991 }
3992 {
3993 $next-mu-token:check-for-comment:
3994
3995 3d/compare-eax-and 0x23/imm32/pound
3996 75/jump-if-!= break/disp8
3997
3998 e9/jump $next-mu-token:done/disp32
3999 }
4000 {
4001 $next-mu-token:check-for-string-literal:
4002
4003 3d/compare-eax-and 0x22/imm32/dquote
4004 75/jump-if-!= break/disp8
4005 (skip-string %esi)
4006
4007 e9/jump $next-mu-token:done/disp32
4008 }
4009 {
4010 $next-mu-token:check-for-open-paren:
4011
4012 3d/compare-eax-and 0x28/imm32/open-paren
4013 75/jump-if-!= break/disp8
4014
4015 ff 0/subop/increment *(esi+4)
4016
4017 e9/jump $next-mu-token:done/disp32
4018 }
4019 {
4020 $next-mu-token:check-for-close-paren:
4021
4022 3d/compare-eax-and 0x29/imm32/close-paren
4023 75/jump-if-!= break/disp8
4024
4025 ff 0/subop/increment *(esi+4)
4026
4027 e9/jump $next-mu-token:done/disp32
4028 }
4029 {
4030 $next-mu-token:regular-word-without-metadata:
4031
4032
4033 8b/-> *(esi+4) 1/r32/ecx
4034
4035 3b/compare<- *esi 1/r32/ecx
4036 7d/jump-if->= break/disp8
4037
4038 31/xor-with %eax 0/r32/eax
4039 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
4040
4041 3d/compare-eax-and 0x20/imm32/space
4042 74/jump-if-= break/disp8
4043
4044 3d/compare-eax-and 0xd/imm32/carriage-return
4045 74/jump-if-= break/disp8
4046
4047 3d/compare-eax-and 0xa/imm32/newline
4048 74/jump-if-= break/disp8
4049
4050 3d/compare-eax-and 0x28/imm32/open-paren
4051 0f 84/jump-if-= break/disp32
4052
4053 3d/compare-eax-and 0x29/imm32/close-paren
4054 0f 84/jump-if-= break/disp32
4055
4056 3d/compare-eax-and 0x2c/imm32/comma
4057 0f 84/jump-if-= break/disp32
4058
4059 ff 0/subop/increment *(esi+4)
4060
4061 e9/jump loop/disp32
4062 }
4063 $next-mu-token:done:
4064
4065 8b/-> *(esi+4) 1/r32/ecx
4066 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
4067 89/<- *(edi+4) 0/r32/eax
4068 $next-mu-token:end:
4069
4070 5f/pop-to-edi
4071 5e/pop-to-esi
4072 59/pop-to-ecx
4073 58/pop-to-eax
4074
4075 89/<- %esp 5/r32/ebp
4076 5d/pop-to-ebp
4077 c3/return
4078
4079 pos-or-insert-slice:
4080
4081 55/push-ebp
4082 89/<- %ebp 4/r32/esp
4083
4084 (pos-slice *(ebp+8) *(ebp+0xc))
4085 3d/compare-eax-and -1/imm32
4086 75/jump-if-!= $pos-or-insert-slice:end/disp8
4087 $pos-or-insert-slice:insert:
4088 (slice-to-string Heap *(ebp+0xc))
4089 (write-int *(ebp+8) %eax)
4090 (pos-slice *(ebp+8) *(ebp+0xc))
4091 $pos-or-insert-slice:end:
4092
4093 89/<- %esp 5/r32/ebp
4094 5d/pop-to-ebp
4095 c3/return
4096
4097
4098
4099 pos-slice:
4100
4101 55/push-ebp
4102 89/<- %ebp 4/r32/esp
4103
4104 51/push-ecx
4105 52/push-edx
4106 53/push-ebx
4107 56/push-esi
4108
4109
4110
4111
4112
4113 8b/-> *(ebp+8) 6/r32/esi
4114
4115 b9/copy-to-ecx 0/imm32
4116
4117 8d/copy-address *(esi+0xc) 2/r32/edx
4118
4119 8b/-> *esi 3/r32/ebx
4120 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx
4121 {
4122
4123
4124
4125
4126
4127 39/compare %edx 3/r32/ebx
4128 b8/copy-to-eax -1/imm32
4129 73/jump-if-addr>= $pos-slice:end/disp8
4130
4131 (slice-equal? *(ebp+0xc) *edx)
4132 3d/compare-eax-and 0/imm32/false
4133 75/jump-if-!= break/disp8
4134
4135 41/increment-ecx
4136
4137 81 0/subop/add %edx 4/imm32
4138
4139 eb/jump loop/disp8
4140 }
4141
4142 89/<- %eax 1/r32/ecx
4143 $pos-slice:end:
4144
4145
4146
4147
4148 5e/pop-to-esi
4149 5b/pop-to-ebx
4150 5a/pop-to-edx
4151 59/pop-to-ecx
4152
4153 89/<- %esp 5/r32/ebp
4154 5d/pop-to-ebp
4155 c3/return
4156
4157 test-parse-var-with-type:
4158
4159 55/push-ebp
4160 89/<- %ebp 4/r32/esp
4161
4162 b8/copy-to-eax "x:"/imm32
4163 8b/-> *eax 1/r32/ecx
4164 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4165 05/add-to-eax 4/imm32
4166
4167 51/push-ecx
4168 50/push-eax
4169 89/<- %ecx 4/r32/esp
4170
4171 (clear-stream _test-input-stream)
4172 (write _test-input-stream "int")
4173
4174 (parse-var-with-type %ecx _test-input-stream)
4175 8b/-> *eax 2/r32/edx
4176 (check-strings-equal %edx "x" "F - test-parse-var-with-type/name")
4177 8b/-> *(eax+4) 2/r32/edx
4178 (check-ints-equal *edx 1 "F - test-parse-var-with-type/type:0")
4179 (check-ints-equal *(edx+4) 1 "F - test-parse-var-with-type/type:1")
4180 (check-ints-equal *(edx+8) 0 "F - test-parse-var-with-type/type:2")
4181
4182 89/<- %esp 5/r32/ebp
4183 5d/pop-to-ebp
4184 c3/return
4185
4186 test-parse-var-with-type-and-register:
4187
4188 55/push-ebp
4189 89/<- %ebp 4/r32/esp
4190
4191 b8/copy-to-eax "x/eax:"/imm32
4192 8b/-> *eax 1/r32/ecx
4193 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4194 05/add-to-eax 4/imm32
4195
4196 51/push-ecx
4197 50/push-eax
4198 89/<- %ecx 4/r32/esp
4199
4200 (clear-stream _test-input-stream)
4201 (write _test-input-stream "int")
4202
4203 (parse-var-with-type %ecx _test-input-stream)
4204 8b/-> *eax 2/r32/edx
4205 (check-strings-equal %edx "x" "F - test-parse-var-with-type-and-register/name")
4206 8b/-> *(eax+0x10) 2/r32/edx
4207 (check-strings-equal %edx "eax" "F - test-parse-var-with-type-and-register/register")
4208 8b/-> *(eax+4) 2/r32/edx
4209 (check-ints-equal *edx 1 "F - test-parse-var-with-type-and-register/type:0")
4210 (check-ints-equal *(edx+4) 1 "F - test-parse-var-with-type-and-register/type:1")
4211 (check-ints-equal *(edx+8) 0 "F - test-parse-var-with-type-and-register/type:2")
4212
4213 89/<- %esp 5/r32/ebp
4214 5d/pop-to-ebp
4215 c3/return
4216
4217 test-parse-var-with-trailing-characters:
4218
4219 55/push-ebp
4220 89/<- %ebp 4/r32/esp
4221
4222 b8/copy-to-eax "x:"/imm32
4223 8b/-> *eax 1/r32/ecx
4224 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4225 05/add-to-eax 4/imm32
4226
4227 51/push-ecx
4228 50/push-eax
4229 89/<- %ecx 4/r32/esp
4230
4231 (clear-stream _test-input-stream)
4232 (write _test-input-stream "int,")
4233
4234 (parse-var-with-type %ecx _test-input-stream)
4235 8b/-> *eax 2/r32/edx
4236 (check-strings-equal %edx "x" "F - test-parse-var-with-trailing-characters/name")
4237 8b/-> *(eax+0x10) 2/r32/edx
4238 (check-ints-equal %edx 0 "F - test-parse-var-with-trailing-characters/register")
4239 8b/-> *(eax+4) 2/r32/edx
4240 (check-ints-equal *edx 1 "F - test-parse-var-with-trailing-characters/type:0")
4241 (check-ints-equal *(edx+4) 1 "F - test-parse-var-with-trailing-characters/type:1")
4242 (check-ints-equal *(edx+8) 0 "F - test-parse-var-with-trailing-characters/type:1")
4243
4244 89/<- %esp 5/r32/ebp
4245 5d/pop-to-ebp
4246 c3/return
4247
4248 test-parse-var-with-register-and-trailing-characters:
4249
4250 55/push-ebp
4251 89/<- %ebp 4/r32/esp
4252
4253 b8/copy-to-eax "x/eax:"/imm32
4254 8b/-> *eax 1/r32/ecx
4255 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4256 05/add-to-eax 4/imm32
4257
4258 51/push-ecx
4259 50/push-eax
4260 89/<- %ecx 4/r32/esp
4261
4262 (clear-stream _test-input-stream)
4263 (write _test-input-stream "int,")
4264
4265 (parse-var-with-type %ecx _test-input-stream)
4266 8b/-> *eax 2/r32/edx
4267 (check-strings-equal %edx "x" "F - test-parse-var-with-register-and-trailing-characters/name")
4268 8b/-> *(eax+0x10) 2/r32/edx
4269 (check-strings-equal %edx "eax" "F - test-parse-var-with-register-and-trailing-characters/register")
4270 8b/-> *(eax+4) 2/r32/edx
4271 (check-ints-equal *edx 1 "F - test-parse-var-with-register-and-trailing-characters/type:0")
4272 (check-ints-equal *(edx+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1")
4273 (check-ints-equal *(edx+8) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2")
4274
4275 89/<- %esp 5/r32/ebp
4276 5d/pop-to-ebp
4277 c3/return
4278
4279 test-parse-var-with-compound-type:
4280
4281 55/push-ebp
4282 89/<- %ebp 4/r32/esp
4283
4284 b8/copy-to-eax "x:"/imm32
4285 8b/-> *eax 1/r32/ecx
4286 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4287 05/add-to-eax 4/imm32
4288
4289 51/push-ecx
4290 50/push-eax
4291 89/<- %ecx 4/r32/esp
4292
4293 (clear-stream _test-input-stream)
4294 (write _test-input-stream "(addr int)")
4295
4296 (parse-var-with-type %ecx _test-input-stream)
4297 8b/-> *eax 2/r32/edx
4298 (check-strings-equal %edx "x" "F - test-parse-var-with-compound-type/name")
4299 8b/-> *(eax+0x10) 2/r32/edx
4300 (check-ints-equal %edx 0 "F - test-parse-var-with-compound-type/register")
4301
4302 8b/-> *(eax+4) 2/r32/edx
4303
4304 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0")
4305
4306 8b/-> *(edx+4) 0/r32/eax
4307 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1")
4308 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2")
4309
4310 8b/-> *(edx+8) 2/r32/edx
4311 8b/-> *(edx+4) 0/r32/eax
4312 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3")
4313 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4")
4314
4315 (check-ints-equal *(edx+8) 0 "F - test-parse-var-with-compound-type/type:5")
4316
4317 89/<- %esp 5/r32/ebp
4318 5d/pop-to-ebp
4319 c3/return
4320
4321
4322
4323
4324 is-identifier?:
4325
4326 55/push-ebp
4327 89/<- %ebp 4/r32/esp
4328
4329 (slice-empty? *(ebp+8))
4330 3d/compare-eax-and 0/imm32/false
4331 75/jump-if-!= $is-identifier?:false/disp8
4332
4333 8b/-> *(ebp+8) 0/r32/eax
4334 8b/-> *eax 0/r32/eax
4335 8a/copy-byte *eax 0/r32/AL
4336 81 4/subop/and %eax 0xff/imm32
4337
4338 3d/compare-eax-and 0x24/imm32/$
4339 74/jump-if-= $is-identifier?:true/disp8
4340
4341 3d/compare-eax-and 0x5f/imm32/_
4342 74/jump-if-= $is-identifier?:true/disp8
4343
4344 25/and-eax-with 0x5f/imm32
4345
4346 3d/compare-eax-and 0x41/imm32/A
4347 7c/jump-if-< $is-identifier?:false/disp8
4348
4349 3d/compare-eax-and 0x5a/imm32/Z
4350 7f/jump-if-> $is-identifier?:false/disp8
4351
4352 $is-identifier?:true:
4353 b8/copy-to-eax 1/imm32/true
4354 eb/jump $is-identifier?:end/disp8
4355 $is-identifier?:false:
4356 b8/copy-to-eax 0/imm32/false
4357 $is-identifier?:end:
4358
4359 89/<- %esp 5/r32/ebp
4360 5d/pop-to-ebp
4361 c3/return
4362
4363 test-is-identifier-dollar:
4364
4365 55/push-ebp
4366 89/<- %ebp 4/r32/esp
4367
4368 b8/copy-to-eax "$a"/imm32
4369 8b/-> *eax 1/r32/ecx
4370 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4371 05/add-to-eax 4/imm32
4372
4373 51/push-ecx
4374 50/push-eax
4375 89/<- %ecx 4/r32/esp
4376
4377 (is-identifier? %ecx)
4378 (check-ints-equal %eax 1 "F - test-is-identifier-dollar")
4379
4380 89/<- %esp 5/r32/ebp
4381 5d/pop-to-ebp
4382 c3/return
4383
4384 test-is-identifier-underscore:
4385
4386 55/push-ebp
4387 89/<- %ebp 4/r32/esp
4388
4389 b8/copy-to-eax "_a"/imm32
4390 8b/-> *eax 1/r32/ecx
4391 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4392 05/add-to-eax 4/imm32
4393
4394 51/push-ecx
4395 50/push-eax
4396 89/<- %ecx 4/r32/esp
4397
4398 (is-identifier? %ecx)
4399 (check-ints-equal %eax 1 "F - test-is-identifier-underscore")
4400
4401 89/<- %esp 5/r32/ebp
4402 5d/pop-to-ebp
4403 c3/return
4404
4405 test-is-identifier-a:
4406
4407 55/push-ebp
4408 89/<- %ebp 4/r32/esp
4409
4410 b8/copy-to-eax "a$"/imm32
4411 8b/-> *eax 1/r32/ecx
4412 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4413 05/add-to-eax 4/imm32
4414
4415 51/push-ecx
4416 50/push-eax
4417 89/<- %ecx 4/r32/esp
4418
4419 (is-identifier? %ecx)
4420 (check-ints-equal %eax 1 "F - test-is-identifier-a")
4421
4422 89/<- %esp 5/r32/ebp
4423 5d/pop-to-ebp
4424 c3/return
4425
4426 test-is-identifier-z:
4427
4428 55/push-ebp
4429 89/<- %ebp 4/r32/esp
4430
4431 b8/copy-to-eax "z$"/imm32
4432 8b/-> *eax 1/r32/ecx
4433 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4434 05/add-to-eax 4/imm32
4435
4436 51/push-ecx
4437 50/push-eax
4438 89/<- %ecx 4/r32/esp
4439
4440 (is-identifier? %ecx)
4441 (check-ints-equal %eax 1 "F - test-is-identifier-z")
4442
4443 89/<- %esp 5/r32/ebp
4444 5d/pop-to-ebp
4445 c3/return
4446
4447 test-is-identifier-A:
4448
4449 55/push-ebp
4450 89/<- %ebp 4/r32/esp
4451
4452 b8/copy-to-eax "A$"/imm32
4453 8b/-> *eax 1/r32/ecx
4454 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4455 05/add-to-eax 4/imm32
4456
4457 51/push-ecx
4458 50/push-eax
4459 89/<- %ecx 4/r32/esp
4460
4461 (is-identifier? %ecx)
4462 (check-ints-equal %eax 1 "F - test-is-identifier-A")
4463
4464 89/<- %esp 5/r32/ebp
4465 5d/pop-to-ebp
4466 c3/return
4467
4468 test-is-identifier-Z:
4469
4470 55/push-ebp
4471 89/<- %ebp 4/r32/esp
4472
4473 b8/copy-to-eax "Z$"/imm32
4474 8b/-> *eax 1/r32/ecx
4475 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4476 05/add-to-eax 4/imm32
4477
4478 51/push-ecx
4479 50/push-eax
4480 89/<- %ecx 4/r32/esp
4481
4482 (is-identifier? %ecx)
4483 (check-ints-equal %eax 1 "F - test-is-identifier-Z")
4484
4485 89/<- %esp 5/r32/ebp
4486 5d/pop-to-ebp
4487 c3/return
4488
4489 test-is-identifier-@:
4490
4491
4492 55/push-ebp
4493 89/<- %ebp 4/r32/esp
4494
4495 b8/copy-to-eax "@a"/imm32
4496 8b/-> *eax 1/r32/ecx
4497 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4498 05/add-to-eax 4/imm32
4499
4500 51/push-ecx
4501 50/push-eax
4502 89/<- %ecx 4/r32/esp
4503
4504 (is-identifier? %ecx)
4505 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4506
4507 89/<- %esp 5/r32/ebp
4508 5d/pop-to-ebp
4509 c3/return
4510
4511 test-is-identifier-square-bracket:
4512
4513
4514 55/push-ebp
4515 89/<- %ebp 4/r32/esp
4516
4517 b8/copy-to-eax "[a"/imm32
4518 8b/-> *eax 1/r32/ecx
4519 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4520 05/add-to-eax 4/imm32
4521
4522 51/push-ecx
4523 50/push-eax
4524 89/<- %ecx 4/r32/esp
4525
4526 (is-identifier? %ecx)
4527 (check-ints-equal %eax 0 "F - test-is-identifier-@")
4528
4529 89/<- %esp 5/r32/ebp
4530 5d/pop-to-ebp
4531 c3/return
4532
4533 test-is-identifier-backtick:
4534
4535
4536 55/push-ebp
4537 89/<- %ebp 4/r32/esp
4538
4539 b8/copy-to-eax "`a"/imm32
4540 8b/-> *eax 1/r32/ecx
4541 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4542 05/add-to-eax 4/imm32
4543
4544 51/push-ecx
4545 50/push-eax
4546 89/<- %ecx 4/r32/esp
4547
4548 (is-identifier? %ecx)
4549 (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
4550
4551 89/<- %esp 5/r32/ebp
4552 5d/pop-to-ebp
4553 c3/return
4554
4555 test-is-identifier-curly-brace-open:
4556
4557
4558 55/push-ebp
4559 89/<- %ebp 4/r32/esp
4560
4561 b8/copy-to-eax "{a"/imm32
4562 8b/-> *eax 1/r32/ecx
4563 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4564 05/add-to-eax 4/imm32
4565
4566 51/push-ecx
4567 50/push-eax
4568 89/<- %ecx 4/r32/esp
4569
4570 (is-identifier? %ecx)
4571 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
4572
4573 89/<- %esp 5/r32/ebp
4574 5d/pop-to-ebp
4575 c3/return
4576
4577 test-is-identifier-curly-brace-close:
4578
4579 55/push-ebp
4580 89/<- %ebp 4/r32/esp
4581
4582 b8/copy-to-eax "}a"/imm32
4583 8b/-> *eax 1/r32/ecx
4584 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4585 05/add-to-eax 4/imm32
4586
4587 51/push-ecx
4588 50/push-eax
4589 89/<- %ecx 4/r32/esp
4590
4591 (is-identifier? %ecx)
4592 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
4593
4594 89/<- %esp 5/r32/ebp
4595 5d/pop-to-ebp
4596 c3/return
4597
4598 test-is-identifier-hyphen:
4599
4600
4601 55/push-ebp
4602 89/<- %ebp 4/r32/esp
4603
4604 b8/copy-to-eax "-a"/imm32
4605 8b/-> *eax 1/r32/ecx
4606 8d/copy-address *(eax+ecx+4) 1/r32/ecx
4607 05/add-to-eax 4/imm32
4608
4609 51/push-ecx
4610 50/push-eax
4611 89/<- %ecx 4/r32/esp
4612
4613 (is-identifier? %ecx)
4614 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
4615
4616 89/<- %esp 5/r32/ebp
4617 5d/pop-to-ebp
4618 c3/return
4619
4620 populate-mu-function-body:
4621
4622 55/push-ebp
4623 89/<- %ebp 4/r32/esp
4624
4625 50/push-eax
4626 56/push-esi
4627 57/push-edi
4628
4629 8b/-> *(ebp+8) 6/r32/esi
4630
4631 8b/-> *(ebp+0xc) 7/r32/edi
4632
4633 (parse-mu-block %esi *(ebp+0x10) %edi)
4634
4635 89/<- *(edi+0x10) 0/r32/eax
4636 $populate-mu-function-body:end:
4637
4638 5f/pop-to-edi
4639 5e/pop-to-esi
4640 58/pop-to-eax
4641
4642 89/<- %esp 5/r32/ebp
4643 5d/pop-to-ebp
4644 c3/return
4645
4646
4647 parse-mu-block:
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683 55/push-ebp
4684 89/<- %ebp 4/r32/esp
4685
4686 51/push-ecx
4687 52/push-edx
4688 53/push-ebx
4689 57/push-edi
4690
4691 81 5/subop/subtract %esp 0x200/imm32
4692 68/push 0x200/imm32/size
4693 68/push 0/imm32/read
4694 68/push 0/imm32/write
4695 89/<- %ecx 4/r32/esp
4696
4697 68/push 0/imm32/end
4698 68/push 0/imm32/start
4699 89/<- %edx 4/r32/esp
4700
4701 (allocate Heap *Stmt-size)
4702 89/<- %edi 0/r32/eax
4703
4704 c7 0/subop/copy *edi 0/imm32/block
4705
4706 (new-block-name *(ebp+0x10))
4707 89/<- *(edi+8) 0/r32/eax
4708
4709 (push *(ebp+0xc) %eax)
4710 {
4711 $parse-mu-block:line-loop:
4712
4713 (clear-stream %ecx)
4714 (read-line-buffered *(ebp+8) %ecx)
4715
4716
4717
4718
4719
4720 81 7/subop/compare *ecx 0/imm32
4721 0f 84/jump-if-= break/disp32
4722
4723 (next-mu-token %ecx %edx)
4724
4725
4726
4727
4728
4729 (slice-empty? %edx)
4730 3d/compare-eax-and 0/imm32/false
4731 0f 85/jump-if-!= loop/disp32
4732
4733
4734 8b/-> *edx 0/r32/eax
4735 8a/copy-byte *eax 0/r32/AL
4736 81 4/subop/and %eax 0xff/imm32
4737
4738 3d/compare-eax-and 0x23/imm32/hash
4739 0f 84/jump-if-= loop/disp32
4740
4741 {
4742 $parse-mu-block:check-for-block:
4743 (slice-equal? %edx "{")
4744 3d/compare-eax-and 0/imm32/false
4745 74/jump-if-= break/disp8
4746 (check-no-tokens-left %ecx)
4747
4748 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4749 (append-to-block Heap %edi %eax)
4750 e9/jump $parse-mu-block:line-loop/disp32
4751 }
4752
4753 $parse-mu-block:check-for-end:
4754 (slice-equal? %edx "}")
4755 3d/compare-eax-and 0/imm32/false
4756 0f 85/jump-if-!= break/disp32
4757
4758 {
4759 $parse-mu-block:check-for-named-block:
4760
4761 8b/-> *(edx+4) 0/r32/eax
4762 48/decrement-eax
4763 8a/copy-byte *eax 0/r32/AL
4764 81 4/subop/and %eax 0xff/imm32
4765
4766 3d/compare-eax-and 0x3a/imm32/colon
4767 0f 85/jump-if-!= break/disp32
4768
4769
4770
4771 ff 1/subop/decrement *(edx+4)
4772
4773 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10))
4774 (append-to-block Heap %edi %eax)
4775 e9/jump $parse-mu-block:line-loop/disp32
4776 }
4777
4778 {
4779 $parse-mu-block:check-for-var:
4780 (slice-equal? %edx "var")
4781 3d/compare-eax-and 0/imm32/false
4782 74/jump-if-= break/disp8
4783
4784 (parse-mu-var-def %ecx *(ebp+0xc))
4785 (append-to-block Heap %edi %eax)
4786 e9/jump $parse-mu-block:line-loop/disp32
4787 }
4788 $parse-mu-block:regular-stmt:
4789
4790 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10))
4791 (append-to-block Heap %edi %eax)
4792 e9/jump loop/disp32
4793 }
4794
4795 (pop *(ebp+0xc))
4796
4797 89/<- %eax 7/r32/edi
4798 $parse-mu-block:end:
4799
4800 81 0/subop/add %esp 0x214/imm32
4801
4802 5f/pop-to-edi
4803 5b/pop-to-ebx
4804 5a/pop-to-edx
4805 59/pop-to-ecx
4806
4807 89/<- %esp 5/r32/ebp
4808 5d/pop-to-ebp
4809 c3/return
4810
4811 $parse-mu-block:abort:
4812
4813 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4814 (rewind-stream %ecx)
4815 (write-stream 2 %ecx)
4816 (write-buffered Stderr "'\n")
4817 (flush Stderr)
4818
4819 bb/copy-to-ebx 1/imm32
4820 b8/copy-to-eax 1/imm32/exit
4821 cd/syscall 0x80/imm8
4822
4823
4824 new-block-name:
4825
4826 55/push-ebp
4827 89/<- %ebp 4/r32/esp
4828
4829 51/push-ecx
4830 52/push-edx
4831
4832 8b/-> *(ebp+8) 0/r32/eax
4833 8b/-> *eax 0/r32/eax
4834 8b/-> *eax 0/r32/eax
4835 05/add-to-eax 0xd/imm32
4836 89/<- %ecx 0/r32/eax
4837
4838 29/subtract-from %esp 1/r32/ecx
4839 ff 6/subop/push %ecx
4840 68/push 0/imm32/read
4841 68/push 0/imm32/write
4842 89/<- %edx 4/r32/esp
4843 (clear-stream %edx)
4844
4845 8b/-> *(ebp+8) 0/r32/eax
4846 8b/-> *eax 0/r32/eax
4847
4848 (write %edx "$")
4849 (write %edx %eax)
4850 (write %edx ":")
4851 (print-int32 %edx *Next-block-index)
4852 ff 0/subop/increment *Next-block-index
4853
4854
4855 8b/-> *edx 0/r32/eax
4856
4857 8d/copy-address *(edx+0xc) 2/r32/edx
4858
4859 01/add-to %eax 2/r32/edx
4860
4861 ff 6/subop/push %eax
4862 ff 6/subop/push %edx
4863 89/<- %eax 4/r32/esp
4864
4865 (new-literal Heap %eax)
4866 $new-block-name:end:
4867
4868 81 0/subop/add %ecx 0xc/imm32
4869 81 0/subop/add %ecx 8/imm32
4870 01/add-to %esp 1/r32/ecx
4871
4872 5a/pop-to-edx
4873 59/pop-to-ecx
4874
4875 89/<- %esp 5/r32/ebp
4876 5d/pop-to-ebp
4877 c3/return
4878
4879 == data
4880
4881
4882 Next-block-index:
4883 1/imm32
4884
4885 == code
4886
4887 check-no-tokens-left:
4888
4889 55/push-ebp
4890 89/<- %ebp 4/r32/esp
4891
4892 50/push-eax
4893 51/push-ecx
4894
4895 68/push 0/imm32/end
4896 68/push 0/imm32/start
4897 89/<- %ecx 4/r32/esp
4898
4899 (next-mu-token *(ebp+8) %ecx)
4900
4901 (slice-empty? %ecx)
4902 3d/compare-eax-and 0/imm32/false
4903 75/jump-if-!= $check-no-tokens-left:end/disp8
4904
4905
4906 8b/-> *edx 0/r32/eax
4907 8a/copy-byte *eax 0/r32/AL
4908 81 4/subop/and %eax 0xff/imm32
4909
4910 3d/compare-eax-and 0x23/imm32/hash
4911 74/jump-if-= $check-no-tokens-left:end/disp8
4912
4913 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
4914 (rewind-stream %ecx)
4915 (write-stream 2 %ecx)
4916 (write-buffered Stderr "'\n")
4917 (flush Stderr)
4918
4919 bb/copy-to-ebx 1/imm32
4920 b8/copy-to-eax 1/imm32/exit
4921 cd/syscall 0x80/imm8
4922
4923 $check-no-tokens-left:end:
4924
4925 81 0/subop/add %esp 8/imm32
4926
4927 59/pop-to-ecx
4928 58/pop-to-eax
4929
4930 89/<- %esp 5/r32/ebp
4931 5d/pop-to-ebp
4932 c3/return
4933
4934 parse-mu-named-block:
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944 55/push-ebp
4945 89/<- %ebp 4/r32/esp
4946
4947 51/push-ecx
4948
4949 (new-literal Heap *(ebp+8))
4950 89/<- %ecx 0/r32/eax
4951
4952 (push *(ebp+0x10) %ecx)
4953
4954 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14))
4955
4956 50/push-eax
4957 (pop *(ebp+0x10))
4958 58/pop-to-eax
4959
4960 c7 0/subop/copy *eax 0/imm32/block
4961
4962 89/<- *(eax+8) 1/r32/ecx
4963 $parse-mu-named-block:end:
4964
4965 59/pop-to-ecx
4966
4967 89/<- %esp 5/r32/ebp
4968 5d/pop-to-ebp
4969 c3/return
4970
4971 parse-mu-var-def:
4972
4973 55/push-ebp
4974 89/<- %ebp 4/r32/esp
4975
4976 51/push-ecx
4977 52/push-edx
4978
4979 68/push 0/imm32/end
4980 68/push 0/imm32/start
4981 89/<- %ecx 4/r32/esp
4982
4983 (next-mu-token *(ebp+8) %ecx)
4984 (parse-var-with-type %ecx *(ebp+8))
4985 89/<- %edx 0/r32/eax
4986
4987 (push *(ebp+0xc) %edx)
4988
4989 8b/-> *(edx+0x10) 0/r32/eax
4990 3d/compare-eax-and 0/imm32
4991 {
4992 75/jump-if-!= break/disp8
4993
4994 (new-var-def Heap %edx)
4995 eb/jump $parse-mu-var-def:end/disp8
4996 }
4997
4998 {
4999 74/jump-if-= break/disp8
5000
5001 (next-mu-token *(ebp+8) %ecx)
5002 (slice-equal? %ecx "<-")
5003 3d/compare-eax-and 0/imm32/false
5004 74/jump-if-= $parse-mu-var-def:abort/disp8
5005
5006 (new-reg-var-def Heap %edx)
5007 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc))
5008 }
5009 $parse-mu-var-def:end:
5010
5011 81 0/subop/add %esp 8/imm32
5012
5013 5a/pop-to-edx
5014 59/pop-to-ecx
5015
5016 89/<- %esp 5/r32/ebp
5017 5d/pop-to-ebp
5018 c3/return
5019
5020 $parse-mu-var-def:abort:
5021 (rewind-stream *(ebp+8))
5022
5023 (write-buffered Stderr "register variable requires a valid instruction to initialize but got '")
5024 (flush Stderr)
5025 (write-stream 2 *(ebp+8))
5026 (write-buffered Stderr "'\n")
5027 (flush Stderr)
5028
5029 bb/copy-to-ebx 1/imm32
5030 b8/copy-to-eax 1/imm32/exit
5031 cd/syscall 0x80/imm8
5032
5033
5034 test-parse-mu-var-def:
5035
5036
5037 55/push-ebp
5038 89/<- %ebp 4/r32/esp
5039
5040 (clear-stream _test-input-stream)
5041 (write _test-input-stream "n: int\n")
5042
5043 81 5/subop/subtract %esp 0x10/imm32
5044 68/push 0x10/imm32/size
5045 68/push 0/imm32/top
5046 89/<- %ecx 4/r32/esp
5047 (clear-stack %ecx)
5048
5049 (parse-mu-var-def _test-input-stream %ecx)
5050
5051 (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")
5052 8b/-> *(eax+4) 0/r32/eax
5053 (check-strings-equal *eax "n" "F - test-parse-mu-var-def/var-name")
5054 (check-ints-equal *(eax+0x10) 0 "F - test-parse-mu-var-def/var-register")
5055
5056 8b/-> *(eax+4) 0/r32/eax
5057 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0")
5058 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1")
5059 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-var-def/var-type:2")
5060
5061 89/<- %esp 5/r32/ebp
5062 5d/pop-to-ebp
5063 c3/return
5064
5065 test-parse-mu-reg-var-def:
5066
5067
5068 55/push-ebp
5069 89/<- %ebp 4/r32/esp
5070
5071 (clear-stream _test-input-stream)
5072 (write _test-input-stream "n/eax: int <- copy 0\n")
5073
5074 81 5/subop/subtract %esp 0x10/imm32
5075 68/push 0x10/imm32/size
5076 68/push 0/imm32/top
5077 89/<- %ecx 4/r32/esp
5078 (clear-stack %ecx)
5079
5080 (parse-mu-var-def _test-input-stream %ecx)
5081
5082 (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")
5083 8b/-> *(eax+0xc) 0/r32/eax
5084 (check-ints-equal *(eax+4) 0 "F - test-parse-mu-reg-var-def/single-output")
5085 8b/-> *eax 0/r32/eax
5086 (check-strings-equal *eax "n" "F - test-parse-mu-reg-var-def/output-name")
5087 (check-strings-equal *(eax+0x10) "eax" "F - test-parse-mu-reg-var-def/output-register")
5088
5089 8b/-> *(eax+4) 0/r32/eax
5090 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/var-type:0")
5091 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:0")
5092 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/output-type:0")
5093
5094 89/<- %esp 5/r32/ebp
5095 5d/pop-to-ebp
5096 c3/return
5097
5098 parse-mu-stmt:
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112 55/push-ebp
5113 89/<- %ebp 4/r32/esp
5114
5115 51/push-ecx
5116 52/push-edx
5117 57/push-edi
5118
5119 68/push 0/imm32/end
5120 68/push 0/imm32/start
5121 89/<- %ecx 4/r32/esp
5122
5123 ba/copy-to-edx 0/imm32/false
5124
5125 (allocate Heap *Stmt-size)
5126 89/<- %edi 0/r32/eax
5127
5128 c7 0/subop/copy *edi 1/imm32/stmt1
5129 {
5130 (stmt-has-outputs? *(ebp+8))
5131 3d/compare-eax-and 0/imm32/false
5132 0f 84/jump-if-= break/disp32
5133 {
5134 $parse-mu-stmt:read-outputs:
5135
5136 (next-mu-token *(ebp+8) %ecx)
5137
5138 (slice-empty? %ecx)
5139 3d/compare-eax-and 0/imm32/false
5140 0f 85/jump-if-!= break/disp32
5141
5142 (slice-equal? %ecx "<-")
5143 3d/compare-eax-and 0/imm32/false
5144 0f 85/jump-if-!= break/disp32
5145
5146 ba/copy-to-edx 0/imm32/false
5147
5148 8b/-> *ecx 0/r32/eax
5149 8a/copy-byte *eax 0/r32/AL
5150 81 4/subop/and %eax 0xff/imm32
5151 3d/compare-eax-and 0x2a/imm32/asterisk
5152 {
5153 75/jump-if-!= break/disp8
5154 ff 0/subop/increment *ecx
5155 ba/copy-to-edx 1/imm32/true
5156 }
5157
5158 (is-identifier? %ecx)
5159 3d/compare-eax-and 0/imm32/false
5160 0f 84/jump-if-= $parse-mu-stmt:abort/disp32
5161
5162 (lookup-or-define-var %ecx *(ebp+0xc) *(ebp+0x10))
5163 (append-stmt-var Heap %eax *(edi+0xc) %edx)
5164 89/<- *(edi+0xc) 0/r32/eax
5165 e9/jump loop/disp32
5166 }
5167 }
5168 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc))
5169 $parse-mu-stmt:end:
5170
5171 89/<- %eax 7/r32/edi
5172
5173 81 0/subop/add %esp 8/imm32
5174
5175 5f/pop-to-edi
5176 5a/pop-to-edx
5177 59/pop-to-ecx
5178
5179 89/<- %esp 5/r32/ebp
5180 5d/pop-to-ebp
5181 c3/return
5182
5183 $parse-mu-stmt:abort:
5184
5185 (write-buffered Stderr "invalid identifier '")
5186 (write-slice-buffered Stderr %ecx)
5187 (write-buffered Stderr "'\n")
5188 (flush Stderr)
5189
5190 bb/copy-to-ebx 1/imm32
5191 b8/copy-to-eax 1/imm32/exit
5192 cd/syscall 0x80/imm8
5193
5194
5195 add-operation-and-inputs-to-stmt:
5196
5197
5198
5199
5200
5201
5202
5203
5204 55/push-ebp
5205 89/<- %ebp 4/r32/esp
5206
5207 50/push-eax
5208 51/push-ecx
5209 52/push-edx
5210 53/push-ebx
5211 57/push-edi
5212
5213 8b/-> *(ebp+8) 7/r32/edi
5214
5215 68/push 0/imm32/end
5216 68/push 0/imm32/start
5217 89/<- %ecx 4/r32/esp
5218
5219 ba/copy-to-edx 0/imm32/false
5220 $add-operation-and-inputs-to-stmt:read-operation:
5221 (next-mu-token *(ebp+0xc) %ecx)
5222 (slice-to-string Heap %ecx)
5223 89/<- *(edi+4) 0/r32/eax
5224
5225 (slice-equal? %ecx "get")
5226 89/<- %ebx 0/r32/eax
5227 {
5228 $add-operation-and-inputs-to-stmt:read-inouts:
5229
5230 (next-mu-token *(ebp+0xc) %ecx)
5231
5232 (slice-empty? %ecx)
5233 3d/compare-eax-and 0/imm32/false
5234 0f 85/jump-if-!= break/disp32
5235
5236 (slice-equal? %ecx "<-")
5237 3d/compare-eax-and 0/imm32/false
5238 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32
5239
5240 {
5241 81 7/subop/compare %ebx 0/imm32/false
5242 74/jump-if-= break/disp8
5243 81 7/subop/compare *(edi+8) 0/imm32
5244 74/jump-if-= break/disp8
5245 (lookup-or-create-constant *(edi+8) %ecx)
5246
5247
5248
5249
5250
5251
5252 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32
5253 }
5254
5255 ba/copy-to-edx 0/imm32/false
5256
5257 8b/-> *ecx 0/r32/eax
5258 8a/copy-byte *eax 0/r32/AL
5259 81 4/subop/and %eax 0xff/imm32
5260 3d/compare-eax-and 0x2a/imm32/asterisk
5261 {
5262 75/jump-if-!= break/disp8
5263 $add-operation-and-inputs-to-stmt:inout-is-deref:
5264 ff 0/subop/increment *ecx
5265 ba/copy-to-edx 1/imm32/true
5266 }
5267 (lookup-var-or-literal %ecx *(ebp+0x10))
5268 $add-operation-and-inputs-to-stmt:save-var:
5269 (append-stmt-var Heap %eax *(edi+8) %edx)
5270 89/<- *(edi+8) 0/r32/eax
5271 e9/jump loop/disp32
5272 }
5273 $add-operation-and-inputs-to-stmt:end:
5274
5275 81 0/subop/add %esp 8/imm32
5276
5277 5f/pop-to-edi
5278 5b/pop-to-ebx
5279 5a/pop-to-edx
5280 59/pop-to-ecx
5281 58/pop-to-eax
5282
5283 89/<- %esp 5/r32/ebp
5284 5d/pop-to-ebp
5285 c3/return
5286
5287 $add-operation-and-inputs-to-stmt:abort:
5288
5289 (rewind-stream *(ebp+8))
5290 (write-buffered Stderr "invalid identifier '")
5291 (flush Stderr)
5292 (write-stream 2 *(ebp+8))
5293 (write-buffered Stderr "'\n")
5294 (flush Stderr)
5295
5296 bb/copy-to-ebx 1/imm32
5297 b8/copy-to-eax 1/imm32/exit
5298 cd/syscall 0x80/imm8
5299
5300
5301 stmt-has-outputs?:
5302
5303 55/push-ebp
5304 89/<- %ebp 4/r32/esp
5305
5306 51/push-ecx
5307
5308 68/push 0/imm32/end
5309 68/push 0/imm32/start
5310 89/<- %ecx 4/r32/esp
5311
5312 b8/copy-to-eax 0/imm32/false
5313 (rewind-stream *(ebp+8))
5314 {
5315 (next-mu-token *(ebp+8) %ecx)
5316
5317 (slice-empty? %ecx)
5318 3d/compare-eax-and 0/imm32/false
5319 b8/copy-to-eax 0/imm32/false/result
5320 0f 85/jump-if-!= break/disp32
5321
5322
5323 8b/-> *ecx 0/r32/eax
5324 8a/copy-byte *eax 0/r32/AL
5325 81 4/subop/and %eax 0xff/imm32
5326
5327 3d/compare-eax-and 0x23/imm32/hash
5328 b8/copy-to-eax 0/imm32/false/result
5329 0f 84/jump-if-= break/disp32
5330
5331 (slice-equal? %ecx "<-")
5332 3d/compare-eax-and 0/imm32/false
5333 74/jump-if-= loop/disp8
5334 b8/copy-to-eax 1/imm32/true
5335 }
5336 $stmt-has-outputs:end:
5337 (rewind-stream *(ebp+8))
5338
5339 81 0/subop/add %esp 8/imm32
5340
5341 59/pop-to-ecx
5342
5343 89/<- %esp 5/r32/ebp
5344 5d/pop-to-ebp
5345 c3/return
5346
5347
5348
5349 lookup-var-or-literal:
5350
5351 55/push-ebp
5352 89/<- %ebp 4/r32/esp
5353
5354 51/push-ecx
5355 56/push-esi
5356
5357 8b/-> *(ebp+8) 6/r32/esi
5358
5359 (slice-empty? %esi)
5360 3d/compare-eax-and 0/imm32/false
5361 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32
5362
5363 8b/-> *esi 1/r32/ecx
5364 8a/copy-byte *ecx 1/r32/CL
5365 81 4/subop/and %ecx 0xff/imm32
5366
5367 {
5368 (is-decimal-digit? %ecx)
5369 3d/compare-eax-and 0/imm32/false
5370 74/jump-if-= break/disp8
5371 (new-literal-integer Heap %esi)
5372 eb/jump $lookup-var-or-literal:end/disp8
5373 }
5374
5375 {
5376 81 7/subop/compare %ecx 0x22/imm32/dquote
5377 75/jump-if-!= break/disp8
5378 (new-literal Heap %esi)
5379 eb/jump $lookup-var-or-literal:end/disp8
5380 }
5381
5382 {
5383 (lookup-var %esi *(ebp+0xc))
5384 }
5385 $lookup-var-or-literal:end:
5386
5387 5e/pop-to-esi
5388 59/pop-to-ecx
5389
5390 89/<- %esp 5/r32/ebp
5391 5d/pop-to-ebp
5392 c3/return
5393
5394 $lookup-var-or-literal:abort:
5395 (write-buffered Stderr "empty variable!")
5396 (flush Stderr)
5397
5398 bb/copy-to-ebx 1/imm32
5399 b8/copy-to-eax 1/imm32/exit
5400 cd/syscall 0x80/imm8
5401
5402
5403
5404 lookup-var:
5405
5406 55/push-ebp
5407 89/<- %ebp 4/r32/esp
5408
5409 (slice-to-string Heap *(ebp+8))
5410
5411 (lookup-var-helper %eax *(ebp+0xc))
5412
5413 3d/compare-eax-and 0/imm32
5414 74/jump-if-= $lookup-var:abort/disp8
5415 $lookup-var:end:
5416
5417 89/<- %esp 5/r32/ebp
5418 5d/pop-to-ebp
5419 c3/return
5420
5421 $lookup-var:abort:
5422 (write-buffered Stderr "unknown variable '")
5423 (write-slice-buffered Stderr *(ebp+8))
5424 (write-buffered Stderr "'\n")
5425 (flush Stderr)
5426
5427 bb/copy-to-ebx 1/imm32
5428 b8/copy-to-eax 1/imm32/exit
5429 cd/syscall 0x80/imm8
5430
5431
5432
5433 lookup-var-helper:
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444 55/push-ebp
5445 89/<- %ebp 4/r32/esp
5446
5447 52/push-edx
5448 53/push-ebx
5449 56/push-esi
5450
5451 8b/-> *(ebp+0xc) 6/r32/esi
5452
5453 8b/-> *esi 3/r32/ebx
5454
5455 3b/compare<- *(esi+4) 0/r32/eax
5456 0f 8f/jump-if-> $lookup-var-helper:error1/disp32
5457
5458 8d/copy-address *(esi+8) 2/r32/edx
5459
5460 81 5/subop/subtract %ebx 4/imm32
5461 8d/copy-address *(esi+ebx+8) 3/r32/ebx
5462 {
5463
5464 39/compare %ebx 2/r32/edx
5465 b8/copy-to-eax 0/imm32
5466 0f 82/jump-if-addr< break/disp32
5467
5468 8b/-> *ebx 0/r32/eax
5469
5470 (string-equal? *eax *(ebp+8))
5471 3d/compare-eax-and 0/imm32/false
5472 8b/-> *ebx 0/r32/eax
5473 75/jump-if-!= break/disp8
5474
5475 81 5/subop/subtract %ebx 4/imm32
5476 e9/jump loop/disp32
5477 }
5478 $lookup-var-helper:end:
5479
5480 5e/pop-to-esi
5481 5b/pop-to-ebx
5482 5a/pop-to-edx
5483
5484 89/<- %esp 5/r32/ebp
5485 5d/pop-to-ebp
5486 c3/return
5487
5488 $lookup-var-helper:error1:
5489 (write-buffered Stderr "malformed stack when looking up '")
5490 (write-slice-buffered Stderr *(ebp+8))
5491 (write-buffered Stderr "'\n")
5492 (flush Stderr)
5493
5494 bb/copy-to-ebx 1/imm32
5495 b8/copy-to-eax 1/imm32/exit
5496 cd/syscall 0x80/imm8
5497
5498
5499
5500 lookup-or-define-var:
5501
5502 55/push-ebp
5503 89/<- %ebp 4/r32/esp
5504
5505 51/push-ecx
5506
5507 (slice-to-string Heap *(ebp+8))
5508 89/<- %ecx 0/r32/eax
5509
5510 (lookup-var-helper %ecx *(ebp+0xc))
5511 {
5512
5513 3d/compare-eax-and 0/imm32
5514 75/jump-if-!= break/disp8
5515
5516 {
5517 (find-in-function-outputs *(ebp+0x10) %ecx)
5518 3d/compare-eax-and 0/imm32
5519
5520 0f 84/jump-if-!= $lookup-var:abort/disp32
5521 }
5522 }
5523 $lookup-or-define-var:end:
5524
5525 59/pop-to-ecx
5526
5527 89/<- %esp 5/r32/ebp
5528 5d/pop-to-ebp
5529 c3/return
5530
5531 find-in-function-outputs:
5532
5533 55/push-ebp
5534 89/<- %ebp 4/r32/esp
5535
5536 51/push-ecx
5537
5538 8b/-> *(ebp+8) 1/r32/ecx
5539 8b/-> *(ecx+0xc) 1/r32/ecx
5540
5541 {
5542 81 7/subop/compare %ecx 0/imm32
5543 74/jump-if-= break/disp8
5544
5545 8b/-> *ecx 0/r32/eax
5546
5547 50/push-eax
5548 (string-equal? *eax *(ebp+0xc))
5549 3d/compare-eax-and 0/imm32/false
5550 58/pop-to-eax
5551 75/jump-if-!= $find-in-function-outputs:end/disp8
5552
5553 8b/-> *(ecx+4) 1/r32/ecx
5554 eb/jump loop/disp8
5555 }
5556 b8/copy-to-eax 0/imm32
5557 $find-in-function-outputs:end:
5558
5559 59/pop-to-ecx
5560
5561 89/<- %esp 5/r32/ebp
5562 5d/pop-to-ebp
5563 c3/return
5564
5565 test-parse-mu-stmt:
5566
5567 55/push-ebp
5568 89/<- %ebp 4/r32/esp
5569
5570 (clear-stream _test-input-stream)
5571 (write _test-input-stream "increment n\n")
5572
5573 81 5/subop/subtract %esp 0x10/imm32
5574 68/push 0x10/imm32/size
5575 68/push 0/imm32/top
5576 89/<- %ecx 4/r32/esp
5577 (clear-stack %ecx)
5578
5579 81 5/subop/subtract %esp 0x14/imm32
5580 89/<- %edx 4/r32/esp
5581 (zero-out %edx 0x14)
5582
5583 c7 0/subop/copy *edx "n"/imm32
5584
5585 (push %ecx %edx)
5586
5587 (parse-mu-stmt _test-input-stream %ecx)
5588
5589 (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag")
5590 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name")
5591
5592 8b/-> *(eax+8) 2/r32/edx
5593
5594 8b/-> *edx 3/r32/ebx
5595 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0")
5596
5597 89/<- %esp 5/r32/ebp
5598 5d/pop-to-ebp
5599 c3/return
5600
5601 test-parse-mu-stmt-with-comma:
5602
5603 55/push-ebp
5604 89/<- %ebp 4/r32/esp
5605
5606 (clear-stream _test-input-stream)
5607 (write _test-input-stream "copy-to n, 3\n")
5608
5609 81 5/subop/subtract %esp 0x10/imm32
5610 68/push 0x10/imm32/size
5611 68/push 0/imm32/top
5612 89/<- %ecx 4/r32/esp
5613 (clear-stack %ecx)
5614
5615 81 5/subop/subtract %esp 0x14/imm32
5616 89/<- %edx 4/r32/esp
5617 (zero-out %edx 0x14)
5618
5619 c7 0/subop/copy *edx "n"/imm32
5620
5621 (push %ecx %edx)
5622
5623 (parse-mu-stmt _test-input-stream %ecx)
5624
5625 (check-ints-equal *eax 1 "F - test-parse-mu-stmt-with-comma/tag")
5626 (check-strings-equal *(eax+4) "copy-to" "F - test-parse-mu-stmt-with-comma/name")
5627
5628 8b/-> *(eax+8) 2/r32/edx
5629
5630 8b/-> *edx 3/r32/ebx
5631 (check-strings-equal *ebx "n" "F - test-parse-mu-stmt-with-comma/inout:0")
5632
5633 89/<- %esp 5/r32/ebp
5634 5d/pop-to-ebp
5635 c3/return
5636
5637 new-var:
5638
5639 55/push-ebp
5640 89/<- %ebp 4/r32/esp
5641
5642 51/push-ecx
5643
5644 (allocate *(ebp+8) *Var-size)
5645 8b/-> *(ebp+0xc) 1/r32/ecx
5646 89/<- *eax 1/r32/ecx
5647 $new-var:end:
5648
5649 59/pop-to-ecx
5650
5651 89/<- %esp 5/r32/ebp
5652 5d/pop-to-ebp
5653 c3/return
5654
5655 new-literal-integer:
5656
5657 55/push-ebp
5658 89/<- %ebp 4/r32/esp
5659
5660 51/push-ecx
5661
5662 (is-hex-int? *(ebp+0xc))
5663 3d/compare-eax-and 0/imm32/false
5664 0f 84/jump-if-= $new-literal-integer:abort/disp32
5665
5666 (allocate *(ebp+8) *Tree-size)
5667
5668 c7 0/subop/copy *eax 1/imm32/true
5669 89/<- %ecx 0/r32/eax
5670
5671 (new-var-from-slice *(ebp+8) *(ebp+0xc))
5672 89/<- *(eax+4) 1/r32/ecx
5673 $new-literal-integer:end:
5674
5675 59/pop-to-ecx
5676
5677 89/<- %esp 5/r32/ebp
5678 5d/pop-to-ebp
5679 c3/return
5680
5681 $new-literal-integer:abort:
5682 (write-buffered Stderr "variable cannot begin with a digit '")
5683 (write-slice-buffered Stderr *(ebp+0xc))
5684 (write-buffered Stderr "'\n")
5685 (flush Stderr)
5686
5687 bb/copy-to-ebx 1/imm32
5688 b8/copy-to-eax 1/imm32/exit
5689 cd/syscall 0x80/imm8
5690
5691
5692 new-literal:
5693
5694 55/push-ebp
5695 89/<- %ebp 4/r32/esp
5696
5697 51/push-ecx
5698 52/push-edx
5699
5700 (slice-to-string Heap *(ebp+0xc))
5701 89/<- %ecx 0/r32/eax
5702
5703 (allocate *(ebp+8) *Tree-size)
5704
5705 c7 0/subop/copy *eax 1/imm32/true
5706 89/<- %edx 0/r32/eax
5707
5708 (new-var *(ebp+8) %ecx)
5709
5710 89/<- *(eax+4) 2/r32/edx
5711 $new-literal:end:
5712
5713 5a/pop-to-edx
5714 59/pop-to-ecx
5715
5716 89/<- %esp 5/r32/ebp
5717 5d/pop-to-ebp
5718 c3/return
5719
5720 new-var-from-slice:
5721
5722 55/push-ebp
5723 89/<- %ebp 4/r32/esp
5724
5725 51/push-ecx
5726
5727 (slice-to-string Heap *(ebp+0xc))
5728 (new-var *(ebp+8) %eax)
5729 $new-var-from-slice:end:
5730
5731 59/pop-to-ecx
5732
5733 89/<- %esp 5/r32/ebp
5734 5d/pop-to-ebp
5735 c3/return
5736
5737 new-block:
5738
5739 55/push-ebp
5740 89/<- %ebp 4/r32/esp
5741
5742 51/push-ecx
5743
5744 (allocate *(ebp+8) *Stmt-size)
5745 c7 0/subop/copy *eax 0/imm32/tag/block
5746 8b/-> *(ebp+0xc) 1/r32/ecx
5747 89/<- *(eax+4) 1/r32/ecx
5748 $new-block:end:
5749
5750 59/pop-to-ecx
5751
5752 89/<- %esp 5/r32/ebp
5753 5d/pop-to-ebp
5754 c3/return
5755
5756 new-var-def:
5757
5758 55/push-ebp
5759 89/<- %ebp 4/r32/esp
5760
5761 51/push-ecx
5762
5763 (allocate *(ebp+8) *Stmt-size)
5764 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack
5765
5766 8b/-> *(ebp+0xc) 1/r32/ecx
5767 89/<- *(eax+4) 1/r32/ecx
5768 $new-var-def:end:
5769
5770 59/pop-to-ecx
5771
5772 89/<- %esp 5/r32/ebp
5773 5d/pop-to-ebp
5774 c3/return
5775
5776 new-reg-var-def:
5777
5778 55/push-ebp
5779 89/<- %ebp 4/r32/esp
5780
5781 51/push-ecx
5782 57/push-edi
5783
5784 8b/-> *(ebp+0xc) 1/r32/ecx
5785
5786 (allocate *(ebp+8) *Stmt-size)
5787 89/<- %edi 0/r32/eax
5788
5789 c7 0/subop/copy *edi 3/imm32/tag/var-in-register
5790
5791 (append-stmt-var Heap %ecx *(edi+0xc) 0)
5792 89/<- *(edi+0xc) 0/r32/eax
5793 $new-reg-var-def:end:
5794 89/<- %eax 7/r32/edi
5795
5796 5f/pop-to-edi
5797 59/pop-to-ecx
5798
5799 89/<- %esp 5/r32/ebp
5800 5d/pop-to-ebp
5801 c3/return
5802
5803 append-list:
5804
5805 55/push-ebp
5806 89/<- %ebp 4/r32/esp
5807
5808 51/push-ecx
5809
5810 (allocate *(ebp+8) *List-size)
5811 8b/-> *(ebp+0xc) 1/r32/ecx
5812 89/<- *eax 1/r32/ecx
5813
5814 81 7/subop/compare *(ebp+0x10) 0/imm32
5815 74/jump-if-= $append-list:end/disp8
5816
5817
5818 8b/-> *(ebp+0x10) 1/r32/ecx
5819
5820 {
5821 81 7/subop/compare *(ecx+4) 0/imm32
5822 74/jump-if-= break/disp8
5823
5824 8b/-> *(ecx+4) 1/r32/ecx
5825 eb/jump loop/disp8
5826 }
5827
5828 89/<- *(ecx+4) 0/r32/eax
5829
5830 8b/-> *(ebp+0x10) 0/r32/eax
5831 $append-list:end:
5832
5833 59/pop-to-ecx
5834
5835 89/<- %esp 5/r32/ebp
5836 5d/pop-to-ebp
5837 c3/return
5838
5839 append-stmt-var:
5840
5841 55/push-ebp
5842 89/<- %ebp 4/r32/esp
5843
5844 51/push-ecx
5845
5846 (allocate *(ebp+8) *Stmt-var-size)
5847 8b/-> *(ebp+0xc) 1/r32/ecx
5848 89/<- *eax 1/r32/ecx
5849 8b/-> *(ebp+0x14) 1/r32/ecx
5850 89/<- *(eax+8) 1/r32/ecx
5851
5852 81 7/subop/compare *(ebp+0x10) 0/imm32
5853 74/jump-if-= $append-stmt-var:end/disp8
5854
5855
5856 8b/-> *(ebp+0x10) 1/r32/ecx
5857
5858 {
5859 81 7/subop/compare *(ecx+4) 0/imm32
5860 74/jump-if-= break/disp8
5861
5862 8b/-> *(ecx+4) 1/r32/ecx
5863 eb/jump loop/disp8
5864 }
5865
5866 89/<- *(ecx+4) 0/r32/eax
5867
5868 8b/-> *(ebp+0x10) 0/r32/eax
5869 $append-stmt-var:end:
5870
5871 59/pop-to-ecx
5872
5873 89/<- %esp 5/r32/ebp
5874 5d/pop-to-ebp
5875 c3/return
5876
5877 append-to-block:
5878
5879 55/push-ebp
5880 89/<- %ebp 4/r32/esp
5881
5882 56/push-esi
5883
5884 8b/-> *(ebp+0xc) 6/r32/esi
5885 (append-list *(ebp+8) *(ebp+0x10) *(esi+4))
5886 89/<- *(esi+4) 0/r32/eax
5887 $append-to-block:end:
5888
5889 5e/pop-to-esi
5890
5891 89/<- %esp 5/r32/ebp
5892 5d/pop-to-ebp
5893 c3/return
5894
5895
5896
5897
5898
5899
5900
5901 lookup-or-create-constant:
5902
5903 55/push-ebp
5904 89/<- %ebp 4/r32/esp
5905
5906 56/push-esi
5907
5908 (container-type *(ebp+8))
5909
5910
5911
5912
5913 89/<- %esi 0/r32/eax
5914
5915 (find-or-create-typeinfo %esi)
5916
5917
5918
5919
5920
5921 (find-or-create-typeinfo-output-var %eax *(ebp+0xc))
5922 $lookup-or-create-constant:end:
5923
5924 5e/pop-to-esi
5925
5926 89/<- %esp 5/r32/ebp
5927 5d/pop-to-ebp
5928 c3/return
5929
5930
5931
5932
5933
5934 container-type:
5935
5936 55/push-ebp
5937 89/<- %ebp 4/r32/esp
5938
5939 8b/-> *(ebp+8) 0/r32/eax
5940 8b/-> *eax 0/r32/eax
5941 8b/-> *(eax+4) 0/r32/eax
5942 {
5943 81 7/subop/compare *(eax+8) 0/imm32
5944 74/jump-if-= break/disp8
5945 8b/-> *(eax+8) 0/r32/eax
5946 8b/-> *(eax+4) 0/r32/eax
5947 }
5948 8b/-> *(eax+4) 0/r32/eax
5949 $container-type:end:
5950
5951 89/<- %esp 5/r32/ebp
5952 5d/pop-to-ebp
5953 c3/return
5954
5955 find-or-create-typeinfo:
5956
5957 55/push-ebp
5958 89/<- %ebp 4/r32/esp
5959
5960 51/push-ecx
5961
5962 (find-typeinfo *(ebp+8))
5963 {
5964
5965 3d/compare-eax-and 0/imm32
5966 75/jump-if-!= break/disp8
5967 $find-or-create-typeinfo:create:
5968 (allocate Heap *Typeinfo-size)
5969
5970 8b/-> *(ebp+8) 1/r32/ecx
5971 89/<- *eax 1/r32/ecx
5972
5973
5974 50/push-eax
5975 (new-stream Heap 0x40 *Typeinfo-fields-row-size)
5976 89/<- %ecx 0/r32/eax
5977 58/pop-to-eax
5978
5979 89/<- *(eax+4) 1/r32/ecx
5980
5981 8b/-> *_Program-types 1/r32/ecx
5982 89/<- *(eax+0xc) 1/r32/ecx
5983
5984 89/<- *_Program-types 0/r32/eax
5985 }
5986 $find-or-create-typeinfo:end:
5987
5988 59/pop-to-ecx
5989
5990 89/<- %esp 5/r32/ebp
5991 5d/pop-to-ebp
5992 c3/return
5993
5994 find-typeinfo:
5995
5996 55/push-ebp
5997 89/<- %ebp 4/r32/esp
5998
5999 51/push-ecx
6000
6001 8b/-> *(ebp+8) 1/r32/ecx
6002
6003 8b/-> *_Program-types 0/r32/eax
6004 {
6005
6006 3d/compare-eax-and 0/imm32
6007 74/jump-if-= break/disp8
6008
6009 39/compare *eax 1/r32/ecx
6010 0f 84/jump-if-= $find-or-create-typeinfo:end/disp32
6011
6012 8b/-> *(eax+0xc) 0/r32/eax
6013
6014 eb/jump loop/disp8
6015 }
6016 $find-typeinfo:end:
6017
6018 59/pop-to-ecx
6019
6020 89/<- %esp 5/r32/ebp
6021 5d/pop-to-ebp
6022 c3/return
6023
6024 find-or-create-typeinfo-output-var:
6025
6026 55/push-ebp
6027 89/<- %ebp 4/r32/esp
6028
6029 51/push-ecx
6030 56/push-esi
6031
6032 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc))
6033 89/<- %esi 0/r32/eax
6034
6035 {
6036 81 7/subop/compare *(esi+8) 0/imm32
6037 75/jump-if-!= break/disp8
6038
6039 (allocate Heap *Tree-size)
6040 c7 0/subop/copy *(eax+4) 6/imm32/constant
6041 c7 0/subop/copy *(eax+8) 0/imm32
6042 89/<- %ecx 0/r32/eax
6043
6044 (new-var Heap "field")
6045
6046 89/<- *(eax+4) 1/r32/ecx
6047
6048 c7 0/subop/copy *(eax+0xc) -1/imm32/uninitialized
6049
6050 89/<- *(esi+8) 0/r32/eax
6051 }
6052
6053 8b/-> *(esi+8) 0/r32/eax
6054 $find-or-create-typeinfo-output-var:end:
6055
6056 5e/pop-to-esi
6057 59/pop-to-ecx
6058
6059 89/<- %esp 5/r32/ebp
6060 5d/pop-to-ebp
6061 c3/return
6062
6063 find-or-create-typeinfo-fields:
6064
6065 55/push-ebp
6066 89/<- %ebp 4/r32/esp
6067
6068 56/push-esi
6069
6070 8b/-> *(ebp+8) 6/r32/esi
6071 8b/-> *(esi+4) 6/r32/esi
6072
6073 (get-or-insert-slice %esi *(ebp+0xc) *Typeinfo-fields-row-size Heap)
6074 89/<- %esi 0/r32/eax
6075
6076 {
6077 81 7/subop/compare *esi 0/imm32
6078 75/jump-if-!= break/disp8
6079 (allocate Heap *Typeinfo-entry-size)
6080 89/<- *esi 0/r32/eax
6081 }
6082
6083 8b/-> *esi 0/r32/eax
6084 $find-or-create-typeinfo-fields:end:
6085
6086 5e/pop-to-esi
6087
6088 89/<- %esp 5/r32/ebp
6089 5d/pop-to-ebp
6090 c3/return
6091
6092 populate-mu-type:
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118 55/push-ebp
6119 89/<- %ebp 4/r32/esp
6120
6121 68/push 0/imm32
6122
6123 50/push-eax
6124 51/push-ecx
6125 52/push-edx
6126 53/push-ebx
6127 56/push-esi
6128 57/push-edi
6129
6130 8b/-> *(ebp+0xc) 7/r32/edi
6131
6132 81 5/subop/subtract %esp 0x200/imm32
6133 68/push 0x200/imm32/size
6134 68/push 0/imm32/read
6135 68/push 0/imm32/write
6136 89/<- %ecx 4/r32/esp
6137
6138 68/push 0/imm32/end
6139 68/push 0/imm32/start
6140 89/<- %edx 4/r32/esp
6141 {
6142 $populate-mu-type:line-loop:
6143 (clear-stream %ecx)
6144 (read-line-buffered *(ebp+8) %ecx)
6145
6146 81 7/subop/compare *ecx 0/imm32
6147 0f 84/jump-if-= $populate-mu-type:abort/disp32
6148 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6154 (next-mu-token %ecx %edx)
6155
6156 (slice-empty? %edx)
6157 3d/compare-eax-and 0/imm32
6158 0f 85/jump-if-!= loop/disp32
6159
6160 (slice-equal? %edx "}")
6161 3d/compare-eax-and 0/imm32
6162 0f 85/jump-if-!= break/disp32
6163 $populate-mu-type:parse-element:
6164
6165 (parse-var-with-type %edx %ecx)
6166 89/<- %esi 0/r32/eax
6167 $populate-mu-type:create-typeinfo-fields:
6168
6169 (find-or-create-typeinfo-fields %edi %edx)
6170 89/<- %ebx 0/r32/eax
6171
6172
6173
6174
6175
6176
6177
6178 8b/-> *(ebp-4) 0/r32/eax
6179 89/<- *(ebx+4) 0/r32/eax
6180
6181 ff 0/subop/increment *(ebp-4)
6182 $populate-mu-type:set-input-type:
6183
6184 89/<- *ebx 6/r32/esi
6185 {
6186 $populate-mu-type:create-output-type:
6187
6188 81 7/subop/compare *(ebx+8) 0/imm32
6189 75/jump-if-!= break/disp8
6190 (new-literal Heap %edx)
6191 89/<- *(ebx+8) 0/r32/eax
6192 }
6193 e9/jump loop/disp32
6194 }
6195 $populate-mu-type:invalidate-total-size-in-bytes:
6196
6197
6198
6199 c7 0/subop/copy *(edi+8) -2/imm32/uninitialized
6200 $populate-mu-type:end:
6201
6202 81 0/subop/add %esp 0x214/imm32
6203
6204 5f/pop-to-edi
6205 5e/pop-to-esi
6206 5b/pop-to-ebx
6207 5a/pop-to-edx
6208 59/pop-to-ecx
6209 58/pop-to-eax
6210
6211 81 0/subop/add %esp 4/imm32
6212
6213 89/<- %esp 5/r32/ebp
6214 5d/pop-to-ebp
6215 c3/return
6216
6217 $populate-mu-type:abort:
6218
6219 (write-buffered Stderr "incomplete type definition '")
6220 (type-name *edi)
6221 (write-buffered Stderr %eax)
6222 (write-buffered Stderr "\n")
6223 (flush Stderr)
6224
6225 bb/copy-to-ebx 1/imm32
6226 b8/copy-to-eax 1/imm32/exit
6227 cd/syscall 0x80/imm8
6228
6229
6230 type-name:
6231
6232 55/push-ebp
6233 89/<- %ebp 4/r32/esp
6234
6235 (index Type-id *(ebp+8))
6236 $type-name:end:
6237
6238 89/<- %esp 5/r32/ebp
6239 5d/pop-to-ebp
6240 c3/return
6241
6242 index:
6243
6244 55/push-ebp
6245 89/<- %ebp 4/r32/esp
6246
6247 56/push-esi
6248
6249
6250 8b/-> *(ebp+8) 6/r32/esi
6251
6252 8b/-> *(ebp+0xc) 0/r32/eax
6253
6254 8b/-> *(esi+eax+0xc) 0/r32/eax
6255 $index:end:
6256
6257 5e/pop-to-esi
6258
6259 89/<- %esp 5/r32/ebp
6260 5d/pop-to-ebp
6261 c3/return
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272 populate-mu-type-sizes:
6273
6274 55/push-ebp
6275 89/<- %ebp 4/r32/esp
6276
6277 51/push-ecx
6278 $populate-mu-type-sizes:total-sizes:
6279
6280 8b/-> *_Program-types 1/r32/ecx
6281 {
6282
6283 81 7/subop/compare %ecx 0/imm32
6284 74/jump-if-= break/disp8
6285 (populate-mu-type-sizes-in-type %ecx)
6286
6287 8b/-> *(ecx+0xc) 1/r32/ecx
6288 eb/jump loop/disp8
6289 }
6290 $populate-mu-type-sizes:offsets:
6291
6292 8b/-> *_Program-types 1/r32/ecx
6293 {
6294
6295 81 7/subop/compare %ecx 0/imm32
6296 74/jump-if-= break/disp8
6297 (populate-mu-type-offsets %ecx)
6298
6299 8b/-> *(ecx+0xc) 1/r32/ecx
6300 eb/jump loop/disp8
6301 }
6302 $populate-mu-type-sizes:end:
6303
6304 59/pop-to-ecx
6305
6306 89/<- %esp 5/r32/ebp
6307 5d/pop-to-ebp
6308 c3/return
6309
6310
6311
6312
6313 populate-mu-type-sizes-in-type:
6314
6315 55/push-ebp
6316 89/<- %ebp 4/r32/esp
6317
6318 50/push-eax
6319 51/push-ecx
6320 52/push-edx
6321 56/push-esi
6322 57/push-edi
6323
6324 8b/-> *(ebp+8) 6/r32/esi
6325
6326 81 7/subop/compare *(esi+8) 0/imm32
6327 7d/jump-if->= $populate-mu-type-sizes-in-type:end/disp8
6328
6329 81 7/subop/compare *(esi+8) -1/imm32/being-computed
6330 74/jump-if-= $populate-mu-type-sizes-in-type:abort/disp8
6331
6332 c7 0/subop/copy *(esi+8) -1/imm32/being-computed
6333
6334 bf/copy-to-edi 0/imm32
6335
6336
6337 8b/-> *(esi+4) 1/r32/ecx
6338
6339 8b/-> *ecx 2/r32/edx
6340
6341 8d/copy-address *(ecx+0xc) 1/r32/ecx
6342
6343 8d/copy-address *(ecx+edx) 2/r32/edx
6344 {
6345 $populate-mu-type-sizes-in-type:loop:
6346
6347 39/compare %ecx 2/r32/edx
6348 73/jump-if-addr>= break/disp8
6349
6350 8b/-> *(ecx+4) 0/r32/eax
6351
6352 (compute-size-of-var *eax)
6353
6354 01/add-to %edi 0/r32/eax
6355
6356 81 0/subop/add %ecx 8/imm32
6357
6358 eb/jump loop/disp8
6359 }
6360
6361 89/<- *(esi+8) 7/r32/edi
6362 $populate-mu-type-sizes-in-type:end:
6363
6364 5f/pop-to-edi
6365 5e/pop-to-esi
6366 5a/pop-to-edx
6367 59/pop-to-ecx
6368 58/pop-to-eax
6369
6370 89/<- %esp 5/r32/ebp
6371 5d/pop-to-ebp
6372 c3/return
6373
6374 $populate-mu-type-sizes-in-type:abort:
6375 (write-buffered Stderr "cycle in type definitions\n")
6376 (flush Stderr)
6377
6378 bb/copy-to-ebx 1/imm32
6379 b8/copy-to-eax 1/imm32/exit
6380 cd/syscall 0x80/imm8
6381
6382
6383
6384
6385 compute-size-of-var:
6386
6387 55/push-ebp
6388 89/<- %ebp 4/r32/esp
6389
6390 51/push-ecx
6391
6392 8b/-> *(ebp+8) 1/r32/ecx
6393 8b/-> *(ecx+4) 1/r32/ecx
6394
6395 {
6396 81 7/subop/compare *ecx 0/imm32/false
6397 75/jump-if-!= break/disp8
6398 8b/-> *(ecx+4) 1/r32/ecx
6399 }
6400 (compute-size-of-type-id *(ecx+4))
6401 $compute-size-of-var:end:
6402
6403 59/pop-to-ecx
6404
6405 89/<- %esp 5/r32/ebp
6406 5d/pop-to-ebp
6407 c3/return
6408
6409 compute-size-of-type-id:
6410
6411 55/push-ebp
6412 89/<- %ebp 4/r32/esp
6413
6414 8b/-> *(ebp+8) 0/r32/eax
6415
6416 3d/compare-eax-and 0/imm32
6417 74/jump-if-= $compute-size-of-type-id:end/disp8
6418
6419
6420 (find-typeinfo %eax)
6421 {
6422 3d/compare-eax-and 0/imm32
6423 74/jump-if-= break/disp8
6424 $compute-size-of-type-id:user-defined:
6425 (populate-mu-type-sizes %eax)
6426 8b/-> *(eax+8) 0/r32/eax
6427 eb/jump $compute-size-of-type-id:end/disp8
6428 }
6429
6430 b8/copy-to-eax 4/imm32
6431 $compute-size-of-type-id:end:
6432
6433 89/<- %esp 5/r32/ebp
6434 5d/pop-to-ebp
6435 c3/return
6436
6437
6438
6439
6440 populate-mu-type-offsets:
6441
6442 55/push-ebp
6443 89/<- %ebp 4/r32/esp
6444
6445 50/push-eax
6446 51/push-ecx
6447 52/push-edx
6448 53/push-ebx
6449 56/push-esi
6450 57/push-edi
6451
6452 bf/copy-to-edi 0/imm32
6453
6454 8b/-> *(ebp+8) 1/r32/ecx
6455 8b/-> *(ecx+4) 1/r32/ecx
6456
6457 8b/-> *ecx 2/r32/edx
6458 c1 5/subop/shift-right-logical %edx 3/imm8
6459
6460 bb/copy-to-ebx 0/imm32
6461 {
6462 $populate-mu-type-offsets:loop:
6463 39/compare %ebx 2/r32/edx
6464 7d/jump-if->= break/disp8
6465
6466 (locate-typeinfo-entry-with-index %ecx %ebx)
6467 89/<- %esi 0/r32/eax
6468
6469 8b/-> *(esi+8) 0/r32/eax
6470 89/<- *(eax+0xc) 7/r32/edi
6471
6472 8b/-> *esi 0/r32/eax
6473 (size-of %eax)
6474 01/add-to %edi 0/r32/eax
6475
6476 43/increment-ebx
6477 eb/jump loop/disp8
6478 }
6479 $populate-mu-type-offsets:end:
6480
6481 5f/pop-to-edi
6482 5e/pop-to-esi
6483 5b/pop-to-ebx
6484 5a/pop-to-edx
6485 59/pop-to-ecx
6486 58/pop-to-eax
6487
6488 89/<- %esp 5/r32/ebp
6489 5d/pop-to-ebp
6490 c3/return
6491
6492 locate-typeinfo-entry-with-index:
6493
6494 55/push-ebp
6495 89/<- %ebp 4/r32/esp
6496
6497 51/push-ecx
6498 52/push-edx
6499 53/push-ebx
6500 56/push-esi
6501 57/push-edi
6502
6503 8b/-> *(ebp+8) 6/r32/esi
6504
6505 8d/copy-address *(esi+0xc) 1/r32/ecx
6506
6507 8b/-> *esi 2/r32/edx
6508 8d/copy-address *(ecx+edx) 2/r32/edx
6509 {
6510 $locate-typeinfo-entry-with-index:loop:
6511 39/compare %ecx 2/r32/edx
6512 73/jump-if-addr>= $locate-typeinfo-entry-with-index:abort/disp8
6513
6514 8b/-> *(ecx+4) 3/r32/ebx
6515
6516 8b/-> *(ebx+4) 0/r32/eax
6517 39/compare *(ebp+0xc) 0/r32/eax
6518 89/<- %eax 3/r32/ebx
6519 74/jump-if-= break/disp8
6520
6521 81 0/subop/add %ecx 8/imm32
6522 eb/jump loop/disp8
6523 }
6524 $locate-typeinfo-entry-with-index:end:
6525
6526 5f/pop-to-edi
6527 5e/pop-to-esi
6528 5b/pop-to-ebx
6529 5a/pop-to-edx
6530 59/pop-to-ecx
6531
6532 89/<- %esp 5/r32/ebp
6533 5d/pop-to-ebp
6534 c3/return
6535
6536 $locate-typeinfo-entry-with-index:abort:
6537 (write-buffered Stderr "overflowing typeinfo-entry->index ")
6538 (print-int32-buffered Stderr %ecx)
6539 (write-buffered Stderr "\n")
6540 (flush Stderr)
6541
6542 bb/copy-to-ebx 1/imm32
6543 b8/copy-to-eax 1/imm32/exit
6544 cd/syscall 0x80/imm8
6545
6546
6547
6548
6549
6550
6551 check-mu-types:
6552
6553 55/push-ebp
6554 89/<- %ebp 4/r32/esp
6555
6556 $check-mu-types:end:
6557
6558 89/<- %esp 5/r32/ebp
6559 5d/pop-to-ebp
6560 c3/return
6561
6562 size-of:
6563
6564 55/push-ebp
6565 89/<- %ebp 4/r32/esp
6566
6567 51/push-ecx
6568
6569 8b/-> *(ebp+8) 1/r32/ecx
6570 8b/-> *(ecx+4) 1/r32/ecx
6571
6572 {
6573 (is-mu-array? %ecx)
6574 3d/compare-eax-and 0/imm32/false
6575 74/jump-if-= break/disp8
6576 (size-of-array %ecx)
6577 eb/jump $size-of:end/disp8
6578 }
6579
6580 {
6581 81 7/subop/compare *ecx 0/imm32/false
6582 75/jump-if-!= break/disp8
6583 8b/-> *(ecx+4) 1/r32/ecx
6584 }
6585 (size-of-type-id *(ecx+4))
6586 $size-of:end:
6587
6588 59/pop-to-ecx
6589
6590 89/<- %esp 5/r32/ebp
6591 5d/pop-to-ebp
6592 c3/return
6593
6594 size-of-deref:
6595
6596 55/push-ebp
6597 89/<- %ebp 4/r32/esp
6598
6599 51/push-ecx
6600
6601 8b/-> *(ebp+8) 1/r32/ecx
6602 8b/-> *(ecx+4) 1/r32/ecx
6603
6604 8b/-> *(ecx+8) 1/r32/ecx
6605
6606 {
6607 (is-mu-array? %ecx)
6608 3d/compare-eax-and 0/imm32/false
6609 74/jump-if-= break/disp8
6610 (size-of-array %ecx)
6611 eb/jump $size-of:end/disp8
6612 }
6613
6614 {
6615 81 7/subop/compare *ecx 0/imm32/false
6616 75/jump-if-!= break/disp8
6617 8b/-> *(ecx+4) 1/r32/ecx
6618 }
6619 (size-of-type-id *(ecx+4))
6620 $size-of-deref:end:
6621
6622 59/pop-to-ecx
6623
6624 89/<- %esp 5/r32/ebp
6625 5d/pop-to-ebp
6626 c3/return
6627
6628 is-mu-array?:
6629
6630 55/push-ebp
6631 89/<- %ebp 4/r32/esp
6632
6633 51/push-ecx
6634
6635 8b/-> *(ebp+8) 1/r32/ecx
6636
6637 b8/copy-to-eax 0/imm32/false
6638
6639 81 7/subop/compare *ecx 0/imm32/false
6640 75/jump-if-!= $is-mu-array?:end/disp8
6641
6642 8b/-> *(ecx+4) 1/r32/ecx
6643 81 7/subop/compare *ecx 0/imm32/false
6644 74/jump-if-= $is-mu-array?:end/disp8
6645
6646 81 7/subop/compare *(ecx+4) 3/imm32/array-type-id
6647 0f 94/set-if-= %al
6648 $is-mu-array?:end:
6649
6650 59/pop-to-ecx
6651
6652 89/<- %esp 5/r32/ebp
6653 5d/pop-to-ebp
6654 c3/return
6655
6656 size-of-array:
6657
6658 55/push-ebp
6659 89/<- %ebp 4/r32/esp
6660
6661 51/push-ecx
6662 52/push-edx
6663
6664 8b/-> *(ebp+8) 1/r32/ecx
6665
6666 8b/-> *(ecx+8) 1/r32/ecx
6667
6668 8b/-> *(ecx+4) 2/r32/edx
6669 8b/-> *(edx+4) 2/r32/edx
6670
6671 8b/-> *(ecx+8) 1/r32/ecx
6672 8b/-> *(ecx+4) 1/r32/ecx
6673 8b/-> *(ecx+4) 1/r32/ecx
6674
6675 (size-of-type-id %edx)
6676 f7 4/subop/multiply-into-eax %ecx
6677 05/add-to-eax 4/imm32
6678 $size-of-array:end:
6679
6680 5a/pop-to-edx
6681 59/pop-to-ecx
6682
6683 89/<- %esp 5/r32/ebp
6684 5d/pop-to-ebp
6685 c3/return
6686
6687 size-of-type-id:
6688
6689 55/push-ebp
6690 89/<- %ebp 4/r32/esp
6691
6692 8b/-> *(ebp+8) 0/r32/eax
6693
6694 3d/compare-eax-and 0/imm32
6695 74/jump-if-= $size-of-type-id:end/disp8
6696
6697
6698 (find-typeinfo %eax)
6699 {
6700 3d/compare-eax-and 0/imm32
6701 74/jump-if-= break/disp8
6702 $size-of-type-id:user-defined:
6703 8b/-> *(eax+8) 0/r32/eax
6704 eb/jump $size-of-type-id:end/disp8
6705 }
6706
6707 b8/copy-to-eax 4/imm32
6708 $size-of-type-id:end:
6709
6710 89/<- %esp 5/r32/ebp
6711 5d/pop-to-ebp
6712 c3/return
6713
6714 type-equal?:
6715
6716 55/push-ebp
6717 89/<- %ebp 4/r32/esp
6718
6719 51/push-ecx
6720 52/push-edx
6721
6722 8b/-> *(ebp+8) 1/r32/ecx
6723
6724 8b/-> *(ebp+0xc) 2/r32/edx
6725
6726 8b/-> %ecx 0/r32/eax
6727 39/compare %edx 0/r32/eax
6728 b8/copy-to-eax 1/imm32/true
6729 74/jump-if-= $type-equal?:end/disp8
6730
6731 81 7/subop/compare %ecx 0x10000/imm32
6732 b8/copy-to-eax 0/imm32/false
6733 72/jump-if-addr< $type-equal?:end/disp8
6734
6735 81 7/subop/compare %edx 0x10000/imm32
6736 b8/copy-to-eax 0/imm32/false
6737 72/jump-if-addr< $type-equal?:end/disp8
6738
6739 (type-equal? *(ecx+4) *(edx+4))
6740 3d/compare-eax-and 0/imm32/false
6741 74/jump-if-= $type-equal?:end/disp8
6742
6743 (type-equal? *(ecx+8) *(edx+8))
6744 $type-equal?:end:
6745
6746 5a/pop-to-edx
6747 59/pop-to-ecx
6748
6749 89/<- %esp 5/r32/ebp
6750 5d/pop-to-ebp
6751 c3/return
6752
6753
6754
6755
6756
6757 == data
6758
6759 Curr-block-depth:
6760 0/imm32
6761 Curr-local-stack-offset:
6762 0/imm32
6763
6764 == code
6765
6766 emit-subx:
6767
6768 55/push-ebp
6769 89/<- %ebp 4/r32/esp
6770
6771 50/push-eax
6772 51/push-ecx
6773 57/push-edi
6774
6775 8b/-> *(ebp+8) 7/r32/edi
6776
6777 8b/-> *_Program-functions 1/r32/ecx
6778 {
6779
6780 81 7/subop/compare %ecx 0/imm32
6781 0f 84/jump-if-= break/disp32
6782 (emit-subx-function %edi %ecx)
6783
6784 8b/-> *(ecx+0x14) 1/r32/ecx
6785 e9/jump loop/disp32
6786 }
6787 $emit-subx:end:
6788
6789 5f/pop-to-edi
6790 59/pop-to-ecx
6791 58/pop-to-eax
6792
6793 89/<- %esp 5/r32/ebp
6794 5d/pop-to-ebp
6795 c3/return
6796
6797 emit-subx-function:
6798
6799 55/push-ebp
6800 89/<- %ebp 4/r32/esp
6801
6802 (populate-mu-type-offsets-in-inouts *(ebp+0xc))
6803
6804 50/push-eax
6805 51/push-ecx
6806 52/push-edx
6807 57/push-edi
6808
6809 8b/-> *(ebp+8) 7/r32/edi
6810
6811 8b/-> *(ebp+0xc) 1/r32/ecx
6812
6813 81 5/subop/subtract %esp 0x400/imm32
6814 68/push 0x400/imm32/size
6815 68/push 0/imm32/top
6816 89/<- %edx 4/r32/esp
6817
6818 (write-buffered %edi *ecx)
6819 (write-buffered %edi ":\n")
6820
6821 c7 0/subop/copy *Curr-block-depth 1/imm32
6822 c7 0/subop/copy *Curr-local-stack-offset 0/imm32
6823
6824 (emit-subx-prologue %edi)
6825 (emit-subx-block %edi *(ecx+0x10) %edx)
6826 (emit-subx-epilogue %edi)
6827
6828
6829 $emit-subx-function:end:
6830
6831 81 0/subop/add %esp 408/imm32
6832
6833 5f/pop-to-edi
6834 5a/pop-to-edx
6835 59/pop-to-ecx
6836 58/pop-to-eax
6837
6838 89/<- %esp 5/r32/ebp
6839 5d/pop-to-ebp
6840 c3/return
6841
6842 populate-mu-type-offsets-in-inouts:
6843
6844 55/push-ebp
6845 89/<- %ebp 4/r32/esp
6846
6847 50/push-eax
6848 51/push-ecx
6849 52/push-edx
6850 53/push-ebx
6851 57/push-edi
6852
6853 ba/copy-to-edx 8/imm32
6854
6855 8b/-> *(ebp+8) 1/r32/ecx
6856 8b/-> *(ecx+8) 1/r32/ecx
6857 {
6858 $populate-mu-type-offsets-in-inouts:loop:
6859 81 7/subop/compare %ecx 0/imm32
6860 74/jump-if-= break/disp8
6861
6862 8b/-> *ecx 3/r32/ebx
6863
6864 89/<- *(ebx+0xc) 2/r32/edx
6865
6866 (size-of %ebx)
6867 01/add-to %edx 0/r32/eax
6868
6869 8b/-> *(ecx+4) 1/r32/ecx
6870 eb/jump loop/disp8
6871 }
6872 $populate-mu-type-offsets-in-inouts:end:
6873
6874 5f/pop-to-edi
6875 5b/pop-to-ebx
6876 5a/pop-to-edx
6877 59/pop-to-ecx
6878 58/pop-to-eax
6879
6880 89/<- %esp 5/r32/ebp
6881 5d/pop-to-ebp
6882 c3/return
6883
6884 emit-subx-stmt-list:
6885
6886 55/push-ebp
6887 89/<- %ebp 4/r32/esp
6888
6889 50/push-eax
6890 51/push-ecx
6891 52/push-edx
6892 53/push-ebx
6893 56/push-esi
6894
6895 8b/-> *(ebp+0xc) 6/r32/esi
6896
6897 ba/copy-to-edx 0/imm32/false
6898
6899 {
6900 $emit-subx-stmt-list:loop:
6901 81 7/subop/compare %esi 0/imm32
6902 0f 84/jump-if-= break/disp32
6903
6904 8b/-> *esi 1/r32/ecx
6905 {
6906 $emit-subx-stmt-list:check-for-block:
6907 81 7/subop/compare *ecx 0/imm32/block
6908 75/jump-if-!= break/disp8
6909 $emit-subx-stmt-list:block:
6910 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10))
6911 }
6912 {
6913 $emit-subx-stmt-list:check-for-stmt:
6914 81 7/subop/compare *ecx 1/imm32/stmt1
6915 0f 85/jump-if-!= break/disp32
6916 $emit-subx-stmt-list:stmt1:
6917 {
6918 (is-mu-branch? %ecx)
6919 3d/compare-eax-and 0/imm32/false
6920 0f 84/jump-if-= break/disp32
6921 $emit-subx-stmt-list:branch-stmt:
6922
6923 81 7/subop/compare %edx 0/imm32/false
6924 0f 84/jump-if-= break/disp32
6925 $emit-subx-stmt-list:branch-stmt-and-var-seen:
6926 +-- 26 lines: # unconditional loops --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6952 +-- 15 lines: # unconditional breaks -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6967 +-- 37 lines: # simple conditional branches without a target -------------------------------------------------------------------------------------------------------------------------------------------------------
7004 +-- 19 lines: # conditional branches with an explicit target -------------------------------------------------------------------------------------------------------------------------------------------------------
7023 }
7024 $emit-subx-stmt-list:1-to-1:
7025 (emit-subx-stmt *(ebp+8) %ecx Primitives)
7026 }
7027 {
7028 $emit-subx-stmt-list:check-for-var-def:
7029 81 7/subop/compare *ecx 2/imm32/var-def
7030 75/jump-if-!= break/disp8
7031 $emit-subx-stmt-list:var-def:
7032 (emit-subx-var-def *(ebp+8) %ecx)
7033 (push *(ebp+0x10) *(ecx+4))
7034
7035 ba/copy-to-edx 1/imm32/true
7036 }
7037 {
7038 $emit-subx-stmt-list:check-for-reg-var-def:
7039 81 7/subop/compare *ecx 3/imm32/reg-var-def
7040 0f 85/jump-if-!= break/disp32
7041 $emit-subx-stmt-list:reg-var-def:
7042
7043 (compute-reg-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10))
7044
7045 (push *(ebp+0x10) %eax)
7046
7047 (emit-subx-stmt *(ebp+8) %ecx Primitives)
7048
7049 ba/copy-to-edx 1/imm32/true
7050 }
7051 $emit-subx-stmt-list:continue:
7052
7053 8b/-> *(esi+4) 6/r32/esi
7054 e9/jump loop/disp32
7055 }
7056 $emit-subx-stmt-list:emit-cleanup:
7057 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth)
7058 $emit-subx-stmt-list:cleanup:
7059 (clean-up-blocks *(ebp+0x10) *Curr-block-depth)
7060 $emit-subx-stmt-list:end:
7061
7062 5e/pop-to-esi
7063 5b/pop-to-ebx
7064 5a/pop-to-edx
7065 59/pop-to-ecx
7066 58/pop-to-eax
7067
7068 89/<- %esp 5/r32/ebp
7069 5d/pop-to-ebp
7070 c3/return
7071
7072 compute-reg-and-maybe-emit-spill:
7073
7074 55/push-ebp
7075 89/<- %ebp 4/r32/esp
7076
7077 51/push-ecx
7078
7079 8b/-> *(ebp+0xc) 1/r32/ecx
7080
7081 8b/-> *(ecx+0xc) 1/r32/ecx
7082 8b/-> *ecx 1/r32/ecx
7083
7084 8b/-> *Curr-block-depth 0/r32/eax
7085 89/<- *(ecx+8) 0/r32/eax
7086
7087 8b/-> *(ecx+0x10) 0/r32/eax
7088
7089 3d/compare-eax-and 0/imm32
7090 0f 84/jump-if-= $compute-reg-and-maybe-emit-spill:abort/disp32
7091
7092 (already-spilled-this-block? %ecx *(ebp+0x10))
7093 3d/compare-eax-and 0/imm32/false
7094 75/jump-if-!= $compute-reg-and-maybe-emit-spill:end/disp8
7095
7096
7097 81 5/subop/subtract *Curr-local-stack-offset 4/imm32
7098
7099 (emit-indent *(ebp+8) *Curr-block-depth)
7100 (write-buffered *(ebp+8) "ff 6/subop/push %")
7101 (write-buffered *(ebp+8) *(ecx+0x10))
7102 (write-buffered *(ebp+8) Newline)
7103 $compute-reg-and-maybe-emit-spill:end:
7104
7105 89/<- %eax 1/r32/ecx
7106
7107 59/pop-to-ecx
7108
7109 89/<- %esp 5/r32/ebp
7110 5d/pop-to-ebp
7111 c3/return
7112
7113 $compute-reg-and-maybe-emit-spill:abort:
7114
7115 (write-buffered Stderr "var '")
7116 (write-buffered Stderr *eax)
7117 (write-buffered Stderr "' initialized from an instruction must live in a register\n")
7118 (flush Stderr)
7119
7120 bb/copy-to-ebx 1/imm32
7121 b8/copy-to-eax 1/imm32/exit
7122 cd/syscall 0x80/imm8
7123
7124
7125 emit-subx-cleanup-and-unconditional-nonlocal-branch:
7126
7127 55/push-ebp
7128 89/<- %ebp 4/r32/esp
7129
7130 50/push-eax
7131 51/push-ecx
7132 52/push-edx
7133
7134 8b/-> *(ebp+0xc) 1/r32/ecx
7135
7136 8b/-> *(ecx+8) 2/r32/edx
7137 8b/-> *edx 2/r32/edx
7138 8b/-> *edx 2/r32/edx
7139
7140 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %edx)
7141
7142 (emit-indent *(ebp+8) *Curr-block-depth)
7143 (write-buffered *(ebp+8) "e9/jump ")
7144 (write-buffered *(ebp+8) %edx)
7145 (string-starts-with? *(ecx+4) "break")
7146 3d/compare-eax-and 0/imm32/false
7147 {
7148 74/jump-if-= break/disp8
7149 (write-buffered *(ebp+8) ":break/disp32\n")
7150 }
7151 3d/compare-eax-and 0/imm32/false
7152 {
7153 75/jump-if-!= break/disp8
7154 (write-buffered *(ebp+8) ":loop/disp32\n")
7155 }
7156 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end:
7157
7158 5a/pop-to-edx
7159 59/pop-to-ecx
7160 58/pop-to-eax
7161
7162 89/<- %esp 5/r32/ebp
7163 5d/pop-to-ebp
7164 c3/return
7165
7166 is-mu-branch?:
7167
7168 55/push-ebp
7169 89/<- %ebp 4/r32/esp
7170
7171 51/push-ecx
7172
7173 8b/-> *(ebp+8) 1/r32/ecx
7174
7175 (string-starts-with? *(ecx+4) "loop")
7176 3d/compare-eax-and 0/imm32/false
7177 75/jump-if-not-equal $is-mu-branch?:end/disp8
7178
7179 (string-starts-with? *(ecx+4) "break")
7180 $is-mu-branch?:end:
7181
7182 59/pop-to-ecx
7183
7184 89/<- %esp 5/r32/ebp
7185 5d/pop-to-ebp
7186 c3/return
7187
7188 emit-reverse-break:
7189
7190 55/push-ebp
7191 89/<- %ebp 4/r32/esp
7192
7193 50/push-eax
7194
7195 8b/-> *(ebp+0xc) 0/r32/eax
7196
7197 (get Reverse-branch *(eax+4) 8 "reverse-branch: ")
7198 (emit-indent *(ebp+8) *Curr-block-depth)
7199 (write-buffered *(ebp+8) *eax)
7200 (write-buffered *(ebp+8) " break/disp32\n")
7201 $emit-reverse-break:end:
7202
7203 58/pop-to-eax
7204
7205 89/<- %esp 5/r32/ebp
7206 5d/pop-to-ebp
7207 c3/return
7208
7209 == data
7210
7211 Reverse-branch:
7212
7213 0xa0/imm32/write
7214 0/imm32/read
7215 0xa0/imm32/size
7216
7217 "break-if-="/imm32 "0f 85/jump-if-!="/imm32
7218 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32
7219 "break-if-!="/imm32 "0f 84/jump-if-="/imm32
7220 "loop-if-!="/imm32 "0f 84/jump-if-="/imm32
7221 "break-if-<"/imm32 "0f 8d/jump-if->="/imm32
7222 "loop-if-<"/imm32 "0f 8d/jump-if->="/imm32
7223 "break-if->"/imm32 "0f 8e/jump-if-<="/imm32
7224 "loop-if->"/imm32 "0f 8e/jump-if-<="/imm32
7225 "break-if-<="/imm32 "0f 87/jump-if->"/imm32
7226 "loop-if-<="/imm32 "0f 87/jump-if->"/imm32
7227 "break-if->="/imm32 "0f 8c/jump-if-<"/imm32
7228 "loop-if->="/imm32 "0f 8c/jump-if-<"/imm32
7229 "break-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
7230 "loop-if-addr<"/imm32 "0f 83/jump-if-addr>="/imm32
7231 "break-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
7232 "loop-if-addr>"/imm32 "0f 86/jump-if-addr<="/imm32
7233 "break-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
7234 "loop-if-addr<="/imm32 "0f 87/jump-if-addr>"/imm32
7235 "break-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
7236 "loop-if-addr>="/imm32 "0f 82/jump-if-addr<"/imm32
7237
7238 == code
7239
7240 emit-unconditional-jump-to-depth:
7241
7242 55/push-ebp
7243 89/<- %ebp 4/r32/esp
7244
7245 50/push-eax
7246 51/push-ecx
7247 52/push-edx
7248 53/push-ebx
7249
7250 8b/-> *(ebp+0xc) 1/r32/ecx
7251
7252 8b/-> *ecx 0/r32/eax
7253
7254 81 0/subop/add %ecx 8/imm32
7255
7256 81 5/subop/subtract %eax 4/imm32
7257 8d/copy-address *(ecx+eax) 0/r32/eax
7258
7259 8b/-> *(ebp+0x10) 2/r32/edx
7260 {
7261 $emit-unconditional-jump-to-depth:loop:
7262
7263 39/compare %eax 1/r32/ecx
7264 0f 82/jump-if-addr< break/disp32
7265
7266 8b/-> *eax 3/r32/ebx
7267
7268 39/compare *(ebx+8) 2/r32/edx
7269 0f 8c/jump-if-< break/disp32
7270 {
7271 $emit-unconditional-jump-to-depth:check:
7272
7273 39/compare *(ebx+8) 2/r32/edx
7274 0f 85/jump-if-!= break/disp32
7275 $emit-unconditional-jump-to-depth:depth-found:
7276
7277
7278 50/push-eax
7279 (size-of %ebx)
7280
7281 3d/compare-eax-and 0/imm32
7282 58/pop-to-eax
7283
7284 0f 85/jump-if-!= break/disp32
7285 $emit-unconditional-jump-to-depth:label-found:
7286
7287 (emit-indent *(ebp+8) *Curr-block-depth)
7288 (write-buffered *(ebp+8) "e9/jump ")
7289 (write-buffered *(ebp+8) *ebx)
7290 (write-buffered *(ebp+8) ":")
7291 (write-buffered *(ebp+8) *(ebp+0x14))
7292 (write-buffered *(ebp+8) "/disp32\n")
7293 eb/jump $emit-unconditional-jump-to-depth:end/disp8
7294 }
7295
7296 2d/subtract-from-eax 4/imm32
7297 e9/jump loop/disp32
7298 }
7299
7300 $emit-unconditional-jump-to-depth:end:
7301
7302 5b/pop-to-ebx
7303 5a/pop-to-edx
7304 59/pop-to-ecx
7305 58/pop-to-eax
7306
7307 89/<- %esp 5/r32/ebp
7308 5d/pop-to-ebp
7309 c3/return
7310
7311
7312
7313 emit-cleanup-code-until-depth:
7314
7315 55/push-ebp
7316 89/<- %ebp 4/r32/esp
7317
7318 50/push-eax
7319 51/push-ecx
7320 52/push-edx
7321 53/push-ebx
7322
7323 8b/-> *(ebp+0xc) 1/r32/ecx
7324
7325 8b/-> *ecx 0/r32/eax
7326
7327 81 0/subop/add %ecx 8/imm32
7328
7329 81 5/subop/subtract %eax 4/imm32
7330 8d/copy-address *(ecx+eax) 0/r32/eax
7331
7332 8b/-> *(ebp+0x10) 2/r32/edx
7333 {
7334 $emit-cleanup-code-until-depth:loop:
7335
7336 39/compare %eax 1/r32/ecx
7337 0f 82/jump-if-addr< break/disp32
7338
7339 8b/-> *eax 3/r32/ebx
7340
7341 39/compare *(ebx+8) 2/r32/edx
7342 0f 8c/jump-if-< break/disp32
7343
7344 81 7/subop/compare *(ebx+0x10) 0/imm32
7345 {
7346 0f 84/jump-if-= break/disp32
7347 50/push-eax
7348 {
7349 $emit-cleanup-code-until-depth:check-for-previous-spill:
7350 (same-register-spilled-before? %ebx *(ebp+0xc) %eax)
7351 3d/compare-eax-and 0/imm32/false
7352 0f 85/jump-if-!= break/disp32
7353 $emit-cleanup-code-until-depth:reclaim-var-in-register:
7354 (emit-indent *(ebp+8) *Curr-block-depth)
7355 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7356 (write-buffered *(ebp+8) *(ebx+0x10))
7357 (write-buffered *(ebp+8) Newline)
7358 }
7359 58/pop-to-eax
7360 eb/jump $emit-cleanup-code-until-depth:continue/disp8
7361 }
7362
7363 {
7364 75/jump-if-!= break/disp8
7365 $emit-cleanup-code-until-depth:reclaim-var-on-stack:
7366 50/push-eax
7367 (size-of %ebx)
7368
7369 3d/compare-eax-and 0/imm32
7370 74/jump-if-= break/disp8
7371
7372 (emit-indent *(ebp+8) *Curr-block-depth)
7373 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7374 (print-int32-buffered *(ebp+8) %eax)
7375 (write-buffered *(ebp+8) "/imm32\n")
7376 58/pop-to-eax
7377 }
7378 $emit-cleanup-code-until-depth:continue:
7379
7380 2d/subtract-from-eax 4/imm32
7381 e9/jump loop/disp32
7382 }
7383 $emit-cleanup-code-until-depth:end:
7384
7385 5b/pop-to-ebx
7386 5a/pop-to-edx
7387 59/pop-to-ecx
7388 58/pop-to-eax
7389
7390 89/<- %esp 5/r32/ebp
7391 5d/pop-to-ebp
7392 c3/return
7393
7394
7395
7396 emit-cleanup-code-until-target:
7397
7398 55/push-ebp
7399 89/<- %ebp 4/r32/esp
7400
7401 50/push-eax
7402 51/push-ecx
7403 52/push-edx
7404 53/push-ebx
7405
7406 8b/-> *(ebp+0xc) 1/r32/ecx
7407
7408 8b/-> *ecx 0/r32/eax
7409
7410 81 0/subop/add %ecx 8/imm32
7411
7412 81 5/subop/subtract %eax 4/imm32
7413 8d/copy-address *(ecx+eax) 2/r32/edx
7414 {
7415 $emit-cleanup-code-until-target:loop:
7416
7417 39/compare %edx 1/r32/ecx
7418 0f 82/jump-if-addr< break/disp32
7419
7420 8b/-> *edx 3/r32/ebx
7421
7422 (string-equal? *ebx *(ebp+0x10))
7423 3d/compare-eax-and 0/imm32/false
7424 0f 85/jump-if-!= break/disp32
7425
7426 81 7/subop/compare *(ebx+0x10) 0/imm32
7427 {
7428 74/jump-if-= break/disp8
7429 50/push-eax
7430 {
7431 $emit-cleanup-code-until-target:check-for-previous-spill:
7432 (same-register-spilled-before? %ebx *(ebp+0xc) %edx)
7433 3d/compare-eax-and 0/imm32/false
7434 75/jump-if-!= break/disp8
7435 $emit-cleanup-code-until-target:reclaim-var-in-register:
7436 (emit-indent *(ebp+8) *Curr-block-depth)
7437 (write-buffered *(ebp+8) "8f 0/subop/pop %")
7438 (write-buffered *(ebp+8) *(ebx+0x10))
7439 (write-buffered *(ebp+8) Newline)
7440 }
7441 58/pop-to-eax
7442 eb/jump $emit-cleanup-code-until-target:continue/disp8
7443 }
7444
7445 {
7446 75/jump-if-!= break/disp8
7447 $emit-cleanup-code-until-target:reclaim-var-on-stack:
7448 (size-of %ebx)
7449
7450 3d/compare-eax-and 0/imm32
7451 74/jump-if-= break/disp8
7452
7453 (emit-indent *(ebp+8) *Curr-block-depth)
7454 (write-buffered *(ebp+8) "81 0/subop/add %esp ")
7455 (print-int32-buffered *(ebp+8) %eax)
7456 (write-buffered *(ebp+8) "/imm32\n")
7457 }
7458 $emit-cleanup-code-until-target:continue:
7459
7460 81 5/subop/subtract %edx 4/imm32
7461 e9/jump loop/disp32
7462 }
7463 $emit-cleanup-code-until-target:end:
7464
7465 5b/pop-to-ebx
7466 5a/pop-to-edx
7467 59/pop-to-ecx
7468 58/pop-to-eax
7469
7470 89/<- %esp 5/r32/ebp
7471 5d/pop-to-ebp
7472 c3/return
7473
7474
7475
7476 already-spilled-this-block?:
7477
7478 55/push-ebp
7479 89/<- %ebp 4/r32/esp
7480
7481 51/push-ecx
7482 52/push-edx
7483 53/push-ebx
7484 56/push-esi
7485 57/push-edi
7486
7487 8b/-> *(ebp+0xc) 1/r32/ecx
7488
7489 8b/-> *ecx 0/r32/eax
7490
7491 81 0/subop/add %ecx 8/imm32
7492
7493 81 5/subop/subtract %eax 4/imm32
7494 8d/copy-address *(ecx+eax) 2/r32/edx
7495
7496 8b/-> *(ebp+8) 3/r32/ebx
7497 8b/-> *(ebx+8) 3/r32/ebx
7498
7499 8b/-> *(ebp+8) 6/r32/esi
7500 8b/-> *(esi+0x10) 6/r32/esi
7501 {
7502 $already-spilled-this-block?:loop:
7503
7504 39/compare %edx 1/r32/ecx
7505 0f 82/jump-if-addr< break/disp32
7506
7507 8b/-> *edx 7/r32/edi
7508
7509 39/compare *(edi+8) 3/r32/ebx
7510 0f 8c/jump-if-< break/disp32
7511
7512 8b/-> *(edi+0x10) 7/r32/edi
7513
7514 {
7515 $already-spilled-this-block?:check-reg:
7516 81 7/subop/compare %edi 0/imm32
7517 74/jump-if-= break/disp8
7518
7519 (string-equal? %esi %edi)
7520 3d/compare-eax-and 0/imm32/false
7521 74/jump-if-= break/disp8
7522 b8/copy-to-eax 1/imm32/true
7523 eb/jump $already-spilled-this-block?:end/disp8
7524 }
7525 $already-spilled-this-block?:continue:
7526
7527 81 5/subop/subtract %edx 4/imm32
7528 e9/jump loop/disp32
7529 }
7530
7531 b8/copy-to-eax 0/imm32/false
7532 $already-spilled-this-block?:end:
7533
7534 5f/pop-to-edi
7535 5e/pop-to-esi
7536 5b/pop-to-ebx
7537 5a/pop-to-edx
7538 59/pop-to-ecx
7539
7540 89/<- %esp 5/r32/ebp
7541 5d/pop-to-ebp
7542 c3/return
7543
7544
7545
7546
7547
7548 same-register-spilled-before?:
7549
7550 55/push-ebp
7551 89/<- %ebp 4/r32/esp
7552
7553 51/push-ecx
7554 52/push-edx
7555 53/push-ebx
7556 56/push-esi
7557 57/push-edi
7558
7559 8b/-> *(ebp+8) 1/r32/ecx
7560
7561 8b/-> *(ecx+0x10) 2/r32/edx
7562
7563 8b/-> *(ecx+8) 3/r32/ebx
7564
7565 8b/-> *(ebp+0xc) 1/r32/ecx
7566 81 0/subop/add %ecx 8/imm32
7567
7568
7569
7570 8b/-> *(ebp+0x10) 6/r32/esi
7571
7572 81 5/subop/subtract %esi 4/imm32
7573 {
7574 $same-register-spilled-before?:loop:
7575
7576 39/compare %esi 1/r32/ecx
7577 0f 82/jump-if-addr< break/disp32
7578
7579 8b/-> *esi 0/r32/eax
7580
7581 39/compare *(eax+8) 3/r32/ebx
7582 0f 8c/jump-if-< break/disp32
7583
7584 81 7/subop/compare *(eax+0x10) 0/imm32
7585 74/jump-if-= $same-register-spilled-before?:continue/disp8
7586
7587 (string-equal? *(eax+0x10) %edx)
7588 3d/compare-eax-and 0/imm32/false
7589 75/jump-if-!= $same-register-spilled-before?:end/disp8
7590 $same-register-spilled-before?:continue:
7591
7592 81 5/subop/subtract %esi 4/imm32
7593 e9/jump loop/disp32
7594 }
7595 $same-register-spilled-before?:false:
7596 b8/copy-to-eax 0/imm32/false
7597 $same-register-spilled-before?:end:
7598
7599 5f/pop-to-edi
7600 5e/pop-to-esi
7601 5b/pop-to-ebx
7602 5a/pop-to-edx
7603 59/pop-to-ecx
7604
7605 89/<- %esp 5/r32/ebp
7606 5d/pop-to-ebp
7607 c3/return
7608
7609
7610 clean-up-blocks:
7611
7612 55/push-ebp
7613 89/<- %ebp 4/r32/esp
7614
7615 50/push-eax
7616 51/push-ecx
7617 56/push-esi
7618
7619 8b/-> *(ebp+8) 6/r32/esi
7620
7621 8b/-> *(ebp+0xc) 1/r32/ecx
7622 {
7623 $clean-up-blocks:reclaim-loop:
7624
7625 81 7/subop/compare *esi 0/imm32
7626 7e/jump-if-<= break/disp8
7627
7628 (top %esi)
7629
7630 39/compare *(eax+8) 1/r32/ecx
7631 7c/jump-if-< break/disp8
7632
7633 81 7/subop/compare *(eax+0x10) 0/imm32
7634 {
7635 75/jump-if-!= break/disp8
7636 $clean-up-blocks:reclaim-var-on-stack:
7637 (size-of %eax)
7638 01/add-to *Curr-local-stack-offset 0/r32/eax
7639 }
7640 (pop %esi)
7641 e9/jump loop/disp32
7642 }
7643 $clean-up-blocks:end:
7644
7645 5e/pop-to-esi
7646 59/pop-to-ecx
7647 58/pop-to-eax
7648
7649 89/<- %esp 5/r32/ebp
7650 5d/pop-to-ebp
7651 c3/return
7652
7653 emit-subx-var-def:
7654
7655 55/push-ebp
7656 89/<- %ebp 4/r32/esp
7657
7658 50/push-eax
7659 51/push-ecx
7660 52/push-edx
7661
7662 8b/-> *(ebp+0xc) 0/r32/eax
7663
7664 8b/-> *(eax+4) 1/r32/ecx
7665
7666 8b/-> *Curr-block-depth 0/r32/eax
7667 89/<- *(ecx+8) 0/r32/eax
7668
7669 (size-of %ecx)
7670 89/<- %edx 0/r32/eax
7671
7672 29/subtract-from *Curr-local-stack-offset 2/r32/edx
7673
7674 8b/-> *Curr-local-stack-offset 0/r32/eax
7675 89/<- *(ecx+0xc) 0/r32/eax
7676
7677 {
7678 (is-mu-array? *(ecx+4))
7679 3d/compare-eax-and 0/imm32/false
7680 0f 84/jump-if-= break/disp32
7681
7682 81 5/subop/subtract %edx 4/imm32
7683 (emit-indent *(ebp+8) *Curr-block-depth)
7684 (write-buffered *(ebp+8) "(push-n-zero-bytes ")
7685 (print-int32-buffered *(ebp+8) %edx)
7686 (write-buffered *(ebp+8) ")\n")
7687 (emit-indent *(ebp+8) *Curr-block-depth)
7688 (write-buffered *(ebp+8) "68/push ")
7689 (print-int32-buffered *(ebp+8) %edx)
7690 (write-buffered *(ebp+8) "/imm32\n")
7691 eb/jump $emit-subx-var-def:end/disp8
7692 }
7693
7694 {
7695 81 7/subop/compare %edx 0/imm32
7696 7e/jump-if-<= break/disp8
7697 (emit-indent *(ebp+8) *Curr-block-depth)
7698 (write-buffered *(ebp+8) "68/push 0/imm32\n")
7699
7700 81 5/subop/subtract %edx 4/imm32
7701
7702 eb/jump loop/disp8
7703 }
7704 $emit-subx-var-def:end:
7705
7706 5a/pop-to-edx
7707 59/pop-to-ecx
7708 58/pop-to-eax
7709
7710 89/<- %esp 5/r32/ebp
7711 5d/pop-to-ebp
7712 c3/return
7713
7714 emit-subx-stmt:
7715
7716 55/push-ebp
7717 89/<- %ebp 4/r32/esp
7718
7719 50/push-eax
7720 51/push-ecx
7721
7722
7723 8b/-> *(ebp+0xc) 1/r32/ecx
7724
7725 {
7726
7727 (string-equal? *(ecx+4) "length")
7728 3d/compare-eax-and 0/imm32
7729 0f 84/jump-if-= break/disp32
7730 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc))
7731 e9/jump $emit-subx-stmt:end/disp32
7732 }
7733
7734 {
7735
7736 (string-equal? *(ecx+4) "index")
7737 3d/compare-eax-and 0/imm32
7738 0f 84/jump-if-= break/disp32
7739 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc))
7740 e9/jump $emit-subx-stmt:end/disp32
7741 }
7742
7743 {
7744
7745 (string-equal? *(ecx+4) "compute-offset")
7746 3d/compare-eax-and 0/imm32
7747 0f 84/jump-if-= break/disp32
7748 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc))
7749 e9/jump $emit-subx-stmt:end/disp32
7750 }
7751
7752 {
7753
7754 (string-equal? *(ecx+4) "get")
7755 3d/compare-eax-and 0/imm32
7756 0f 84/jump-if-= break/disp32
7757 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc))
7758 e9/jump $emit-subx-stmt:end/disp32
7759 }
7760
7761 {
7762 $emit-subx-stmt:check-for-primitive:
7763 (find-matching-primitive *(ebp+0x10) *(ebp+0xc))
7764 3d/compare-eax-and 0/imm32
7765 74/jump-if-= break/disp8
7766 $emit-subx-stmt:primitive:
7767 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax)
7768 e9/jump $emit-subx-stmt:end/disp32
7769 }
7770
7771
7772 $emit-subx-stmt:call:
7773 (emit-call *(ebp+8) *(ebp+0xc))
7774 $emit-subx-stmt:end:
7775
7776 59/pop-to-ecx
7777 58/pop-to-eax
7778
7779 89/<- %esp 5/r32/ebp
7780 5d/pop-to-ebp
7781 c3/return
7782
7783 translate-mu-length-stmt:
7784
7785 55/push-ebp
7786 89/<- %ebp 4/r32/esp
7787
7788 50/push-eax
7789 51/push-ecx
7790
7791 8b/-> *(ebp+0xc) 1/r32/ecx
7792
7793 (emit-indent *(ebp+8) *Curr-block-depth)
7794 (write-buffered *(ebp+8) "8b/-> *")
7795
7796 8b/-> *(ecx+8) 0/r32/eax
7797 8b/-> *eax 0/r32/eax
7798
7799 {
7800 81 7/subop/compare *(eax+0x10)) 0/imm32
7801 74/jump-if-= break/disp8
7802 (write-buffered *(ebp+8) *(eax+0x10))
7803 eb/jump $translate-mu-length-stmt:emit-output/disp8
7804 }
7805
7806 {
7807 81 7/subop/compare *(eax+0xc)) 0/imm32
7808 74/jump-if-= break/disp8
7809 (write-buffered *(ebp+8) "(ebp+")
7810 (print-int32-buffered *(ebp+8) *(eax+0xc))
7811 (write-buffered *(ebp+8) ")")
7812 }
7813 $translate-mu-length-stmt:emit-output:
7814 (write-buffered *(ebp+8) " ")
7815
7816 8b/-> *(ecx+0xc) 0/r32/eax
7817 8b/-> *eax 0/r32/eax
7818 (get Registers *(eax+0x10) 8 "Registers")
7819 (print-int32-buffered *(ebp+8) *eax)
7820 (write-buffered *(ebp+8) "/r32\n")
7821 $translate-mu-length-stmt:end:
7822
7823 59/pop-to-ecx
7824 58/pop-to-eax
7825
7826 89/<- %esp 5/r32/ebp
7827 5d/pop-to-ebp
7828 c3/return
7829
7830 translate-mu-index-stmt:
7831
7832 55/push-ebp
7833 89/<- %ebp 4/r32/esp
7834
7835 51/push-ecx
7836
7837 8b/-> *(ebp+0xc) 1/r32/ecx
7838 8b/-> *(ecx+8) 1/r32/ecx
7839 8b/-> *ecx 1/r32/ecx
7840
7841 {
7842 81 7/subop/compare *(ecx+0x10) 0/imm32
7843 74/jump-if-= break/disp8
7844
7845 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc))
7846 eb/jump $translate-mu-index-stmt:end/disp8
7847 }
7848
7849 {
7850 81 7/subop/compare *(ecx+0xc) 0/imm32
7851 74/jump-if-= break/disp8
7852
7853 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc))
7854 eb/jump $translate-mu-index-stmt:end/disp8
7855 }
7856 $translate-mu-index-stmt:end:
7857
7858 59/pop-to-ecx
7859
7860 89/<- %esp 5/r32/ebp
7861 5d/pop-to-ebp
7862 c3/return
7863
7864 $translate-mu-index-stmt-with-array:error1:
7865 (write-buffered Stderr "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n")
7866 (flush Stderr)
7867
7868 bb/copy-to-ebx 1/imm32
7869 b8/copy-to-eax 1/imm32/exit
7870 cd/syscall 0x80/imm8
7871
7872
7873 $translate-mu-index-stmt-with-array:error2:
7874 (write-buffered Stderr "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n")
7875 (flush Stderr)
7876
7877 bb/copy-to-ebx 1/imm32
7878 b8/copy-to-eax 1/imm32/exit
7879 cd/syscall 0x80/imm8
7880
7881
7882 translate-mu-index-stmt-with-array-in-register:
7883
7884 55/push-ebp
7885 89/<- %ebp 4/r32/esp
7886
7887 50/push-eax
7888 51/push-ecx
7889 52/push-edx
7890 53/push-ebx
7891
7892 (emit-indent *(ebp+8) *Curr-block-depth)
7893 (write-buffered *(ebp+8) "8d/copy-address *(")
7894
7895 $translate-mu-index-stmt-with-array-in-register:emit-base:
7896
7897 8b/-> *(ebp+0xc) 1/r32/ecx
7898
7899 8b/-> *(ecx+8) 3/r32/ebx
7900 8b/-> *ebx 3/r32/ebx
7901
7902 (write-buffered *(ebp+8) *(ebx+0x10))
7903
7904 (write-buffered *(ebp+8) " + ")
7905
7906 8b/-> *(ecx+8) 2/r32/edx
7907 8b/-> *(edx+4) 2/r32/edx
7908 8b/-> *edx 2/r32/edx
7909
7910 81 7/subop/compare *(edx+0x10) 0/imm32
7911 {
7912 0f 84/jump-if-= break/disp32
7913 $translate-mu-index-stmt-with-array-in-register:emit-register-index:
7914
7915 (is-simple-mu-type? *(edx+4) 1)
7916 3d/compare-eax-and 0/imm32/false
7917 {
7918 0f 84/jump-if-= break/disp32
7919 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index:
7920
7921
7922 (write-buffered *(ebp+8) *(edx+0x10))
7923 (write-buffered *(ebp+8) "<<")
7924
7925
7926 (array-element-type-id %ebx)
7927 (size-of-type-id %eax)
7928 (num-shift-rights %eax)
7929 (print-int32-buffered *(ebp+8) %eax)
7930 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32
7931 }
7932
7933 8b/-> *(edx+4) 0/r32/eax
7934 81 7/subop/compare *eax 0/imm32/false
7935 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32
7936
7937 (is-simple-mu-type? *(eax+4) 7)
7938 3d/compare-eax-and 0/imm32/false
7939 {
7940 0f 84/jump-if-= break/disp32
7941
7942 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index:
7943 (write-buffered *(ebp+8) *(edx+0x10))
7944 }
7945 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done:
7946 (write-buffered *(ebp+8) " + 4) ")
7947 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7948 }
7949
7950 (is-simple-mu-type? *(edx+4) 0)
7951 3d/compare-eax-and 0/imm32/false
7952 {
7953 0f 84/jump-if-= break/disp32
7954 $translate-mu-index-stmt-with-array-in-register:emit-literal-index:
7955
7956 (parse-hex-int *edx)
7957 89/<- %edx 0/r32/eax
7958
7959 (array-element-type-id %ebx)
7960 (size-of-type-id %eax)
7961 f7 4/subop/multiply-into-eax %edx
7962
7963 05/add-to-eax 4/imm32
7964
7965
7966 (print-int32-buffered *(ebp+8) %eax)
7967 (write-buffered *(ebp+8) ") ")
7968 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32
7969 }
7970
7971 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
7972 $translate-mu-index-stmt-with-array-in-register:emit-output:
7973
7974 8b/-> *(ebp+0xc) 1/r32/ecx
7975 8b/-> *(ecx+0xc) 0/r32/eax
7976 8b/-> *eax 0/r32/eax
7977 (get Registers *(eax+0x10) 8 "Registers")
7978 (print-int32-buffered *(ebp+8) *eax)
7979 (write-buffered *(ebp+8) "/r32\n")
7980 $translate-mu-index-stmt-with-array-in-register:end:
7981
7982 5b/pop-to-ebx
7983 5a/pop-to-edx
7984 59/pop-to-ecx
7985 58/pop-to-eax
7986
7987 89/<- %esp 5/r32/ebp
7988 5d/pop-to-ebp
7989 c3/return
7990
7991 translate-mu-index-stmt-with-array-on-stack:
7992
7993 55/push-ebp
7994 89/<- %ebp 4/r32/esp
7995
7996 50/push-eax
7997 51/push-ecx
7998 52/push-edx
7999 53/push-ebx
8000
8001 (emit-indent *(ebp+8) *Curr-block-depth)
8002 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ")
8003
8004 8b/-> *(ebp+0xc) 0/r32/eax
8005
8006 8b/-> *(eax+8) 0/r32/eax
8007 8b/-> *eax 1/r32/ecx
8008
8009 8b/-> *(eax+4) 0/r32/eax
8010
8011 8b/-> *eax 2/r32/edx
8012
8013 81 7/subop/compare *(edx+0x10) 0/imm32
8014 {
8015 0f 84/jump-if-= break/disp32
8016 $translate-mu-index-stmt-with-array-on-stack:emit-register-index:
8017
8018 (is-simple-mu-type? *(edx+4) 1)
8019 3d/compare-eax-and 0/imm32/false
8020 {
8021 0f 84/jump-if-= break/disp32
8022 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index:
8023
8024
8025 (write-buffered *(ebp+8) *(edx+0x10))
8026 (write-buffered *(ebp+8) "<<")
8027
8028
8029 (array-element-type-id %ecx)
8030 (size-of-type-id %eax)
8031 (num-shift-rights %eax)
8032 (print-int32-buffered *(ebp+8) %eax)
8033
8034 (write-buffered *(ebp+8) " + ")
8035
8036 8b/-> *(ecx+0xc) 0/r32/eax
8037 05/add-to-eax 4/imm32
8038 (print-int32-buffered *(ebp+8) %eax)
8039 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32
8040 }
8041
8042 8b/-> *(edx+4) 0/r32/eax
8043 81 7/subop/compare *eax 0/imm32/false
8044 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32
8045
8046 (is-simple-mu-type? *(eax+4) 7)
8047 3d/compare-eax-and 0/imm32/false
8048 {
8049 0f 84/jump-if-= break/disp32
8050
8051 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index:
8052 (write-buffered *(ebp+8) *(edx+0x10))
8053 }
8054 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done:
8055 (write-buffered *(ebp+8) ") ")
8056 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
8057 }
8058
8059 (is-simple-mu-type? *(edx+4) 0)
8060 3d/compare-eax-and 0/imm32/false
8061 {
8062 0f 84/jump-if-= break/disp32
8063 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index:
8064
8065 (parse-hex-int *edx)
8066 89/<- %ebx 0/r32/eax
8067
8068 (array-element-type-id %ecx)
8069 (size-of-type-id %eax)
8070 f7 4/subop/multiply-into-eax %ebx
8071
8072 03/add *(ecx+0xc) 0/r32/eax
8073
8074 05/add-to-eax 4/imm32
8075
8076
8077 (print-int32-buffered *(ebp+8) %eax)
8078 (write-buffered *(ebp+8) ") ")
8079 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32
8080 }
8081
8082 e9/jump $translate-mu-index-stmt-with-array:error1/disp32
8083 $translate-mu-index-stmt-with-array-on-stack:emit-output:
8084
8085 8b/-> *(ebp+0xc) 0/r32/eax
8086 8b/-> *(eax+0xc) 0/r32/eax
8087 8b/-> *eax 0/r32/eax
8088 (get Registers *(eax+0x10) 8 "Registers")
8089 (print-int32-buffered *(ebp+8) *eax)
8090 (write-buffered *(ebp+8) "/r32\n")
8091 $translate-mu-index-stmt-with-array-on-stack:end:
8092
8093 5b/pop-to-ebx
8094 5a/pop-to-edx
8095 59/pop-to-ecx
8096 58/pop-to-eax
8097
8098 89/<- %esp 5/r32/ebp
8099 5d/pop-to-ebp
8100 c3/return
8101
8102 translate-mu-compute-index-stmt:
8103
8104 55/push-ebp
8105 89/<- %ebp 4/r32/esp
8106
8107 50/push-eax
8108 51/push-ecx
8109 52/push-edx
8110 53/push-ebx
8111
8112 (emit-indent *(ebp+8) *Curr-block-depth)
8113 (write-buffered *(ebp+8) "69/multiply")
8114
8115 8b/-> *(ebp+0xc) 1/r32/ecx
8116
8117 8b/-> *(ecx+8) 2/r32/edx
8118 $translate-mu-compute-index-stmt:emit-index:
8119 (emit-subx-var-as-rm32 *(ebp+8) *(edx+4))
8120 (write-buffered *(ebp+8) Space)
8121 $translate-mu-compute-index-stmt:emit-elem-size:
8122
8123 8b/-> *edx 3/r32/ebx
8124
8125 (array-element-type-id %ebx)
8126 (size-of-type-id %eax)
8127 (print-int32-buffered *(ebp+8) %eax)
8128 (write-buffered *(ebp+8) "/imm32 ")
8129 $translate-mu-compute-index-stmt:emit-output:
8130
8131 8b/-> *(ecx+0xc) 0/r32/eax
8132 8b/-> *eax 0/r32/eax
8133 (get Registers *(eax+0x10) 8 "Registers")
8134 (print-int32-buffered *(ebp+8) *eax)
8135 (write-buffered *(ebp+8) "/r32\n")
8136 $translate-mu-compute-index-stmt:end:
8137
8138 5b/pop-to-ebx
8139 5a/pop-to-edx
8140 59/pop-to-ecx
8141 58/pop-to-eax
8142
8143 89/<- %esp 5/r32/ebp
8144 5d/pop-to-ebp
8145 c3/return
8146
8147 translate-mu-get-stmt:
8148
8149 55/push-ebp
8150 89/<- %ebp 4/r32/esp
8151
8152 50/push-eax
8153 51/push-ecx
8154 52/push-edx
8155
8156 (emit-indent *(ebp+8) *Curr-block-depth)
8157 (write-buffered *(ebp+8) "8d/copy-address ")
8158
8159 8b/-> *(ebp+0xc) 1/r32/ecx
8160
8161 (mu-get-offset %ecx)
8162 89/<- %edx 0/r32/eax
8163
8164 8b/-> *(ecx+8) 0/r32/eax
8165 8b/-> *eax 0/r32/eax
8166
8167 81 7/subop/compare *(eax+0x10) 0/imm32
8168 {
8169 0f 84/jump-if-= break/disp32
8170 $translate-mu-get-stmt:emit-register-input:
8171
8172 (write-buffered *(ebp+8) "*(")
8173 (write-buffered *(ebp+8) *(eax+0x10))
8174 (write-buffered *(ebp+8) " + ")
8175 (print-int32-buffered *(ebp+8) %edx)
8176 (write-buffered *(ebp+8) ") ")
8177 e9/jump $translate-mu-get-stmt:emit-output/disp32
8178 }
8179
8180 {
8181 $translate-mu-get-stmt:emit-stack-input:
8182
8183 (write-buffered *(ebp+8) "*(ebp+")
8184 03/add *(eax+0xc) 2/r32/edx
8185 (print-int32-buffered *(ebp+8) %edx)
8186 (write-buffered *(ebp+8) ") ")
8187 eb/jump $translate-mu-get-stmt:emit-output/disp8
8188 }
8189 $translate-mu-get-stmt:emit-output:
8190
8191 8b/-> *(ecx+0xc) 0/r32/eax
8192 8b/-> *eax 0/r32/eax
8193 (get Registers *(eax+0x10) 8 "Registers")
8194 (print-int32-buffered *(ebp+8) *eax)
8195 (write-buffered *(ebp+8) "/r32\n")
8196 $translate-mu-get-stmt:end:
8197
8198 5a/pop-to-edx
8199 59/pop-to-ecx
8200 58/pop-to-eax
8201
8202 89/<- %esp 5/r32/ebp
8203 5d/pop-to-ebp
8204 c3/return
8205
8206 array-element-type-id:
8207
8208
8209 55/push-ebp
8210 89/<- %ebp 4/r32/esp
8211
8212 8b/-> *(ebp+8) 0/r32/eax
8213 8b/-> *(eax+4) 0/r32/eax
8214
8215 8b/-> *(eax+8) 0/r32/eax
8216
8217
8218 8b/-> *(eax+8) 0/r32/eax
8219
8220 8b/-> *(eax+4) 0/r32/eax
8221 8b/-> *(eax+4) 0/r32/eax
8222 $array-element-type-id:end:
8223
8224 89/<- %esp 5/r32/ebp
8225 5d/pop-to-ebp
8226 c3/return
8227
8228 num-shift-rights:
8229
8230
8231 55/push-ebp
8232 89/<- %ebp 4/r32/esp
8233
8234 51/push-ecx
8235
8236 8b/-> *(ebp+8) 1/r32/ecx
8237
8238 b8/copy-to-eax 0/imm32
8239 {
8240
8241 81 7/subop/compare %ecx 1/imm32
8242 7e/jump-if-<= break/disp8
8243 40/increment-eax
8244 c1/shift 5/subop/arithmetic-right %ecx 1/imm8
8245 eb/jump loop/disp8
8246 }
8247 $num-shift-rights:end:
8248
8249 59/pop-to-ecx
8250
8251 89/<- %esp 5/r32/ebp
8252 5d/pop-to-ebp
8253 c3/return
8254
8255 mu-get-offset:
8256
8257 55/push-ebp
8258 89/<- %ebp 4/r32/esp
8259
8260 8b/-> *(ebp+8) 0/r32/eax
8261 8b/-> *(eax+8) 0/r32/eax
8262 8b/-> *(eax+4) 0/r32/eax
8263
8264 8b/-> *eax 0/r32/eax
8265
8266 8b/-> *(eax+0xc) 0/r32/eax
8267 $emit-get-offset:end:
8268
8269 89/<- %esp 5/r32/ebp
8270 5d/pop-to-ebp
8271 c3/return
8272
8273 emit-subx-block:
8274
8275 55/push-ebp
8276 89/<- %ebp 4/r32/esp
8277
8278 50/push-eax
8279 51/push-ecx
8280 56/push-esi
8281
8282 8b/-> *(ebp+0xc) 6/r32/esi
8283
8284 8b/-> *(esi+8) 0/r32/eax
8285 8b/-> *Curr-block-depth 1/r32/ecx
8286 89/<- *(eax+8) 1/r32/ecx
8287
8288 8b/-> *(esi+4) 0/r32/eax
8289
8290 {
8291 $emit-subx-block:check-empty:
8292 3d/compare-eax-and 0/imm32
8293 0f 84/jump-if-= break/disp32
8294 (emit-indent *(ebp+8) *Curr-block-depth)
8295 (write-buffered *(ebp+8) "{\n")
8296
8297 8b/-> *(esi+8) 1/r32/ecx
8298
8299 (write-buffered *(ebp+8) *ecx)
8300 (write-buffered *(ebp+8) ":loop:\n")
8301 ff 0/subop/increment *Curr-block-depth
8302 (push *(ebp+0x10) %ecx)
8303 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10))
8304 (pop *(ebp+0x10))
8305 ff 1/subop/decrement *Curr-block-depth
8306 (emit-indent *(ebp+8) *Curr-block-depth)
8307 (write-buffered *(ebp+8) "}\n")
8308 (write-buffered *(ebp+8) *ecx)
8309 (write-buffered *(ebp+8) ":break:\n")
8310 }
8311 $emit-subx-block:end:
8312
8313 5e/pop-to-esi
8314 59/pop-to-ecx
8315 58/pop-to-eax
8316
8317 89/<- %esp 5/r32/ebp
8318 5d/pop-to-ebp
8319 c3/return
8320
8321
8322
8323 == data
8324 Primitives:
8325
8326 _Primitive-inc-eax:
8327
8328 "increment"/imm32/name
8329 0/imm32/no-inouts
8330 Single-int-var-in-eax/imm32/outputs
8331 "40/increment-eax"/imm32/subx-name
8332 0/imm32/no-rm32
8333 0/imm32/no-r32
8334 0/imm32/no-imm32
8335 0/imm32/no-disp32
8336 0/imm32/output-is-write-only
8337 _Primitive-inc-ecx/imm32/next
8338 _Primitive-inc-ecx:
8339
8340 "increment"/imm32/name
8341 0/imm32/no-inouts
8342 Single-int-var-in-ecx/imm32/outputs
8343 "41/increment-ecx"/imm32/subx-name
8344 0/imm32/no-rm32
8345 0/imm32/no-r32
8346 0/imm32/no-imm32
8347 0/imm32/no-disp32
8348 0/imm32/output-is-write-only
8349 _Primitive-inc-edx/imm32/next
8350 _Primitive-inc-edx:
8351
8352 "increment"/imm32/name
8353 0/imm32/no-inouts
8354 Single-int-var-in-edx/imm32/outputs
8355 "42/increment-edx"/imm32/subx-name
8356 0/imm32/no-rm32
8357 0/imm32/no-r32
8358 0/imm32/no-imm32
8359 0/imm32/no-disp32
8360 0/imm32/output-is-write-only
8361 _Primitive-inc-ebx/imm32/next
8362 _Primitive-inc-ebx:
8363
8364 "increment"/imm32/name
8365 0/imm32/no-inouts
8366 Single-int-var-in-ebx/imm32/outputs
8367 "43/increment-ebx"/imm32/subx-name
8368 0/imm32/no-rm32
8369 0/imm32/no-r32
8370 0/imm32/no-imm32
8371 0/imm32/no-disp32
8372 0/imm32/output-is-write-only
8373 _Primitive-inc-esi/imm32/next
8374 _Primitive-inc-esi:
8375
8376 "increment"/imm32/name
8377 0/imm32/no-inouts
8378 Single-int-var-in-esi/imm32/outputs
8379 "46/increment-esi"/imm32/subx-name
8380 0/imm32/no-rm32
8381 0/imm32/no-r32
8382 0/imm32/no-imm32
8383 0/imm32/no-disp32
8384 0/imm32/output-is-write-only
8385 _Primitive-inc-edi/imm32/next
8386 _Primitive-inc-edi:
8387
8388 "increment"/imm32/name
8389 0/imm32/no-inouts
8390 Single-int-var-in-edi/imm32/outputs
8391 "47/increment-edi"/imm32/subx-name
8392 0/imm32/no-rm32
8393 0/imm32/no-r32
8394 0/imm32/no-imm32
8395 0/imm32/no-disp32
8396 0/imm32/output-is-write-only
8397 _Primitive-dec-eax/imm32/next
8398 _Primitive-dec-eax:
8399
8400 "decrement"/imm32/name
8401 0/imm32/no-inouts
8402 Single-int-var-in-eax/imm32/outputs
8403 "48/decrement-eax"/imm32/subx-name
8404 0/imm32/no-rm32
8405 0/imm32/no-r32
8406 0/imm32/no-imm32
8407 0/imm32/no-disp32
8408 0/imm32/output-is-write-only
8409 _Primitive-dec-ecx/imm32/next
8410 _Primitive-dec-ecx:
8411
8412 "decrement"/imm32/name
8413 0/imm32/no-inouts
8414 Single-int-var-in-ecx/imm32/outputs
8415 "49/decrement-ecx"/imm32/subx-name
8416 0/imm32/no-rm32
8417 0/imm32/no-r32
8418 0/imm32/no-imm32
8419 0/imm32/no-disp32
8420 0/imm32/output-is-write-only
8421 _Primitive-dec-edx/imm32/next
8422 _Primitive-dec-edx:
8423
8424 "decrement"/imm32/name
8425 0/imm32/no-inouts
8426 Single-int-var-in-edx/imm32/outputs
8427 "4a/decrement-edx"/imm32/subx-name
8428 0/imm32/no-rm32
8429 0/imm32/no-r32
8430 0/imm32/no-imm32
8431 0/imm32/no-disp32
8432 0/imm32/output-is-write-only
8433 _Primitive-dec-ebx/imm32/next
8434 _Primitive-dec-ebx:
8435
8436 "decrement"/imm32/name
8437 0/imm32/no-inouts
8438 Single-int-var-in-ebx/imm32/outputs
8439 "4b/decrement-ebx"/imm32/subx-name
8440 0/imm32/no-rm32
8441 0/imm32/no-r32
8442 0/imm32/no-imm32
8443 0/imm32/no-disp32
8444 0/imm32/output-is-write-only
8445 _Primitive-dec-esi/imm32/next
8446 _Primitive-dec-esi:
8447
8448 "decrement"/imm32/name
8449 0/imm32/no-inouts
8450 Single-int-var-in-esi/imm32/outputs
8451 "4e/decrement-esi"/imm32/subx-name
8452 0/imm32/no-rm32
8453 0/imm32/no-r32
8454 0/imm32/no-imm32
8455 0/imm32/no-disp32
8456 0/imm32/output-is-write-only
8457 _Primitive-dec-edi/imm32/next
8458 _Primitive-dec-edi:
8459
8460 "decrement"/imm32/name
8461 0/imm32/no-inouts
8462 Single-int-var-in-edi/imm32/outputs
8463 "4f/decrement-edi"/imm32/subx-name
8464 0/imm32/no-rm32
8465 0/imm32/no-r32
8466 0/imm32/no-imm32
8467 0/imm32/no-disp32
8468 0/imm32/output-is-write-only
8469 _Primitive-inc-mem/imm32/next
8470 _Primitive-inc-mem:
8471
8472 "increment"/imm32/name
8473 Single-int-var-in-mem/imm32/inouts
8474 0/imm32/no-outputs
8475 "ff 0/subop/increment"/imm32/subx-name
8476 1/imm32/rm32-is-first-inout
8477 0/imm32/no-r32
8478 0/imm32/no-imm32
8479 0/imm32/no-disp32
8480 0/imm32/output-is-write-only
8481 _Primitive-inc-reg/imm32/next
8482 _Primitive-inc-reg:
8483
8484 "increment"/imm32/name
8485 0/imm32/no-inouts
8486 Single-int-var-in-some-register/imm32/outputs
8487 "ff 0/subop/increment"/imm32/subx-name
8488 3/imm32/rm32-is-first-output
8489 0/imm32/no-r32
8490 0/imm32/no-imm32
8491 0/imm32/no-disp32
8492 0/imm32/output-is-write-only
8493 _Primitive-dec-mem/imm32/next
8494 _Primitive-dec-mem:
8495
8496 "decrement"/imm32/name
8497 Single-int-var-in-mem/imm32/inouts
8498 0/imm32/no-outputs
8499 "ff 1/subop/decrement"/imm32/subx-name
8500 1/imm32/rm32-is-first-inout
8501 0/imm32/no-r32
8502 0/imm32/no-imm32
8503 0/imm32/no-disp32
8504 0/imm32/output-is-write-only
8505 _Primitive-dec-reg/imm32/next
8506 _Primitive-dec-reg:
8507
8508 "decrement"/imm32/name
8509 0/imm32/no-inouts
8510 Single-int-var-in-some-register/imm32/outputs
8511 "ff 1/subop/decrement"/imm32/subx-name
8512 3/imm32/rm32-is-first-output
8513 0/imm32/no-r32
8514 0/imm32/no-imm32
8515 0/imm32/no-disp32
8516 0/imm32/output-is-write-only
8517 _Primitive-add-to-eax/imm32/next
8518
8519 _Primitive-add-to-eax:
8520
8521 "add"/imm32/name
8522 Single-lit-var/imm32/inouts
8523 Single-int-var-in-eax/imm32/outputs
8524 "05/add-to-eax"/imm32/subx-name
8525 0/imm32/no-rm32
8526 0/imm32/no-r32
8527 1/imm32/imm32-is-first-inout
8528 0/imm32/no-disp32
8529 0/imm32/output-is-write-only
8530 _Primitive-add-reg-to-reg/imm32/next
8531 _Primitive-add-reg-to-reg:
8532
8533 "add"/imm32/name
8534 Single-int-var-in-some-register/imm32/inouts
8535 Single-int-var-in-some-register/imm32/outputs
8536 "01/add-to"/imm32/subx-name
8537 3/imm32/rm32-is-first-output
8538 1/imm32/r32-is-first-inout
8539 0/imm32/no-imm32
8540 0/imm32/no-disp32
8541 0/imm32/output-is-write-only
8542 _Primitive-add-reg-to-mem/imm32/next
8543 _Primitive-add-reg-to-mem:
8544
8545 "add-to"/imm32/name
8546 Two-args-int-stack-int-reg/imm32/inouts
8547 0/imm32/outputs
8548 "01/add-to"/imm32/subx-name
8549 1/imm32/rm32-is-first-inout
8550 2/imm32/r32-is-second-inout
8551 0/imm32/no-imm32
8552 0/imm32/no-disp32
8553 0/imm32/output-is-write-only
8554 _Primitive-add-mem-to-reg/imm32/next
8555 _Primitive-add-mem-to-reg:
8556
8557 "add"/imm32/name
8558 Single-int-var-in-mem/imm32/inouts
8559 Single-int-var-in-some-register/imm32/outputs
8560 "03/add"/imm32/subx-name
8561 1/imm32/rm32-is-first-inout
8562 3/imm32/r32-is-first-output
8563 0/imm32/no-imm32
8564 0/imm32/no-disp32
8565 0/imm32/output-is-write-only
8566 _Primitive-add-lit-to-reg/imm32/next
8567 _Primitive-add-lit-to-reg:
8568
8569 "add"/imm32/name
8570 Single-lit-var/imm32/inouts
8571 Single-int-var-in-some-register/imm32/outputs
8572 "81 0/subop/add"/imm32/subx-name
8573 3/imm32/rm32-is-first-output
8574 0/imm32/no-r32
8575 1/imm32/imm32-is-first-inout
8576 0/imm32/no-disp32
8577 0/imm32/output-is-write-only
8578 _Primitive-add-lit-to-mem/imm32/next
8579 _Primitive-add-lit-to-mem:
8580
8581 "add-to"/imm32/name
8582 Int-var-and-literal/imm32/inouts
8583 0/imm32/outputs
8584 "81 0/subop/add"/imm32/subx-name
8585 1/imm32/rm32-is-first-inout
8586 0/imm32/no-r32
8587 2/imm32/imm32-is-second-inout
8588 0/imm32/no-disp32
8589 0/imm32/output-is-write-only
8590 _Primitive-subtract-from-eax/imm32/next
8591
8592 _Primitive-subtract-from-eax:
8593
8594 "subtract"/imm32/name
8595 Single-lit-var/imm32/inouts
8596 Single-int-var-in-eax/imm32/outputs
8597 "2d/subtract-from-eax"/imm32/subx-name
8598 0/imm32/no-rm32
8599 0/imm32/no-r32
8600 1/imm32/imm32-is-first-inout
8601 0/imm32/no-disp32
8602 0/imm32/output-is-write-only
8603 _Primitive-subtract-reg-from-reg/imm32/next
8604 _Primitive-subtract-reg-from-reg:
8605
8606 "subtract"/imm32/name
8607 Single-int-var-in-some-register/imm32/inouts
8608 Single-int-var-in-some-register/imm32/outputs
8609 "29/subtract-from"/imm32/subx-name
8610 3/imm32/rm32-is-first-output
8611 1/imm32/r32-is-first-inout
8612 0/imm32/no-imm32
8613 0/imm32/no-disp32
8614 0/imm32/output-is-write-only
8615 _Primitive-subtract-reg-from-mem/imm32/next
8616 _Primitive-subtract-reg-from-mem:
8617
8618 "subtract-from"/imm32/name
8619 Two-args-int-stack-int-reg/imm32/inouts
8620 0/imm32/outputs
8621 "29/subtract-from"/imm32/subx-name
8622 1/imm32/rm32-is-first-inout
8623 2/imm32/r32-is-second-inout
8624 0/imm32/no-imm32
8625 0/imm32/no-disp32
8626 0/imm32/output-is-write-only
8627 _Primitive-subtract-mem-from-reg/imm32/next
8628 _Primitive-subtract-mem-from-reg:
8629
8630 "subtract"/imm32/name
8631 Single-int-var-in-mem/imm32/inouts
8632 Single-int-var-in-some-register/imm32/outputs
8633 "2b/subtract"/imm32/subx-name
8634 1/imm32/rm32-is-first-inout
8635 3/imm32/r32-is-first-output
8636 0/imm32/no-imm32
8637 0/imm32/no-disp32
8638 0/imm32/output-is-write-only
8639 _Primitive-subtract-lit-from-reg/imm32/next
8640 _Primitive-subtract-lit-from-reg:
8641
8642 "subtract"/imm32/name
8643 Single-lit-var/imm32/inouts
8644 Single-int-var-in-some-register/imm32/outputs
8645 "81 5/subop/subtract"/imm32/subx-name
8646 3/imm32/rm32-is-first-output
8647 0/imm32/no-r32
8648 1/imm32/imm32-is-first-inout
8649 0/imm32/no-disp32
8650 0/imm32/output-is-write-only
8651 _Primitive-subtract-lit-from-mem/imm32/next
8652 _Primitive-subtract-lit-from-mem:
8653
8654 "subtract-from"/imm32/name
8655 Int-var-and-literal/imm32/inouts
8656 0/imm32/outputs
8657 "81 5/subop/subtract"/imm32/subx-name
8658 1/imm32/rm32-is-first-inout
8659 0/imm32/no-r32
8660 2/imm32/imm32-is-first-inout
8661 0/imm32/no-disp32
8662 0/imm32/output-is-write-only
8663 _Primitive-and-with-eax/imm32/next
8664
8665 _Primitive-and-with-eax:
8666
8667 "and"/imm32/name
8668 Single-lit-var/imm32/inouts
8669 Single-int-var-in-eax/imm32/outputs
8670 "25/and-with-eax"/imm32/subx-name
8671 0/imm32/no-rm32
8672 0/imm32/no-r32
8673 1/imm32/imm32-is-first-inout
8674 0/imm32/no-disp32
8675 0/imm32/output-is-write-only
8676 _Primitive-and-reg-with-reg/imm32/next
8677 _Primitive-and-reg-with-reg:
8678
8679 "and"/imm32/name
8680 Single-int-var-in-some-register/imm32/inouts
8681 Single-int-var-in-some-register/imm32/outputs
8682 "21/and-with"/imm32/subx-name
8683 3/imm32/rm32-is-first-output
8684 1/imm32/r32-is-first-inout
8685 0/imm32/no-imm32
8686 0/imm32/no-disp32
8687 0/imm32/output-is-write-only
8688 _Primitive-and-reg-with-mem/imm32/next
8689 _Primitive-and-reg-with-mem:
8690
8691 "and-with"/imm32/name
8692 Two-args-int-stack-int-reg/imm32/inouts
8693 0/imm32/outputs
8694 "21/and-with"/imm32/subx-name
8695 1/imm32/rm32-is-first-inout
8696 2/imm32/r32-is-second-inout
8697 0/imm32/no-imm32
8698 0/imm32/no-disp32
8699 0/imm32/output-is-write-only
8700 _Primitive-and-mem-with-reg/imm32/next
8701 _Primitive-and-mem-with-reg:
8702
8703 "and"/imm32/name
8704 Single-int-var-in-mem/imm32/inouts
8705 Single-int-var-in-some-register/imm32/outputs
8706 "23/and"/imm32/subx-name
8707 1/imm32/rm32-is-first-inout
8708 3/imm32/r32-is-first-output
8709 0/imm32/no-imm32
8710 0/imm32/no-disp32
8711 0/imm32/output-is-write-only
8712 _Primitive-and-lit-with-reg/imm32/next
8713 _Primitive-and-lit-with-reg:
8714
8715 "and"/imm32/name
8716 Single-lit-var/imm32/inouts
8717 Single-int-var-in-some-register/imm32/outputs
8718 "81 4/subop/and"/imm32/subx-name
8719 3/imm32/rm32-is-first-output
8720 0/imm32/no-r32
8721 1/imm32/imm32-is-first-inout
8722 0/imm32/no-disp32
8723 0/imm32/output-is-write-only
8724 _Primitive-and-lit-with-mem/imm32/next
8725 _Primitive-and-lit-with-mem:
8726
8727 "and-with"/imm32/name
8728 Int-var-and-literal/imm32/inouts
8729 0/imm32/outputs
8730 "81 4/subop/and"/imm32/subx-name
8731 1/imm32/rm32-is-first-inout
8732 0/imm32/no-r32
8733 2/imm32/imm32-is-first-inout
8734 0/imm32/no-disp32
8735 0/imm32/output-is-write-only
8736 _Primitive-or-with-eax/imm32/next
8737
8738 _Primitive-or-with-eax:
8739
8740 "or"/imm32/name
8741 Single-lit-var/imm32/inouts
8742 Single-int-var-in-eax/imm32/outputs
8743 "0d/or-with-eax"/imm32/subx-name
8744 0/imm32/no-rm32
8745 0/imm32/no-r32
8746 1/imm32/imm32-is-first-inout
8747 0/imm32/no-disp32
8748 0/imm32/output-is-write-only
8749 _Primitive-or-reg-with-reg/imm32/next
8750 _Primitive-or-reg-with-reg:
8751
8752 "or"/imm32/name
8753 Single-int-var-in-some-register/imm32/inouts
8754 Single-int-var-in-some-register/imm32/outputs
8755 "09/or-with"/imm32/subx-name
8756 3/imm32/rm32-is-first-output
8757 1/imm32/r32-is-first-inout
8758 0/imm32/no-imm32
8759 0/imm32/no-disp32
8760 0/imm32/output-is-write-only
8761 _Primitive-or-reg-with-mem/imm32/next
8762 _Primitive-or-reg-with-mem:
8763
8764 "or-with"/imm32/name
8765 Two-args-int-stack-int-reg/imm32/inouts
8766 0/imm32/outputs
8767 "09/or-with"/imm32/subx-name
8768 1/imm32/rm32-is-first-inout
8769 2/imm32/r32-is-second-inout
8770 0/imm32/no-imm32
8771 0/imm32/no-disp32
8772 0/imm32/output-is-write-only
8773 _Primitive-or-mem-with-reg/imm32/next
8774 _Primitive-or-mem-with-reg:
8775
8776 "or"/imm32/name
8777 Single-int-var-in-mem/imm32/inouts
8778 Single-int-var-in-some-register/imm32/outputs
8779 "0b/or"/imm32/subx-name
8780 1/imm32/rm32-is-first-inout
8781 3/imm32/r32-is-first-output
8782 0/imm32/no-imm32
8783 0/imm32/no-disp32
8784 0/imm32/output-is-write-only
8785 _Primitive-or-lit-with-reg/imm32/next
8786 _Primitive-or-lit-with-reg:
8787
8788 "or"/imm32/name
8789 Single-lit-var/imm32/inouts
8790 Single-int-var-in-some-register/imm32/outputs
8791 "81 1/subop/or"/imm32/subx-name
8792 3/imm32/rm32-is-first-output
8793 0/imm32/no-r32
8794 1/imm32/imm32-is-first-inout
8795 0/imm32/no-disp32
8796 0/imm32/output-is-write-only
8797 _Primitive-or-lit-with-mem/imm32/next
8798 _Primitive-or-lit-with-mem:
8799
8800 "or-with"/imm32/name
8801 Int-var-and-literal/imm32/inouts
8802 0/imm32/outputs
8803 "81 1/subop/or"/imm32/subx-name
8804 1/imm32/rm32-is-first-inout
8805 0/imm32/no-r32
8806 2/imm32/imm32-is-second-inout
8807 0/imm32/no-disp32
8808 0/imm32/output-is-write-only
8809 _Primitive-xor-with-eax/imm32/next
8810
8811 _Primitive-xor-with-eax:
8812
8813 "xor"/imm32/name
8814 Single-lit-var/imm32/inouts
8815 Single-int-var-in-eax/imm32/outputs
8816 "35/xor-with-eax"/imm32/subx-name
8817 0/imm32/no-rm32
8818 0/imm32/no-r32
8819 1/imm32/imm32-is-first-inout
8820 0/imm32/no-disp32
8821 0/imm32/output-is-write-only
8822 _Primitive-xor-reg-with-reg/imm32/next
8823 _Primitive-xor-reg-with-reg:
8824
8825 "xor"/imm32/name
8826 Single-int-var-in-some-register/imm32/inouts
8827 Single-int-var-in-some-register/imm32/outputs
8828 "31/xor-with"/imm32/subx-name
8829 3/imm32/rm32-is-first-output
8830 1/imm32/r32-is-first-inout
8831 0/imm32/no-imm32
8832 0/imm32/no-disp32
8833 0/imm32/output-is-write-only
8834 _Primitive-xor-reg-with-mem/imm32/next
8835 _Primitive-xor-reg-with-mem:
8836
8837 "xor-with"/imm32/name
8838 Two-args-int-stack-int-reg/imm32/inouts
8839 0/imm32/outputs
8840 "31/xor-with"/imm32/subx-name
8841 1/imm32/rm32-is-first-inout
8842 2/imm32/r32-is-second-inout
8843 0/imm32/no-imm32
8844 0/imm32/no-disp32
8845 0/imm32/output-is-write-only
8846 _Primitive-xor-mem-with-reg/imm32/next
8847 _Primitive-xor-mem-with-reg:
8848
8849 "xor"/imm32/name
8850 Single-int-var-in-mem/imm32/inouts
8851 Single-int-var-in-some-register/imm32/outputs
8852 "33/xor"/imm32/subx-name
8853 1/imm32/rm32-is-first-inout
8854 3/imm32/r32-is-first-output
8855 0/imm32/no-imm32
8856 0/imm32/no-disp32
8857 0/imm32/output-is-write-only
8858 _Primitive-xor-lit-with-reg/imm32/next
8859 _Primitive-xor-lit-with-reg:
8860
8861 "xor"/imm32/name
8862 Single-lit-var/imm32/inouts
8863 Single-int-var-in-some-register/imm32/outputs
8864 "81 6/subop/xor"/imm32/subx-name
8865 3/imm32/rm32-is-first-output
8866 0/imm32/no-r32
8867 1/imm32/imm32-is-first-inout
8868 0/imm32/no-disp32
8869 0/imm32/output-is-write-only
8870 _Primitive-xor-lit-with-mem/imm32/next
8871 _Primitive-xor-lit-with-mem:
8872
8873 "xor-with"/imm32/name
8874 Int-var-and-literal/imm32/inouts
8875 0/imm32/outputs
8876 "81 6/subop/xor"/imm32/subx-name
8877 1/imm32/rm32-is-first-inout
8878 0/imm32/no-r32
8879 2/imm32/imm32-is-first-inout
8880 0/imm32/no-disp32
8881 0/imm32/output-is-write-only
8882 _Primitive-copy-to-eax/imm32/next
8883
8884 _Primitive-copy-to-eax:
8885
8886 "copy"/imm32/name
8887 Single-lit-var/imm32/inouts
8888 Single-int-var-in-eax/imm32/outputs
8889 "b8/copy-to-eax"/imm32/subx-name
8890 0/imm32/no-rm32
8891 0/imm32/no-r32
8892 1/imm32/imm32-is-first-inout
8893 0/imm32/no-disp32
8894 1/imm32/output-is-write-only
8895 _Primitive-copy-to-ecx/imm32/next
8896 _Primitive-copy-to-ecx:
8897
8898 "copy"/imm32/name
8899 Single-lit-var/imm32/inouts
8900 Single-int-var-in-ecx/imm32/outputs
8901 "b9/copy-to-ecx"/imm32/subx-name
8902 0/imm32/no-rm32
8903 0/imm32/no-r32
8904 1/imm32/imm32-is-first-inout
8905 0/imm32/no-disp32
8906 1/imm32/output-is-write-only
8907 _Primitive-copy-to-edx/imm32/next
8908 _Primitive-copy-to-edx:
8909
8910 "copy"/imm32/name
8911 Single-lit-var/imm32/inouts
8912 Single-int-var-in-edx/imm32/outputs
8913 "ba/copy-to-edx"/imm32/subx-name
8914 0/imm32/no-rm32
8915 0/imm32/no-r32
8916 1/imm32/imm32-is-first-inout
8917 0/imm32/no-disp32
8918 1/imm32/output-is-write-only
8919 _Primitive-copy-to-ebx/imm32/next
8920 _Primitive-copy-to-ebx:
8921
8922 "copy"/imm32/name
8923 Single-lit-var/imm32/inouts
8924 Single-int-var-in-ebx/imm32/outputs
8925 "bb/copy-to-ebx"/imm32/subx-name
8926 0/imm32/no-rm32
8927 0/imm32/no-r32
8928 1/imm32/imm32-is-first-inout
8929 0/imm32/no-disp32
8930 1/imm32/output-is-write-only
8931 _Primitive-copy-to-esi/imm32/next
8932 _Primitive-copy-to-esi:
8933
8934 "copy"/imm32/name
8935 Single-lit-var/imm32/inouts
8936 Single-int-var-in-esi/imm32/outputs
8937 "be/copy-to-esi"/imm32/subx-name
8938 0/imm32/no-rm32
8939 0/imm32/no-r32
8940 1/imm32/imm32-is-first-inout
8941 0/imm32/no-disp32
8942 1/imm32/output-is-write-only
8943 _Primitive-copy-to-edi/imm32/next
8944 _Primitive-copy-to-edi:
8945
8946 "copy"/imm32/name
8947 Single-lit-var/imm32/inouts
8948 Single-int-var-in-edi/imm32/outputs
8949 "bf/copy-to-edi"/imm32/subx-name
8950 0/imm32/no-rm32
8951 0/imm32/no-r32
8952 1/imm32/imm32-is-first-inout
8953 0/imm32/no-disp32
8954 1/imm32/output-is-write-only
8955 _Primitive-copy-reg-to-reg/imm32/next
8956 _Primitive-copy-reg-to-reg:
8957
8958 "copy"/imm32/name
8959 Single-int-var-in-some-register/imm32/inouts
8960 Single-int-var-in-some-register/imm32/outputs
8961 "89/<-"/imm32/subx-name
8962 3/imm32/rm32-is-first-output
8963 1/imm32/r32-is-first-inout
8964 0/imm32/no-imm32
8965 0/imm32/no-disp32
8966 1/imm32/output-is-write-only
8967 _Primitive-copy-reg-to-mem/imm32/next
8968 _Primitive-copy-reg-to-mem:
8969
8970 "copy-to"/imm32/name
8971 Two-args-int-stack-int-reg/imm32/inouts
8972 0/imm32/outputs
8973 "89/<-"/imm32/subx-name
8974 1/imm32/rm32-is-first-inout
8975 2/imm32/r32-is-second-inout
8976 0/imm32/no-imm32
8977 0/imm32/no-disp32
8978 1/imm32/output-is-write-only
8979 _Primitive-copy-mem-to-reg/imm32/next
8980 _Primitive-copy-mem-to-reg:
8981
8982 "copy"/imm32/name
8983 Single-int-var-in-mem/imm32/inouts
8984 Single-int-var-in-some-register/imm32/outputs
8985 "8b/->"/imm32/subx-name
8986 1/imm32/rm32-is-first-inout
8987 3/imm32/r32-is-first-output
8988 0/imm32/no-imm32
8989 0/imm32/no-disp32
8990 1/imm32/output-is-write-only
8991 _Primitive-copy-lit-to-reg/imm32/next
8992 _Primitive-copy-lit-to-reg:
8993
8994 "copy"/imm32/name
8995 Single-lit-var/imm32/inouts
8996 Single-int-var-in-some-register/imm32/outputs
8997 "c7 0/subop/copy"/imm32/subx-name
8998 3/imm32/rm32-is-first-output
8999 0/imm32/no-r32
9000 1/imm32/imm32-is-first-inout
9001 0/imm32/no-disp32
9002 1/imm32/output-is-write-only
9003 _Primitive-copy-lit-to-mem/imm32/next
9004 _Primitive-copy-lit-to-mem:
9005
9006 "copy-to"/imm32/name
9007 Int-var-and-literal/imm32/inouts
9008 0/imm32/outputs
9009 "c7 0/subop/copy"/imm32/subx-name
9010 1/imm32/rm32-is-first-inout
9011 0/imm32/no-r32
9012 2/imm32/imm32-is-first-inout
9013 0/imm32/no-disp32
9014 1/imm32/output-is-write-only
9015 _Primitive-address/imm32/next
9016
9017 _Primitive-address:
9018
9019 "address"/imm32/name
9020 Single-int-var-in-mem/imm32/inouts
9021 Single-addr-var-in-some-register/imm32/outputs
9022 "8d/copy-address"/imm32/subx-name
9023 1/imm32/rm32-is-first-inout
9024 3/imm32/r32-is-first-output
9025 0/imm32/no-imm32
9026 0/imm32/no-disp32
9027 1/imm32/output-is-write-only
9028 _Primitive-compare-mem-with-reg/imm32/next
9029
9030 _Primitive-compare-mem-with-reg:
9031
9032 "compare"/imm32/name
9033 Two-args-int-stack-int-reg/imm32/inouts
9034 0/imm32/outputs
9035 "39/compare->"/imm32/subx-name
9036 1/imm32/rm32-is-first-inout
9037 2/imm32/r32-is-second-inout
9038 0/imm32/no-imm32
9039 0/imm32/no-disp32
9040 0/imm32/output-is-write-only
9041 _Primitive-compare-reg-with-mem/imm32/next
9042 _Primitive-compare-reg-with-mem:
9043
9044 "compare"/imm32/name
9045 Two-args-int-reg-int-stack/imm32/inouts
9046 0/imm32/outputs
9047 "3b/compare<-"/imm32/subx-name
9048 2/imm32/rm32-is-second-inout
9049 1/imm32/r32-is-first-inout
9050 0/imm32/no-imm32
9051 0/imm32/no-disp32
9052 0/imm32/output-is-write-only
9053 _Primitive-compare-eax-with-literal/imm32/next
9054 _Primitive-compare-eax-with-literal:
9055
9056 "compare"/imm32/name
9057 Two-args-int-eax-int-literal/imm32/inouts
9058 0/imm32/outputs
9059 "3d/compare-eax-with"/imm32/subx-name
9060 0/imm32/no-rm32
9061 0/imm32/no-r32
9062 2/imm32/imm32-is-second-inout
9063 0/imm32/no-disp32
9064 0/imm32/output-is-write-only
9065 _Primitive-compare-reg-with-literal/imm32/next
9066 _Primitive-compare-reg-with-literal:
9067
9068 "compare"/imm32/name
9069 Int-var-in-register-and-literal/imm32/inouts
9070 0/imm32/outputs
9071 "81 7/subop/compare"/imm32/subx-name
9072 1/imm32/rm32-is-first-inout
9073 0/imm32/no-r32
9074 2/imm32/imm32-is-second-inout
9075 0/imm32/no-disp32
9076 0/imm32/output-is-write-only
9077 _Primitive-compare-mem-with-literal/imm32/next
9078 _Primitive-compare-mem-with-literal:
9079
9080 "compare"/imm32/name
9081 Int-var-and-literal/imm32/inouts
9082 0/imm32/outputs
9083 "81 7/subop/compare"/imm32/subx-name
9084 1/imm32/rm32-is-first-inout
9085 0/imm32/no-r32
9086 2/imm32/imm32-is-second-inout
9087 0/imm32/no-disp32
9088 0/imm32/output-is-write-only
9089 _Primitive-multiply-reg-by-mem/imm32/next
9090
9091 _Primitive-multiply-reg-by-mem:
9092
9093 "multiply"/imm32/name
9094 Single-int-var-in-mem/imm32/inouts
9095 Single-int-var-in-some-register/imm32/outputs
9096 "0f af/multiply"/imm32/subx-name
9097 1/imm32/rm32-is-first-inout
9098 3/imm32/r32-is-first-output
9099 0/imm32/no-imm32
9100 0/imm32/no-disp32
9101 0/imm32/output-is-write-only
9102 _Primitive-break-if-addr</imm32/next
9103
9104 _Primitive-break-if-addr<:
9105 "break-if-addr<"/imm32/name
9106 0/imm32/inouts
9107 0/imm32/outputs
9108 "0f 82/jump-if-addr< break/disp32"/imm32/subx-name
9109 0/imm32/no-rm32
9110 0/imm32/no-r32
9111 0/imm32/no-imm32
9112 0/imm32/no-disp32
9113 0/imm32/no-output
9114 _Primitive-break-if-addr>=/imm32/next
9115 _Primitive-break-if-addr>=:
9116 "break-if-addr>="/imm32/name
9117 0/imm32/inouts
9118 0/imm32/outputs
9119 "0f 83/jump-if-addr>= break/disp32"/imm32/subx-name
9120 0/imm32/no-rm32
9121 0/imm32/no-r32
9122 0/imm32/no-imm32
9123 0/imm32/no-disp32
9124 0/imm32/no-output
9125 _Primitive-break-if-=/imm32/next
9126 _Primitive-break-if-=:
9127 "break-if-="/imm32/name
9128 0/imm32/inouts
9129 0/imm32/outputs
9130 "0f 84/jump-if-= break/disp32"/imm32/subx-name
9131 0/imm32/no-rm32
9132 0/imm32/no-r32
9133 0/imm32/no-imm32
9134 0/imm32/no-disp32
9135 0/imm32/no-output
9136 _Primitive-break-if-!=/imm32/next
9137 _Primitive-break-if-!=:
9138 "break-if-!="/imm32/name
9139 0/imm32/inouts
9140 0/imm32/outputs
9141 "0f 85/jump-if-!= break/disp32"/imm32/subx-name
9142 0/imm32/no-rm32
9143 0/imm32/no-r32
9144 0/imm32/no-imm32
9145 0/imm32/no-disp32
9146 0/imm32/no-output
9147 _Primitive-break-if-addr<=/imm32/next
9148 _Primitive-break-if-addr<=:
9149 "break-if-addr<="/imm32/name
9150 0/imm32/inouts
9151 0/imm32/outputs
9152 "0f 86/jump-if-addr<= break/disp32"/imm32/subx-name
9153 0/imm32/no-rm32
9154 0/imm32/no-r32
9155 0/imm32/no-imm32
9156 0/imm32/no-disp32
9157 0/imm32/no-output
9158 _Primitive-break-if-addr>/imm32/next
9159 _Primitive-break-if-addr>:
9160 "break-if-addr>"/imm32/name
9161 0/imm32/inouts
9162 0/imm32/outputs
9163 "0f 87/jump-if-addr> break/disp32"/imm32/subx-name
9164 0/imm32/no-rm32
9165 0/imm32/no-r32
9166 0/imm32/no-imm32
9167 0/imm32/no-disp32
9168 0/imm32/no-output
9169 _Primitive-break-if-</imm32/next
9170 _Primitive-break-if-<:
9171 "break-if-<"/imm32/name
9172 0/imm32/inouts
9173 0/imm32/outputs
9174 "0f 8c/jump-if-< break/disp32"/imm32/subx-name
9175 0/imm32/no-rm32
9176 0/imm32/no-r32
9177 0/imm32/no-imm32
9178 0/imm32/no-disp32
9179 0/imm32/no-output
9180 _Primitive-break-if->=/imm32/next
9181 _Primitive-break-if->=:
9182 "break-if->="/imm32/name
9183 0/imm32/inouts
9184 0/imm32/outputs
9185 "0f 8d/jump-if->= break/disp32"/imm32/subx-name
9186 0/imm32/no-rm32
9187 0/imm32/no-r32
9188 0/imm32/no-imm32
9189 0/imm32/no-disp32
9190 0/imm32/no-output
9191 _Primitive-break-if-<=/imm32/next
9192 _Primitive-break-if-<=:
9193 "break-if-<="/imm32/name
9194 0/imm32/inouts
9195 0/imm32/outputs
9196 "0f 8e/jump-if-<= break/disp32"/imm32/subx-name
9197 0/imm32/no-rm32
9198 0/imm32/no-r32
9199 0/imm32/no-imm32
9200 0/imm32/no-disp32
9201 0/imm32/no-output
9202 _Primitive-break-if->/imm32/next
9203 _Primitive-break-if->:
9204 "break-if->"/imm32/name
9205 0/imm32/inouts
9206 0/imm32/outputs
9207 "0f 8f/jump-if-> break/disp32"/imm32/subx-name
9208 0/imm32/no-rm32
9209 0/imm32/no-r32
9210 0/imm32/no-imm32
9211 0/imm32/no-disp32
9212 0/imm32/no-output
9213 _Primitive-break/imm32/next
9214 _Primitive-break:
9215 "break"/imm32/name
9216 0/imm32/inouts
9217 0/imm32/outputs
9218 "e9/jump break/disp32"/imm32/subx-name
9219 0/imm32/no-rm32
9220 0/imm32/no-r32
9221 0/imm32/no-imm32
9222 0/imm32/no-disp32
9223 0/imm32/no-output
9224 _Primitive-loop-if-addr</imm32/next
9225 _Primitive-loop-if-addr<:
9226 "loop-if-addr<"/imm32/name
9227 0/imm32/inouts
9228 0/imm32/outputs
9229 "0f 82/jump-if-addr< loop/disp32"/imm32/subx-name
9230 0/imm32/no-rm32
9231 0/imm32/no-r32
9232 0/imm32/no-imm32
9233 0/imm32/no-disp32
9234 0/imm32/no-output
9235 _Primitive-loop-if-addr>=/imm32/next
9236 _Primitive-loop-if-addr>=:
9237 "loop-if-addr>="/imm32/name
9238 0/imm32/inouts
9239 0/imm32/outputs
9240 "0f 83/jump-if-addr>= loop/disp32"/imm32/subx-name
9241 0/imm32/no-rm32
9242 0/imm32/no-r32
9243 0/imm32/no-imm32
9244 0/imm32/no-disp32
9245 0/imm32/no-output
9246 _Primitive-loop-if-=/imm32/next
9247 _Primitive-loop-if-=:
9248 "loop-if-="/imm32/name
9249 0/imm32/inouts
9250 0/imm32/outputs
9251 "0f 84/jump-if-= loop/disp32"/imm32/subx-name
9252 0/imm32/no-rm32
9253 0/imm32/no-r32
9254 0/imm32/no-imm32
9255 0/imm32/no-disp32
9256 0/imm32/no-output
9257 _Primitive-loop-if-!=/imm32/next
9258 _Primitive-loop-if-!=:
9259 "loop-if-!="/imm32/name
9260 0/imm32/inouts
9261 0/imm32/outputs
9262 "0f 85/jump-if-!= loop/disp32"/imm32/subx-name
9263 0/imm32/no-rm32
9264 0/imm32/no-r32
9265 0/imm32/no-imm32
9266 0/imm32/no-disp32
9267 0/imm32/no-output
9268 _Primitive-loop-if-addr<=/imm32/next
9269 _Primitive-loop-if-addr<=:
9270 "loop-if-addr<="/imm32/name
9271 0/imm32/inouts
9272 0/imm32/outputs
9273 "0f 86/jump-if-addr<= loop/disp32"/imm32/subx-name
9274 0/imm32/no-rm32
9275 0/imm32/no-r32
9276 0/imm32/no-imm32
9277 0/imm32/no-disp32
9278 0/imm32/no-output
9279 _Primitive-loop-if-addr>/imm32/next
9280 _Primitive-loop-if-addr>:
9281 "loop-if-addr>"/imm32/name
9282 0/imm32/inouts
9283 0/imm32/outputs
9284 "0f 87/jump-if-addr> loop/disp32"/imm32/subx-name
9285 0/imm32/no-rm32
9286 0/imm32/no-r32
9287 0/imm32/no-imm32
9288 0/imm32/no-disp32
9289 0/imm32/no-output
9290 _Primitive-loop-if-</imm32/next
9291 _Primitive-loop-if-<:
9292 "loop-if-<"/imm32/name
9293 0/imm32/inouts
9294 0/imm32/outputs
9295 "0f 8c/jump-if-< loop/disp32"/imm32/subx-name
9296 0/imm32/no-rm32
9297 0/imm32/no-r32
9298 0/imm32/no-imm32
9299 0/imm32/no-disp32
9300 0/imm32/no-output
9301 _Primitive-loop-if->=/imm32/next
9302 _Primitive-loop-if->=:
9303 "loop-if->="/imm32/name
9304 0/imm32/inouts
9305 0/imm32/outputs
9306 "0f 8d/jump-if->= loop/disp32"/imm32/subx-name
9307 0/imm32/no-rm32
9308 0/imm32/no-r32
9309 0/imm32/no-imm32
9310 0/imm32/no-disp32
9311 0/imm32/no-output
9312 _Primitive-loop-if-<=/imm32/next
9313 _Primitive-loop-if-<=:
9314 "loop-if-<="/imm32/name
9315 0/imm32/inouts
9316 0/imm32/outputs
9317 "0f 8e/jump-if-<= loop/disp32"/imm32/subx-name
9318 0/imm32/no-rm32
9319 0/imm32/no-r32
9320 0/imm32/no-imm32
9321 0/imm32/no-disp32
9322 0/imm32/no-output
9323 _Primitive-loop-if->/imm32/next
9324 _Primitive-loop-if->:
9325 "loop-if->"/imm32/name
9326 0/imm32/inouts
9327 0/imm32/outputs
9328 "0f 8f/jump-if-> loop/disp32"/imm32/subx-name
9329 0/imm32/no-rm32
9330 0/imm32/no-r32
9331 0/imm32/no-imm32
9332 0/imm32/no-disp32
9333 0/imm32/no-output
9334 _Primitive-loop/imm32/next
9335 _Primitive-loop:
9336 "loop"/imm32/name
9337 0/imm32/inouts
9338 0/imm32/outputs
9339 "e9/jump loop/disp32"/imm32/subx-name
9340 0/imm32/no-rm32
9341 0/imm32/no-r32
9342 0/imm32/no-imm32
9343 0/imm32/no-disp32
9344 0/imm32/no-output
9345 _Primitive-break-if-addr<-named/imm32/next
9346
9347 _Primitive-break-if-addr<-named:
9348 "break-if-addr<"/imm32/name
9349 Single-lit-var/imm32/inouts
9350 0/imm32/outputs
9351 "0f 82/jump-if-addr<"/imm32/subx-name
9352 0/imm32/no-rm32
9353 0/imm32/no-r32
9354 0/imm32/no-imm32
9355 1/imm32/disp32-is-first-inout
9356 0/imm32/no-output
9357 _Primitive-break-if-addr>=-named/imm32/next
9358 _Primitive-break-if-addr>=-named:
9359 "break-if-addr>="/imm32/name
9360 Single-lit-var/imm32/inouts
9361 0/imm32/outputs
9362 "0f 83/jump-if-addr>="/imm32/subx-name
9363 0/imm32/no-rm32
9364 0/imm32/no-r32
9365 0/imm32/no-imm32
9366 1/imm32/disp32-is-first-inout
9367 0/imm32/no-output
9368 _Primitive-break-if-=-named/imm32/next
9369 _Primitive-break-if-=-named:
9370 "break-if-="/imm32/name
9371 Single-lit-var/imm32/inouts
9372 0/imm32/outputs
9373 "0f 84/jump-if-="/imm32/subx-name
9374 0/imm32/no-rm32
9375 0/imm32/no-r32
9376 0/imm32/no-imm32
9377 1/imm32/disp32-is-first-inout
9378 0/imm32/no-output
9379 _Primitive-break-if-!=-named/imm32/next
9380 _Primitive-break-if-!=-named:
9381 "break-if-!="/imm32/name
9382 Single-lit-var/imm32/inouts
9383 0/imm32/outputs
9384 "0f 85/jump-if-!="/imm32/subx-name
9385 0/imm32/no-rm32
9386 0/imm32/no-r32
9387 0/imm32/no-imm32
9388 1/imm32/disp32-is-first-inout
9389 0/imm32/no-output
9390 _Primitive-break-if-addr<=-named/imm32/next
9391 _Primitive-break-if-addr<=-named:
9392 "break-if-addr<="/imm32/name
9393 Single-lit-var/imm32/inouts
9394 0/imm32/outputs
9395 "0f 86/jump-if-addr<="/imm32/subx-name
9396 0/imm32/no-rm32
9397 0/imm32/no-r32
9398 0/imm32/no-imm32
9399 1/imm32/disp32-is-first-inout
9400 0/imm32/no-output
9401 _Primitive-break-if-addr>-named/imm32/next
9402 _Primitive-break-if-addr>-named:
9403 "break-if-addr>"/imm32/name
9404 Single-lit-var/imm32/inouts
9405 0/imm32/outputs
9406 "0f 87/jump-if-addr>"/imm32/subx-name
9407 0/imm32/no-rm32
9408 0/imm32/no-r32
9409 0/imm32/no-imm32
9410 1/imm32/disp32-is-first-inout
9411 0/imm32/no-output
9412 _Primitive-break-if-<-named/imm32/next
9413 _Primitive-break-if-<-named:
9414 "break-if-<"/imm32/name
9415 Single-lit-var/imm32/inouts
9416 0/imm32/outputs
9417 "0f 8c/jump-if-<"/imm32/subx-name
9418 0/imm32/no-rm32
9419 0/imm32/no-r32
9420 0/imm32/no-imm32
9421 1/imm32/disp32-is-first-inout
9422 0/imm32/no-output
9423 _Primitive-break-if->=-named/imm32/next
9424 _Primitive-break-if->=-named:
9425 "break-if->="/imm32/name
9426 Single-lit-var/imm32/inouts
9427 0/imm32/outputs
9428 "0f 8d/jump-if->="/imm32/subx-name
9429 0/imm32/no-rm32
9430 0/imm32/no-r32
9431 0/imm32/no-imm32
9432 1/imm32/disp32-is-first-inout
9433 0/imm32/no-output
9434 _Primitive-break-if-<=-named/imm32/next
9435 _Primitive-break-if-<=-named:
9436 "break-if-<="/imm32/name
9437 Single-lit-var/imm32/inouts
9438 0/imm32/outputs
9439 "0f 8e/jump-if-<="/imm32/subx-name
9440 0/imm32/no-rm32
9441 0/imm32/no-r32
9442 0/imm32/no-imm32
9443 1/imm32/disp32-is-first-inout
9444 0/imm32/no-output
9445 _Primitive-break-if->-named/imm32/next
9446 _Primitive-break-if->-named:
9447 "break-if->"/imm32/name
9448 Single-lit-var/imm32/inouts
9449 0/imm32/outputs
9450 "0f 8f/jump-if->"/imm32/subx-name
9451 0/imm32/no-rm32
9452 0/imm32/no-r32
9453 0/imm32/no-imm32
9454 1/imm32/disp32-is-first-inout
9455 0/imm32/no-output
9456 _Primitive-break-named/imm32/next
9457 _Primitive-break-named:
9458 "break"/imm32/name
9459 Single-lit-var/imm32/inouts
9460 0/imm32/outputs
9461 "e9/jump"/imm32/subx-name
9462 0/imm32/no-rm32
9463 0/imm32/no-r32
9464 0/imm32/no-imm32
9465 1/imm32/disp32-is-first-inout
9466 0/imm32/no-output
9467 _Primitive-loop-if-addr<-named/imm32/next
9468 _Primitive-loop-if-addr<-named:
9469 "loop-if-addr<"/imm32/name
9470 Single-lit-var/imm32/inouts
9471 0/imm32/outputs
9472 "0f 82/jump-if-addr<"/imm32/subx-name
9473 0/imm32/no-rm32
9474 0/imm32/no-r32
9475 0/imm32/no-imm32
9476 1/imm32/disp32-is-first-inout
9477 0/imm32/no-output
9478 _Primitive-loop-if-addr>=-named/imm32/next
9479 _Primitive-loop-if-addr>=-named:
9480 "loop-if-addr>="/imm32/name
9481 Single-lit-var/imm32/inouts
9482 0/imm32/outputs
9483 "0f 83/jump-if-addr>="/imm32/subx-name
9484 0/imm32/no-rm32
9485 0/imm32/no-r32
9486 0/imm32/no-imm32
9487 1/imm32/disp32-is-first-inout
9488 0/imm32/no-output
9489 _Primitive-loop-if-=-named/imm32/next
9490 _Primitive-loop-if-=-named:
9491 "loop-if-="/imm32/name
9492 Single-lit-var/imm32/inouts
9493 0/imm32/outputs
9494 "0f 84/jump-if-="/imm32/subx-name
9495 0/imm32/no-rm32
9496 0/imm32/no-r32
9497 0/imm32/no-imm32
9498 1/imm32/disp32-is-first-inout
9499 0/imm32/no-output
9500 _Primitive-loop-if-!=-named/imm32/next
9501 _Primitive-loop-if-!=-named:
9502 "loop-if-!="/imm32/name
9503 Single-lit-var/imm32/inouts
9504 0/imm32/outputs
9505 "0f 85/jump-if-!="/imm32/subx-name
9506 0/imm32/no-rm32
9507 0/imm32/no-r32
9508 0/imm32/no-imm32
9509 1/imm32/disp32-is-first-inout
9510 0/imm32/no-output
9511 _Primitive-loop-if-addr<=-named/imm32/next
9512 _Primitive-loop-if-addr<=-named:
9513 "loop-if-addr<="/imm32/name
9514 Single-lit-var/imm32/inouts
9515 0/imm32/outputs
9516 "0f 86/jump-if-addr<="/imm32/subx-name
9517 0/imm32/no-rm32
9518 0/imm32/no-r32
9519 0/imm32/no-imm32
9520 1/imm32/disp32-is-first-inout
9521 0/imm32/no-output
9522 _Primitive-loop-if-addr>-named/imm32/next
9523 _Primitive-loop-if-addr>-named:
9524 "loop-if-addr>"/imm32/name
9525 Single-lit-var/imm32/inouts
9526 0/imm32/outputs
9527 "0f 87/jump-if-addr>"/imm32/subx-name
9528 0/imm32/no-rm32
9529 0/imm32/no-r32
9530 0/imm32/no-imm32
9531 1/imm32/disp32-is-first-inout
9532 0/imm32/no-output
9533 _Primitive-loop-if-<-named/imm32/next
9534 _Primitive-loop-if-<-named:
9535 "loop-if-<"/imm32/name
9536 Single-lit-var/imm32/inouts
9537 0/imm32/outputs
9538 "0f 8c/jump-if-<"/imm32/subx-name
9539 0/imm32/no-rm32
9540 0/imm32/no-r32
9541 0/imm32/no-imm32
9542 1/imm32/disp32-is-first-inout
9543 0/imm32/no-output
9544 _Primitive-loop-if->=-named/imm32/next
9545 _Primitive-loop-if->=-named:
9546 "loop-if->="/imm32/name
9547 Single-lit-var/imm32/inouts
9548 0/imm32/outputs
9549 "0f 8d/jump-if->="/imm32/subx-name
9550 0/imm32/no-rm32
9551 0/imm32/no-r32
9552 0/imm32/no-imm32
9553 1/imm32/disp32-is-first-inout
9554 0/imm32/no-output
9555 _Primitive-loop-if-<=-named/imm32/next
9556 _Primitive-loop-if-<=-named:
9557 "loop-if-<="/imm32/name
9558 Single-lit-var/imm32/inouts
9559 0/imm32/outputs
9560 "0f 8e/jump-if-<="/imm32/subx-name
9561 0/imm32/no-rm32
9562 0/imm32/no-r32
9563 0/imm32/no-imm32
9564 1/imm32/disp32-is-first-inout
9565 0/imm32/no-output
9566 _Primitive-loop-if->-named/imm32/next
9567 _Primitive-loop-if->-named:
9568 "loop-if->"/imm32/name
9569 Single-lit-var/imm32/inouts
9570 0/imm32/outputs
9571 "0f 8f/jump-if->"/imm32/subx-name
9572 0/imm32/no-rm32
9573 0/imm32/no-r32
9574 0/imm32/no-imm32
9575 1/imm32/disp32-is-first-inout
9576 0/imm32/no-output
9577 _Primitive-loop-named/imm32/next
9578 _Primitive-loop-named:
9579 "loop"/imm32/name
9580 Single-lit-var/imm32/inouts
9581 0/imm32/outputs
9582 "e9/jump"/imm32/subx-name
9583 0/imm32/no-rm32
9584 0/imm32/no-r32
9585 0/imm32/no-imm32
9586 1/imm32/disp32-is-first-inout
9587 0/imm32/no-output
9588 0/imm32/next
9589
9590 Single-int-var-in-mem:
9591 Int-var-in-mem/imm32
9592 0/imm32/next
9593
9594 Int-var-in-mem:
9595 "arg1"/imm32/name
9596 Type-int/imm32
9597 1/imm32/some-block-depth
9598 1/imm32/some-stack-offset
9599 0/imm32/no-register
9600
9601 Two-args-int-stack-int-reg:
9602 Int-var-in-mem/imm32
9603 Single-int-var-in-some-register/imm32/next
9604
9605 Two-args-int-reg-int-stack:
9606 Int-var-in-some-register/imm32
9607 Single-int-var-in-mem/imm32/next
9608
9609 Two-args-int-eax-int-literal:
9610 Int-var-in-eax/imm32
9611 Single-lit-var/imm32/next
9612
9613 Int-var-and-literal:
9614 Int-var-in-mem/imm32
9615 Single-lit-var/imm32/next
9616
9617 Int-var-in-register-and-literal:
9618 Int-var-in-some-register/imm32
9619 Single-lit-var/imm32/next
9620
9621 Single-int-var-in-some-register:
9622 Int-var-in-some-register/imm32
9623 0/imm32/next
9624
9625 Single-addr-var-in-some-register:
9626 Addr-var-in-some-register/imm32
9627 0/imm32/next
9628
9629 Int-var-in-some-register:
9630 "arg1"/imm32/name
9631 Type-int/imm32
9632 1/imm32/some-block-depth
9633 0/imm32/no-stack-offset
9634 Any-register/imm32
9635
9636 Addr-var-in-some-register:
9637 "arg1"/imm32/name
9638 Type-addr/imm32
9639 1/imm32/some-block-depth
9640 0/imm32/no-stack-offset
9641 Any-register/imm32
9642
9643 Single-int-var-in-eax:
9644 Int-var-in-eax/imm32
9645 0/imm32/next
9646
9647 Int-var-in-eax:
9648 "arg1"/imm32/name
9649 Type-int/imm32
9650 1/imm32/some-block-depth
9651 0/imm32/no-stack-offset
9652 "eax"/imm32/register
9653
9654 Single-int-var-in-ecx:
9655 Int-var-in-ecx/imm32
9656 0/imm32/next
9657
9658 Int-var-in-ecx:
9659 "arg1"/imm32/name
9660 Type-int/imm32
9661 1/imm32/some-block-depth
9662 0/imm32/no-stack-offset
9663 "ecx"/imm32/register
9664
9665 Single-int-var-in-edx:
9666 Int-var-in-edx/imm32
9667 0/imm32/next
9668
9669 Int-var-in-edx:
9670 "arg1"/imm32/name
9671 Type-int/imm32
9672 1/imm32/some-block-depth
9673 0/imm32/no-stack-offset
9674 "edx"/imm32/register
9675
9676 Single-int-var-in-ebx:
9677 Int-var-in-ebx/imm32
9678 0/imm32/next
9679
9680 Int-var-in-ebx:
9681 "arg1"/imm32/name
9682 Type-int/imm32
9683 1/imm32/some-block-depth
9684 0/imm32/no-stack-offset
9685 "ebx"/imm32/register
9686
9687 Single-int-var-in-esi:
9688 Int-var-in-esi/imm32
9689 0/imm32/next
9690
9691 Int-var-in-esi:
9692 "arg1"/imm32/name
9693 Type-int/imm32
9694 1/imm32/some-block-depth
9695 0/imm32/no-stack-offset
9696 "esi"/imm32/register
9697
9698 Single-int-var-in-edi:
9699 Int-var-in-edi/imm32
9700 0/imm32/next
9701
9702 Int-var-in-edi:
9703 "arg1"/imm32/name
9704 Type-int/imm32
9705 1/imm32/some-block-depth
9706 0/imm32/no-stack-offset
9707 "edi"/imm32/register
9708
9709 Single-lit-var:
9710 Lit-var/imm32
9711 0/imm32/next
9712
9713 Lit-var:
9714 "literal"/imm32/name
9715 Type-literal/imm32
9716 1/imm32/some-block-depth
9717 0/imm32/no-stack-offset
9718 0/imm32/no-register
9719
9720 Type-int:
9721 1/imm32/left-is-atom
9722 1/imm32/left/int
9723 0/imm32/right/null
9724
9725 Type-literal:
9726 1/imm32/left-is-atom
9727 0/imm32/left/literal
9728 0/imm32/right/null
9729
9730 Type-addr:
9731 1/imm32/left-is-atom
9732 2/imm32/left/addr
9733 0/imm32/right/null
9734
9735 == code
9736 emit-subx-primitive:
9737
9738 55/push-ebp
9739 89/<- %ebp 4/r32/esp
9740
9741 50/push-eax
9742 51/push-ecx
9743
9744 8b/-> *(ebp+0x10) 1/r32/ecx
9745
9746 (emit-indent *(ebp+8) *Curr-block-depth)
9747 (write-buffered *(ebp+8) *(ecx+0xc))
9748
9749 (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc))
9750
9751 (emit-subx-r32 *(ebp+8) *(ecx+0x14) *(ebp+0xc))
9752
9753 (emit-subx-imm32 *(ebp+8) *(ecx+0x18) *(ebp+0xc))
9754
9755 (emit-subx-disp32 *(ebp+8) *(ecx+0x1c) *(ebp+0xc))
9756 (write-buffered *(ebp+8) Newline)
9757 $emit-subx-primitive:end:
9758
9759 59/pop-to-ecx
9760 58/pop-to-eax
9761
9762 89/<- %esp 5/r32/ebp
9763 5d/pop-to-ebp
9764 c3/return
9765
9766 emit-subx-rm32:
9767
9768 55/push-ebp
9769 89/<- %ebp 4/r32/esp
9770
9771 50/push-eax
9772
9773 81 7/subop/compare *(ebp+0xc) 0/imm32
9774 74/jump-if-= $emit-subx-rm32:end/disp8
9775
9776 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9777 (emit-subx-var-as-rm32 *(ebp+8) %eax)
9778 $emit-subx-rm32:end:
9779
9780 58/pop-to-eax
9781
9782 89/<- %esp 5/r32/ebp
9783 5d/pop-to-ebp
9784 c3/return
9785
9786 get-stmt-operand-from-arg-location:
9787
9788 55/push-ebp
9789 89/<- %ebp 4/r32/esp
9790
9791 51/push-ecx
9792
9793 8b/-> *(ebp+0xc) 0/r32/eax
9794
9795 8b/-> *(ebp+8) 1/r32/ecx
9796
9797 {
9798 3d/compare-eax-and 1/imm32
9799 75/jump-if-!= break/disp8
9800 $get-stmt-operand-from-arg-location:1:
9801 8b/-> *(ecx+8) 0/r32/eax
9802 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9803 }
9804
9805 {
9806 3d/compare-eax-and 2/imm32
9807 75/jump-if-!= break/disp8
9808 $get-stmt-operand-from-arg-location:2:
9809 8b/-> *(ecx+8) 0/r32/eax
9810 8b/-> *(eax+4) 0/r32/eax
9811 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9812 }
9813
9814 {
9815 3d/compare-eax-and 3/imm32
9816 75/jump-if-!= break/disp8
9817 $get-stmt-operand-from-arg-location:3:
9818 8b/-> *(ecx+0xc) 0/r32/eax
9819 eb/jump $get-stmt-operand-from-arg-location:end/disp8
9820 }
9821
9822 e9/jump $get-stmt-operand-from-arg-location:abort/disp32
9823 $get-stmt-operand-from-arg-location:end:
9824
9825 59/pop-to-ecx
9826
9827 89/<- %esp 5/r32/ebp
9828 5d/pop-to-ebp
9829 c3/return
9830
9831 $get-stmt-operand-from-arg-location:abort:
9832
9833 (write-buffered Stderr "invalid arg-location ")
9834 (print-int32-buffered Stderr %eax)
9835 (write-buffered Stderr Newline)
9836 (flush Stderr)
9837
9838 bb/copy-to-ebx 1/imm32
9839 b8/copy-to-eax 1/imm32/exit
9840 cd/syscall 0x80/imm8
9841
9842
9843 emit-subx-r32:
9844
9845 55/push-ebp
9846 89/<- %ebp 4/r32/esp
9847
9848 50/push-eax
9849 51/push-ecx
9850
9851 81 7/subop/compare *(ebp+0xc) 0/imm32
9852 0f 84/jump-if-= $emit-subx-r32:end/disp32
9853
9854 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9855 8b/-> *eax 0/r32/eax
9856 (maybe-get Registers *(eax+0x10) 8)
9857 (write-buffered *(ebp+8) Space)
9858 (print-int32-buffered *(ebp+8) *eax)
9859 (write-buffered *(ebp+8) "/r32")
9860 $emit-subx-r32:end:
9861
9862 59/pop-to-ecx
9863 58/pop-to-eax
9864
9865 89/<- %esp 5/r32/ebp
9866 5d/pop-to-ebp
9867 c3/return
9868
9869 emit-subx-imm32:
9870
9871 55/push-ebp
9872 89/<- %ebp 4/r32/esp
9873
9874 50/push-eax
9875 51/push-ecx
9876
9877 81 7/subop/compare *(ebp+0xc) 0/imm32
9878 74/jump-if-= $emit-subx-imm32:end/disp8
9879
9880 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9881 8b/-> *eax 0/r32/eax
9882 (write-buffered *(ebp+8) Space)
9883 (write-buffered *(ebp+8) *eax)
9884 (write-buffered *(ebp+8) "/imm32")
9885 $emit-subx-imm32:end:
9886
9887 59/pop-to-ecx
9888 58/pop-to-eax
9889
9890 89/<- %esp 5/r32/ebp
9891 5d/pop-to-ebp
9892 c3/return
9893
9894 emit-subx-disp32:
9895
9896 55/push-ebp
9897 89/<- %ebp 4/r32/esp
9898
9899 50/push-eax
9900 51/push-ecx
9901
9902 81 7/subop/compare *(ebp+0xc) 0/imm32
9903 0f 84/jump-if-= $emit-subx-disp32:end/disp32
9904
9905 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))
9906 8b/-> *eax 0/r32/eax
9907 (write-buffered *(ebp+8) Space)
9908 (write-buffered *(ebp+8) *eax)
9909
9910
9911 8b/-> *(ebp+0x10) 0/r32/eax
9912 8b/-> *(eax+4) 1/r32/ecx
9913 {
9914 (string-starts-with? %ecx "break")
9915 3d/compare-eax-and 0/imm32/false
9916 74/jump-if-= break/disp8
9917 (write-buffered *(ebp+8) ":break")
9918 }
9919
9920 {
9921 (string-starts-with? %ecx "loop")
9922 3d/compare-eax-and 0/imm32/false
9923 74/jump-if-= break/disp8
9924 (write-buffered *(ebp+8) ":loop")
9925 }
9926 (write-buffered *(ebp+8) "/disp32")
9927 $emit-subx-disp32:end:
9928
9929 59/pop-to-ecx
9930 58/pop-to-eax
9931
9932 89/<- %esp 5/r32/ebp
9933 5d/pop-to-ebp
9934 c3/return
9935
9936 emit-call:
9937
9938 55/push-ebp
9939 89/<- %ebp 4/r32/esp
9940
9941 51/push-ecx
9942
9943 (emit-indent *(ebp+8) *Curr-block-depth)
9944 (write-buffered *(ebp+8) "(")
9945
9946 8b/-> *(ebp+0xc) 1/r32/ecx
9947
9948 (write-buffered *(ebp+8) *(ecx+4))
9949
9950
9951 8b/-> *(ecx+8) 1/r32/ecx
9952 {
9953
9954 81 7/subop/compare %ecx 0/imm32
9955 74/jump-if-= break/disp8
9956
9957 (emit-subx-call-operand *(ebp+8) %ecx)
9958
9959 8b/-> *(ecx+4) 1/r32/ecx
9960 eb/jump loop/disp8
9961 }
9962
9963 (write-buffered *(ebp+8) ")\n")
9964 $emit-call:end:
9965
9966 59/pop-to-ecx
9967
9968 89/<- %esp 5/r32/ebp
9969 5d/pop-to-ebp
9970 c3/return
9971
9972 emit-subx-call-operand:
9973
9974
9975 55/push-ebp
9976 89/<- %ebp 4/r32/esp
9977
9978 50/push-eax
9979 51/push-ecx
9980 56/push-esi
9981
9982 8b/-> *(ebp+0xc) 1/r32/ecx
9983
9984 8b/-> *ecx 6/r32/esi
9985
9986 {
9987 $emit-subx-call-operand:check-for-register-direct:
9988 81 7/subop/compare *(esi+0x10) 0/imm32
9989 74/jump-if-= break/disp8
9990 81 7/subop/compare *(ecx+8) 0/imm32/false
9991 75/jump-if-!= break/disp8
9992 $emit-subx-call-operand:register-direct:
9993 (write-buffered *(ebp+8) " %")
9994 (write-buffered *(ebp+8) *(esi+0x10))
9995 e9/jump $emit-subx-call-operand:end/disp32
9996 }
9997
9998 {
9999 $emit-subx-call-operand:check-for-register-indirect:
10000 81 7/subop/compare *(esi+0x10) 0/imm32
10001 74/jump-if-= break/disp8
10002 81 7/subop/compare *(ecx+8) 0/imm32/false
10003 74/jump-if-= break/disp8
10004 $emit-subx-call-operand:register-indirect:
10005 (emit-subx-call-operand-register-indirect *(ebp+8) %esi)
10006 e9/jump $emit-subx-call-operand:end/disp32
10007 }
10008
10009 {
10010 81 7/subop/compare *(esi+0xc) 0/imm32
10011 74/jump-if-= break/disp8
10012 $emit-subx-call-operand:stack:
10013 (emit-subx-call-operand-stack *(ebp+8) %esi)
10014 e9/jump $emit-subx-call-operand:end/disp32
10015 }
10016
10017 {
10018 8b/-> *(esi+4) 0/r32/eax
10019 81 7/subop/compare *(eax+4) 0/imm32
10020 75/jump-if-!= break/disp8
10021 $emit-subx-call-operand:literal:
10022 (write-buffered *(ebp+8) Space)
10023 (write-buffered *(ebp+8) *esi)
10024 }
10025 $emit-subx-call-operand:end:
10026
10027 5e/pop-to-esi
10028 59/pop-to-ecx
10029 58/pop-to-eax
10030
10031 89/<- %esp 5/r32/ebp
10032 5d/pop-to-ebp
10033 c3/return
10034
10035 emit-subx-call-operand-register-indirect:
10036
10037 55/push-ebp
10038 89/<- %ebp 4/r32/esp
10039
10040 50/push-eax
10041 51/push-ecx
10042 56/push-esi
10043
10044 8b/-> *(ebp+0xc) 6/r32/esi
10045
10046 (size-of-deref %esi)
10047 89/<- %ecx 0/r32/eax
10048
10049
10050 b8/copy-to-eax 0/imm32
10051 {
10052 $emit-subx-call-operand-register-indirect:loop:
10053
10054 39/compare %eax 1/r32/ecx
10055 7d/jump-if->= break/disp8
10056
10057 (write-buffered *(ebp+8) " *(")
10058 (write-buffered *(ebp+8) *(esi+0x10))
10059 (write-buffered *(ebp+8) "+")
10060 (print-int32-buffered *(ebp+8) %eax)
10061 (write-buffered *(ebp+8) ")")
10062
10063 05/add-to-eax 4/imm32
10064
10065 eb/jump loop/disp8
10066 }
10067 $emit-subx-call-operand-register-indirect:end:
10068
10069 5e/pop-to-esi
10070 59/pop-to-ecx
10071 58/pop-to-eax
10072
10073 89/<- %esp 5/r32/ebp
10074 5d/pop-to-ebp
10075 c3/return
10076
10077 emit-subx-call-operand-stack:
10078
10079 55/push-ebp
10080 89/<- %ebp 4/r32/esp
10081
10082 50/push-eax
10083 51/push-ecx
10084 56/push-esi
10085
10086 8b/-> *(ebp+0xc) 6/r32/esi
10087
10088 8b/-> *(esi+0xc) 1/r32/ecx
10089
10090 (size-of %esi)
10091
10092 01/add-to %eax 1/r32/ecx
10093 {
10094 $emit-subx-call-operand-stack:loop:
10095
10096 39/compare %ecx 0/r32/eax
10097 7d/jump-if->= break/disp8
10098
10099 (write-buffered *(ebp+8) " *(ebp+")
10100 (print-int32-buffered *(ebp+8) %ecx)
10101 (write-buffered *(ebp+8) ")")
10102
10103 81 0/subop/add %ecx 4/imm32
10104
10105 eb/jump loop/disp8
10106 }
10107 $emit-subx-call-operand-stack:end:
10108
10109 5e/pop-to-esi
10110 59/pop-to-ecx
10111 58/pop-to-eax
10112
10113 89/<- %esp 5/r32/ebp
10114 5d/pop-to-ebp
10115 c3/return
10116
10117 emit-subx-var-as-rm32:
10118
10119 55/push-ebp
10120 89/<- %ebp 4/r32/esp
10121
10122 50/push-eax
10123 51/push-ecx
10124 56/push-esi
10125
10126 8b/-> *(ebp+0xc) 1/r32/ecx
10127
10128 8b/-> *ecx 6/r32/esi
10129
10130 {
10131 $emit-subx-var-as-rm32:check-for-register-indirect:
10132 81 7/subop/compare *(esi+0x10) 0/imm32
10133 74/jump-if-= break/disp8
10134 81 7/subop/compare *(ecx+8) 0/imm32/false
10135 74/jump-if-= break/disp8
10136 $emit-subx-var-as-rm32:register-indirect:
10137 (write-buffered *(ebp+8) " *")
10138 (write-buffered *(ebp+8) *(esi+0x10))
10139 }
10140
10141 {
10142 $emit-subx-var-as-rm32:check-for-register-direct:
10143 81 7/subop/compare *(esi+0x10) 0/imm32
10144 74/jump-if-= break/disp8
10145 81 7/subop/compare *(ecx+8) 0/imm32/false
10146 75/jump-if-!= break/disp8
10147 $emit-subx-var-as-rm32:register-direct:
10148 (write-buffered *(ebp+8) " %")
10149 (write-buffered *(ebp+8) *(esi+0x10))
10150 }
10151
10152 {
10153 81 7/subop/compare *(esi+0xc) 0/imm32
10154 74/jump-if-= break/disp8
10155 $emit-subx-var-as-rm32:stack:
10156 (write-buffered *(ebp+8) Space)
10157 (write-buffered *(ebp+8) "*(ebp+")
10158 (print-int32-buffered *(ebp+8) *(esi+0xc))
10159 (write-buffered *(ebp+8) ")")
10160 }
10161 $emit-subx-var-as-rm32:end:
10162
10163 5e/pop-to-esi
10164 59/pop-to-ecx
10165 58/pop-to-eax
10166
10167 89/<- %esp 5/r32/ebp
10168 5d/pop-to-ebp
10169 c3/return
10170
10171 find-matching-primitive:
10172
10173 55/push-ebp
10174 89/<- %ebp 4/r32/esp
10175
10176 51/push-ecx
10177
10178 8b/-> *(ebp+8) 1/r32/ecx
10179 {
10180 $find-matching-primitive:loop:
10181
10182 81 7/subop/compare %ecx 0/imm32
10183 0f 84/jump-if-= break/disp32
10184
10185 {
10186 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
10187 3d/compare-eax-and 0/imm32/false
10188 74/jump-if-= break/disp8
10189 89/<- %eax 1/r32/ecx
10190 eb/jump $find-matching-primitive:end/disp8
10191 }
10192 $find-matching-primitive:next-primitive:
10193
10194 8b/-> *(ecx+0x24) 1/r32/ecx
10195 e9/jump loop/disp32
10196 }
10197
10198 b8/copy-to-eax 0/imm32
10199 $find-matching-primitive:end:
10200
10201 59/pop-to-ecx
10202
10203 89/<- %esp 5/r32/ebp
10204 5d/pop-to-ebp
10205 c3/return
10206
10207 mu-stmt-matches-primitive?:
10208
10209
10210
10211
10212
10213
10214 55/push-ebp
10215 89/<- %ebp 4/r32/esp
10216
10217 51/push-ecx
10218 52/push-edx
10219 53/push-ebx
10220 56/push-esi
10221 57/push-edi
10222
10223 8b/-> *(ebp+8) 1/r32/ecx
10224
10225 8b/-> *(ebp+0xc) 2/r32/edx
10226 {
10227 $mu-stmt-matches-primitive?:check-name:
10228
10229 (string-equal? *(ecx+4) *edx)
10230 3d/compare-eax-and 0/imm32/false
10231 75/jump-if-!= break/disp8
10232 b8/copy-to-eax 0/imm32
10233 e9/jump $mu-stmt-matches-primitive?:end/disp32
10234 }
10235 $mu-stmt-matches-primitive?:check-inouts:
10236
10237 8b/-> *(ecx+8) 6/r32/esi
10238 8b/-> *(edx+4) 7/r32/edi
10239 {
10240
10241 {
10242 81 7/subop/compare %esi 0/imm32
10243 75/jump-if-!= break/disp8
10244 $mu-stmt-matches-primitive?:stmt-inout-is-null:
10245 {
10246 81 7/subop/compare %edi 0/imm32
10247 75/jump-if-!= break/disp8
10248
10249 e9/jump $mu-stmt-matches-primitive?:check-outputs/disp32
10250 }
10251
10252 b8/copy-to-eax 0/imm32/false
10253 e9/jump $mu-stmt-matches-primitive?:end/disp32
10254 }
10255
10256 {
10257 81 7/subop/compare %edi 0/imm32
10258 75/jump-if-!= break/disp8
10259 $mu-stmt-matches-primitive?:prim-inout-is-null:
10260 b8/copy-to-eax 0/imm32/false
10261 e9/jump $mu-stmt-matches-primitive?:end/disp32
10262 }
10263
10264 {
10265 (operand-matches-primitive? %esi *edi)
10266 3d/compare-eax-and 0/imm32/false
10267 75/jump-if-!= break/disp8
10268 b8/copy-to-eax 0/imm32/false
10269 e9/jump $mu-stmt-matches-primitive?:end/disp32
10270 }
10271
10272 8b/-> *(esi+4) 6/r32/esi
10273
10274 8b/-> *(edi+4) 7/r32/edi
10275 eb/jump loop/disp8
10276 }
10277 $mu-stmt-matches-primitive?:check-outputs:
10278
10279 8b/-> *(ecx+0xc) 6/r32/esi
10280 8b/-> *(edx+8) 7/r32/edi
10281 {
10282
10283 {
10284 $mu-stmt-matches-primitive?:check-output:
10285 81 7/subop/compare %esi 0/imm32
10286 75/jump-if-!= break/disp8
10287 {
10288 81 7/subop/compare %edi 0/imm32
10289 75/jump-if-!= break/disp8
10290
10291 b8/copy-to-eax 1/imm32
10292 e9/jump $mu-stmt-matches-primitive?:end/disp32
10293 }
10294
10295 b8/copy-to-eax 0/imm32
10296 e9/jump $mu-stmt-matches-primitive?:end/disp32
10297 }
10298
10299 {
10300 81 7/subop/compare %edi 0/imm32
10301 75/jump-if-!= break/disp8
10302 b8/copy-to-eax 0/imm32
10303 e9/jump $mu-stmt-matches-primitive?:end/disp32
10304 }
10305
10306 {
10307 (operand-matches-primitive? %esi *edi)
10308 3d/compare-eax-and 0/imm32/false
10309 75/jump-if-!= break/disp8
10310 b8/copy-to-eax 0/imm32
10311 e9/jump $mu-stmt-matches-primitive?:end/disp32
10312 }
10313
10314 8b/-> *(esi+4) 6/r32/esi
10315
10316 8b/-> *(edi+4) 7/r32/edi
10317 eb/jump loop/disp8
10318 }
10319 $mu-stmt-matches-primitive?:return-true:
10320 b8/copy-to-eax 1/imm32
10321 $mu-stmt-matches-primitive?:end:
10322
10323 5f/pop-to-edi
10324 5e/pop-to-esi
10325 5b/pop-to-ebx
10326 5a/pop-to-edx
10327 59/pop-to-ecx
10328
10329 89/<- %esp 5/r32/ebp
10330 5d/pop-to-ebp
10331 c3/return
10332
10333 operand-matches-primitive?:
10334
10335 55/push-ebp
10336 89/<- %ebp 4/r32/esp
10337
10338 51/push-ecx
10339 56/push-esi
10340 57/push-edi
10341
10342 8b/-> *(ebp+8) 1/r32/ecx
10343
10344 8b/-> *ecx 6/r32/esi
10345
10346 8b/-> *(ebp+0xc) 7/r32/edi
10347 $operand-matches-primitive?:check-type:
10348
10349 (subx-type-equal? *(esi+4) *(edi+4))
10350 3d/compare-eax-and 0/imm32/false
10351 b8/copy-to-eax 0/imm32/false
10352 0f 84/jump-if-= $operand-matches-primitive?:end/disp32
10353 {
10354 $operand-matches-primitive?:check-register:
10355
10356 {
10357 81 7/subop/compare *(edi+0x10) 0/imm32
10358 0f 85/jump-if-!= break/disp32
10359 81 7/subop/compare *(esi+0x10) 0/imm32
10360 74/jump-if-= break/disp8
10361 81 7/subop/compare *(ecx+8) 0/imm32/false
10362 74/jump-if-= break/disp8
10363 e9/jump $operand-matches-primitive?:return-true/disp32
10364 }
10365
10366 {
10367 81 7/subop/compare *(edi+0x10) 0/imm32
10368 0f 84/jump-if-= break/disp32
10369 81 7/subop/compare *(esi+0x10) 0/imm32
10370 0f 84/jump-if-= break/disp32
10371 81 7/subop/compare *(ecx+8) 0/imm32/false
10372 74/jump-if-= break/disp8
10373 e9/jump $operand-matches-primitive?:return-false/disp32
10374 }
10375
10376 {
10377
10378 8b/-> *(esi+0x10) 0/r32/eax
10379 39/compare *(edi+0x10) 0/r32/eax
10380 74/jump-if-= break/disp8
10381
10382 3d/compare-eax-and 0/imm32
10383 74/jump-if-= $operand-matches-primitive?:end/disp8
10384 81 7/subop/compare *(edi+0x10) 0/imm32
10385 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10386
10387 (string-equal? *(edi+0x10) Any-register)
10388 3d/compare-eax-and 0/imm32/false
10389 75/jump-if-!= break/disp8
10390
10391 (string-equal? *(esi+0x10) *(edi+0x10))
10392 3d/compare-eax-and 0/imm32/false
10393 74/jump-if-= $operand-matches-primitive?:return-false/disp8
10394 }
10395 }
10396 $operand-matches-primitive?:return-true:
10397 b8/copy-to-eax 1/imm32/true
10398 eb/jump $operand-matches-primitive?:end/disp8
10399 $operand-matches-primitive?:return-false:
10400 b8/copy-to-eax 0/imm32/false
10401 $operand-matches-primitive?:end:
10402
10403 5f/pop-to-edi
10404 5e/pop-to-esi
10405 59/pop-to-ecx
10406
10407 89/<- %esp 5/r32/ebp
10408 5d/pop-to-ebp
10409 c3/return
10410
10411 subx-type-equal?:
10412
10413 55/push-ebp
10414 89/<- %ebp 4/r32/esp
10415
10416 51/push-ecx
10417
10418 (is-simple-mu-type? *(ebp+8) 0)
10419 89/<- %ecx 0/r32/eax
10420
10421 (is-simple-mu-type? *(ebp+0xc) 0)
10422
10423 39/compare %eax 1/r32/ecx
10424 0f 94/set-byte-if-= %al
10425 81 4/subop/and %eax 0xff/imm32
10426 $subx-type-equal?:end:
10427
10428 59/pop-to-ecx
10429
10430 89/<- %esp 5/r32/ebp
10431 5d/pop-to-ebp
10432 c3/return
10433
10434 is-simple-mu-type?:
10435
10436 55/push-ebp
10437 89/<- %ebp 4/r32/esp
10438
10439 51/push-ecx
10440
10441 8b/-> *(ebp+0xc) 1/r32/ecx
10442
10443 8b/-> *(ebp+8) 0/r32/eax
10444 39/compare *(eax+4) 1/r32/ecx
10445 0f 94/set-byte-if-= %al
10446 81 4/subop/and %eax 0xff/imm32
10447 $is-simple-mu-type?:end:
10448
10449 59/pop-to-ecx
10450
10451 89/<- %esp 5/r32/ebp
10452 5d/pop-to-ebp
10453 c3/return
10454
10455 test-emit-subx-stmt-primitive:
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474 55/push-ebp
10475 89/<- %ebp 4/r32/esp
10476
10477 (clear-stream _test-output-stream)
10478 (clear-stream $_test-output-buffered-file->buffer)
10479
10480 68/push 0/imm32/right/null
10481 68/push 1/imm32/left/int
10482 89/<- %ecx 4/r32/esp
10483
10484 68/push 0/imm32/no-register
10485 68/push -8/imm32/stack-offset
10486 68/push 1/imm32/block-depth
10487 51/push-ecx
10488 68/push "foo"/imm32
10489 89/<- %ecx 4/r32/esp
10490
10491 68/push 0/imm32/is-deref:false
10492 68/push 0/imm32/next
10493 51/push-ecx/var-foo
10494 89/<- %ebx 4/r32/esp
10495
10496 68/push 0/imm32/next
10497 68/push 0/imm32/outputs
10498 53/push-ebx/operands
10499 68/push "increment"/imm32/operation
10500 68/push 1/imm32
10501 89/<- %esi 4/r32/esp
10502
10503 68/push 0/imm32/next
10504 68/push 0/imm32/output-is-write-only
10505 68/push 0/imm32/no-disp32
10506 68/push 0/imm32/no-imm32
10507 68/push 0/imm32/no-r32
10508 68/push 1/imm32/rm32-is-first-inout
10509 68/push "ff 0/subop/increment"/imm32/subx-name
10510 68/push 0/imm32/outputs
10511 53/push-ebx/inouts
10512 68/push "increment"/imm32/name
10513 89/<- %ebx 4/r32/esp
10514
10515 c7 0/subop/copy *Curr-block-depth 0/imm32
10516 (emit-subx-stmt _test-output-buffered-file %esi %ebx)
10517 (flush _test-output-buffered-file)
10518 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10524
10525 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive")
10526
10527 89/<- %esp 5/r32/ebp
10528 5d/pop-to-ebp
10529 c3/return
10530
10531 test-emit-subx-stmt-primitive-register:
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550 55/push-ebp
10551 89/<- %ebp 4/r32/esp
10552
10553 (clear-stream _test-output-stream)
10554 (clear-stream $_test-output-buffered-file->buffer)
10555
10556 68/push 0/imm32/right/null
10557 68/push 1/imm32/left/int
10558 89/<- %ecx 4/r32/esp
10559
10560 68/push "eax"/imm32/register
10561 68/push 0/imm32/no-stack-offset
10562 68/push 1/imm32/block-depth
10563 51/push-ecx
10564 68/push "foo"/imm32
10565 89/<- %ecx 4/r32/esp
10566
10567 68/push 0/imm32/is-deref:false
10568 68/push 0/imm32/next
10569 51/push-ecx/var-foo
10570 89/<- %ebx 4/r32/esp
10571
10572 68/push 0/imm32/next
10573 53/push-ebx/outputs
10574 68/push 0/imm32/inouts
10575 68/push "increment"/imm32/operation
10576 68/push 1/imm32
10577 89/<- %esi 4/r32/esp
10578
10579 68/push Any-register/imm32
10580 68/push 0/imm32/no-stack-offset
10581 68/push 1/imm32/block-depth
10582 ff 6/subop/push *(ecx+4)
10583 68/push "dummy"/imm32
10584 89/<- %ebx 4/r32/esp
10585
10586 68/push 0/imm32/is-deref:false
10587 68/push 0/imm32/next
10588 53/push-ebx/formal-var
10589 89/<- %ebx 4/r32/esp
10590
10591 68/push 0/imm32/next
10592 68/push 0/imm32/output-is-write-only
10593 68/push 0/imm32/no-disp32
10594 68/push 0/imm32/no-imm32
10595 68/push 0/imm32/no-r32
10596 68/push 3/imm32/rm32-in-first-output
10597 68/push "ff 0/subop/increment"/imm32/subx-name
10598 53/push-ebx/outputs
10599 68/push 0/imm32/inouts
10600 68/push "increment"/imm32/name
10601 89/<- %ebx 4/r32/esp
10602
10603 c7 0/subop/copy *Curr-block-depth 0/imm32
10604 (emit-subx-stmt _test-output-buffered-file %esi %ebx)
10605 (flush _test-output-buffered-file)
10606 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10612
10613 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register")
10614
10615 89/<- %esp 5/r32/ebp
10616 5d/pop-to-ebp
10617 c3/return
10618
10619 test-emit-subx-stmt-select-primitive:
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641 55/push-ebp
10642 89/<- %ebp 4/r32/esp
10643
10644 (clear-stream _test-output-stream)
10645 (clear-stream $_test-output-buffered-file->buffer)
10646
10647 68/push 0/imm32/right/null
10648 68/push 1/imm32/left/int
10649 89/<- %ecx 4/r32/esp
10650
10651 68/push "eax"/imm32/register
10652 68/push 0/imm32/no-stack-offset
10653 68/push 1/imm32/block-depth
10654 51/push-ecx
10655 68/push "foo"/imm32
10656 89/<- %ecx 4/r32/esp
10657
10658 68/push 0/imm32/is-deref:false
10659 68/push 0/imm32/next
10660 51/push-ecx/var-foo
10661 89/<- %edi 4/r32/esp
10662
10663 68/push 0/imm32/next
10664 57/push-edi/outputs
10665 68/push 0/imm32/inouts
10666 68/push "increment"/imm32/operation
10667 68/push 1/imm32
10668 89/<- %esi 4/r32/esp
10669
10670 68/push Any-register/imm32
10671 68/push 0/imm32/no-stack-offset
10672 68/push 1/imm32/block-depth
10673 ff 6/subop/push *(ecx+4)
10674 68/push "dummy"/imm32
10675 89/<- %ebx 4/r32/esp
10676
10677 68/push 0/imm32/is-deref:false
10678 68/push 0/imm32/next
10679 53/push-ebx/formal-var
10680 89/<- %ebx 4/r32/esp
10681
10682 68/push 0/imm32/next
10683 68/push 0/imm32/output-is-write-only
10684 68/push 0/imm32/no-disp32
10685 68/push 0/imm32/no-imm32
10686 68/push 0/imm32/no-r32
10687 68/push 3/imm32/rm32-in-first-output
10688 68/push "ff 0/subop/increment"/imm32/subx-name
10689 53/push-ebx/outputs/formal-outputs
10690 68/push 0/imm32/inouts
10691 68/push "increment"/imm32/name
10692 89/<- %ebx 4/r32/esp
10693
10694 53/push-ebx/next
10695 68/push 0/imm32/output-is-write-only
10696 68/push 0/imm32/no-disp32
10697 68/push 0/imm32/no-imm32
10698 68/push 0/imm32/no-r32
10699 68/push 1/imm32/rm32-is-first-inout
10700 68/push "ff 0/subop/increment"/imm32/subx-name
10701 68/push 0/imm32/outputs
10702 57/push-edi/inouts/real-outputs
10703 68/push "increment"/imm32/name
10704 89/<- %ebx 4/r32/esp
10705
10706 c7 0/subop/copy *Curr-block-depth 0/imm32
10707 (emit-subx-stmt _test-output-buffered-file %esi %ebx)
10708 (flush _test-output-buffered-file)
10709 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10715
10716 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive")
10717
10718 89/<- %esp 5/r32/ebp
10719 5d/pop-to-ebp
10720 c3/return
10721
10722 test-emit-subx-stmt-select-primitive-2:
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744 55/push-ebp
10745 89/<- %ebp 4/r32/esp
10746
10747 (clear-stream _test-output-stream)
10748 (clear-stream $_test-output-buffered-file->buffer)
10749
10750 68/push 0/imm32/right/null
10751 68/push 1/imm32/left/int
10752 89/<- %ecx 4/r32/esp
10753
10754 68/push "eax"/imm32/register
10755 68/push 0/imm32/no-stack-offset
10756 68/push 1/imm32/block-depth
10757 51/push-ecx
10758 68/push "foo"/imm32
10759 89/<- %ecx 4/r32/esp
10760
10761 68/push 0/imm32/is-deref:false
10762 68/push 0/imm32/next
10763 51/push-ecx/var-foo
10764 89/<- %edi 4/r32/esp
10765
10766 68/push 0/imm32/next
10767 68/push 0/imm32/outputs
10768 57/push-edi/inouts
10769 68/push "increment"/imm32/operation
10770 68/push 1/imm32
10771 89/<- %esi 4/r32/esp
10772
10773 68/push Any-register/imm32
10774 68/push 0/imm32/no-stack-offset
10775 68/push 1/imm32/block-depth
10776 ff 6/subop/push *(ecx+4)
10777 68/push "dummy"/imm32
10778 89/<- %ebx 4/r32/esp
10779
10780 68/push 0/imm32/is-deref:false
10781 68/push 0/imm32/next
10782 53/push-ebx/formal-var
10783 89/<- %ebx 4/r32/esp
10784
10785 68/push 0/imm32/next
10786 68/push 0/imm32/output-is-write-only
10787 68/push 0/imm32/no-disp32
10788 68/push 0/imm32/no-imm32
10789 68/push 0/imm32/no-r32
10790 68/push 3/imm32/rm32-in-first-output
10791 68/push "ff 0/subop/increment"/imm32/subx-name
10792 53/push-ebx/outputs/formal-outputs
10793 68/push 0/imm32/inouts
10794 68/push "increment"/imm32/name
10795 89/<- %ebx 4/r32/esp
10796
10797 53/push-ebx/next
10798 68/push 0/imm32/output-is-write-only
10799 68/push 0/imm32/no-disp32
10800 68/push 0/imm32/no-imm32
10801 68/push 0/imm32/no-r32
10802 68/push 1/imm32/rm32-is-first-inout
10803 68/push "ff 0/subop/increment"/imm32/subx-name
10804 68/push 0/imm32/outputs
10805 57/push-edi/inouts/real-outputs
10806 68/push "increment"/imm32/name
10807 89/<- %ebx 4/r32/esp
10808
10809 c7 0/subop/copy *Curr-block-depth 0/imm32
10810 (emit-subx-stmt _test-output-buffered-file %esi %ebx)
10811 (flush _test-output-buffered-file)
10812 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10818
10819 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2")
10820
10821 89/<- %esp 5/r32/ebp
10822 5d/pop-to-ebp
10823 c3/return
10824
10825 test-increment-register:
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841 55/push-ebp
10842 89/<- %ebp 4/r32/esp
10843
10844 (clear-stream _test-output-stream)
10845 (clear-stream $_test-output-buffered-file->buffer)
10846
10847 68/push 0/imm32/right/null
10848 68/push 1/imm32/left/int
10849 68/push 1/imm32/is-atom
10850 89/<- %ecx 4/r32/esp
10851
10852 68/push "eax"/imm32/register
10853 68/push 0/imm32/no-stack-offset
10854 68/push 1/imm32/block-depth
10855 51/push-ecx
10856 68/push "foo"/imm32
10857 89/<- %ecx 4/r32/esp
10858
10859 68/push 0/imm32/is-deref:false
10860 68/push 0/imm32/next
10861 51/push-ecx/var-foo
10862 89/<- %edi 4/r32/esp
10863
10864 68/push 0/imm32/next
10865 57/push-edi/outputs
10866 68/push 0/imm32/inouts
10867 68/push "increment"/imm32/operation
10868 68/push 1/imm32/regular-stmt
10869 89/<- %esi 4/r32/esp
10870
10871 c7 0/subop/copy *Curr-block-depth 0/imm32
10872 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
10873 (flush _test-output-buffered-file)
10874 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10880
10881 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register")
10882
10883 89/<- %esp 5/r32/ebp
10884 5d/pop-to-ebp
10885 c3/return
10886
10887 test-increment-var:
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903 55/push-ebp
10904 89/<- %ebp 4/r32/esp
10905
10906 (clear-stream _test-output-stream)
10907 (clear-stream $_test-output-buffered-file->buffer)
10908
10909 68/push 0/imm32/right/null
10910 68/push 1/imm32/left/int
10911 68/push 1/imm32/is-atom
10912 89/<- %ecx 4/r32/esp
10913
10914 68/push "eax"/imm32/register
10915 68/push 0/imm32/no-stack-offset
10916 68/push 1/imm32/block-depth
10917 51/push-ecx
10918 68/push "foo"/imm32
10919 89/<- %ecx 4/r32/esp
10920
10921 68/push 0/imm32/is-deref:false
10922 68/push 0/imm32/next
10923 51/push-ecx/var-foo
10924 89/<- %edi 4/r32/esp
10925
10926 68/push 0/imm32/next
10927 57/push-edi/outputs
10928 68/push 0/imm32/inouts
10929 68/push "increment"/imm32/operation
10930 68/push 1/imm32
10931 89/<- %esi 4/r32/esp
10932
10933 c7 0/subop/copy *Curr-block-depth 0/imm32
10934 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
10935 (flush _test-output-buffered-file)
10936 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
10942
10943 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-var")
10944
10945 89/<- %esp 5/r32/ebp
10946 5d/pop-to-ebp
10947 c3/return
10948
10949 test-add-reg-to-reg:
10950
10951
10952
10953
10954
10955 55/push-ebp
10956 89/<- %ebp 4/r32/esp
10957
10958 (clear-stream _test-output-stream)
10959 (clear-stream $_test-output-buffered-file->buffer)
10960
10961 68/push 0/imm32/right/null
10962 68/push 1/imm32/left/int
10963 68/push 1/imm32/is-atom
10964 89/<- %ecx 4/r32/esp
10965
10966 68/push "eax"/imm32/register
10967 68/push 0/imm32/no-stack-offset
10968 68/push 1/imm32/block-depth
10969 51/push-ecx
10970 68/push "var1"/imm32
10971 89/<- %ecx 4/r32/esp
10972
10973 68/push "ecx"/imm32/register
10974 68/push 0/imm32/no-stack-offset
10975 68/push 1/imm32/block-depth
10976 ff 6/subop/push *(ecx+4)
10977 68/push "var2"/imm32
10978 89/<- %edx 4/r32/esp
10979
10980 68/push 0/imm32/is-deref:false
10981 68/push 0/imm32/next
10982 52/push-edx/var-var2
10983 89/<- %esi 4/r32/esp
10984
10985 68/push 0/imm32/is-deref:false
10986 68/push 0/imm32/next
10987 51/push-ecx/var-var1
10988 89/<- %edi 4/r32/esp
10989
10990 68/push 0/imm32/next
10991 57/push-edi/outputs
10992 56/push-esi/inouts
10993 68/push "add"/imm32/operation
10994 68/push 1/imm32
10995 89/<- %esi 4/r32/esp
10996
10997 c7 0/subop/copy *Curr-block-depth 0/imm32
10998 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
10999 (flush _test-output-buffered-file)
11000 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11006
11007 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg")
11008
11009 89/<- %esp 5/r32/ebp
11010 5d/pop-to-ebp
11011 c3/return
11012
11013 test-add-reg-to-mem:
11014
11015
11016
11017
11018
11019 55/push-ebp
11020 89/<- %ebp 4/r32/esp
11021
11022 (clear-stream _test-output-stream)
11023 (clear-stream $_test-output-buffered-file->buffer)
11024
11025 68/push 0/imm32/right/null
11026 68/push 1/imm32/left/int
11027 68/push 1/imm32/is-atom
11028 89/<- %ecx 4/r32/esp
11029
11030 68/push 0/imm32/no-register
11031 68/push 8/imm32/stack-offset
11032 68/push 1/imm32/block-depth
11033 51/push-ecx
11034 68/push "var1"/imm32
11035 89/<- %ecx 4/r32/esp
11036
11037 68/push "ecx"/imm32/register
11038 68/push 0/imm32/no-stack-offset
11039 68/push 1/imm32/block-depth
11040 ff 6/subop/push *(ecx+4)
11041 68/push "var2"/imm32
11042 89/<- %edx 4/r32/esp
11043
11044 68/push 0/imm32/is-deref:false
11045 68/push 0/imm32/next
11046 52/push-edx/var-var2
11047 89/<- %esi 4/r32/esp
11048
11049 56/push-esi/next
11050 51/push-ecx/var-var1
11051 89/<- %esi 4/r32/esp
11052
11053 68/push 0/imm32/next
11054 68/push 0/imm32/outputs
11055 56/push-esi/inouts
11056 68/push "add-to"/imm32/operation
11057 68/push 1/imm32
11058 89/<- %esi 4/r32/esp
11059
11060 c7 0/subop/copy *Curr-block-depth 0/imm32
11061 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11062 (flush _test-output-buffered-file)
11063 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11069
11070 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem")
11071
11072 89/<- %esp 5/r32/ebp
11073 5d/pop-to-ebp
11074 c3/return
11075
11076 test-add-mem-to-reg:
11077
11078
11079
11080
11081
11082 55/push-ebp
11083 89/<- %ebp 4/r32/esp
11084
11085 (clear-stream _test-output-stream)
11086 (clear-stream $_test-output-buffered-file->buffer)
11087
11088 68/push 0/imm32/right/null
11089 68/push 1/imm32/left/int
11090 68/push 1/imm32/is-atom
11091 89/<- %ecx 4/r32/esp
11092
11093 68/push "eax"/imm32/register
11094 68/push 0/imm32/no-stack-offset
11095 68/push 1/imm32/block-depth
11096 51/push-ecx
11097 68/push "var1"/imm32
11098 89/<- %ecx 4/r32/esp
11099
11100 68/push 0/imm32/no-register
11101 68/push 8/imm32/stack-offset
11102 68/push 1/imm32/block-depth
11103 ff 6/subop/push *(ecx+4)
11104 68/push "var2"/imm32
11105 89/<- %edx 4/r32/esp
11106
11107 68/push 0/imm32/is-deref:false
11108 68/push 0/imm32/next
11109 52/push-edx/var-var2
11110 89/<- %esi 4/r32/esp
11111
11112 68/push 0/imm32/is-deref:false
11113 68/push 0/imm32/next
11114 51/push-ecx/var-var1
11115 89/<- %edi 4/r32/esp
11116
11117 68/push 0/imm32/next
11118 57/push-edi/outputs
11119 56/push-esi/inouts
11120 68/push "add"/imm32/operation
11121 68/push 1/imm32
11122 89/<- %esi 4/r32/esp
11123
11124 c7 0/subop/copy *Curr-block-depth 0/imm32
11125 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11126 (flush _test-output-buffered-file)
11127 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11133
11134 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg")
11135
11136 89/<- %esp 5/r32/ebp
11137 5d/pop-to-ebp
11138 c3/return
11139
11140 test-add-literal-to-eax:
11141
11142
11143
11144
11145
11146 55/push-ebp
11147 89/<- %ebp 4/r32/esp
11148
11149 (clear-stream _test-output-stream)
11150 (clear-stream $_test-output-buffered-file->buffer)
11151
11152 68/push 0/imm32/right/null
11153 68/push 1/imm32/left/int
11154 68/push 1/imm32/is-atom
11155 89/<- %ecx 4/r32/esp
11156
11157 68/push "eax"/imm32/register
11158 68/push 0/imm32/no-stack-offset
11159 68/push 1/imm32/block-depth
11160 51/push-ecx
11161 68/push "var1"/imm32
11162 89/<- %ecx 4/r32/esp
11163
11164 68/push 0/imm32/right/null
11165 68/push 0/imm32/left/literal
11166 89/<- %edx 4/r32/esp
11167
11168 68/push 0/imm32/no-register
11169 68/push 0/imm32/no-stack-offset
11170 68/push 1/imm32/block-depth
11171 52/push-edx
11172 68/push "0x34"/imm32
11173 89/<- %edx 4/r32/esp
11174
11175 68/push 0/imm32/is-deref:false
11176 68/push 0/imm32/next
11177 52/push-edx/var-var2
11178 89/<- %esi 4/r32/esp
11179
11180 68/push 0/imm32/is-deref:false
11181 68/push 0/imm32/next
11182 51/push-ecx/var-var1
11183 89/<- %edi 4/r32/esp
11184
11185 68/push 0/imm32/next
11186 57/push-edi/outputs
11187 56/push-esi/inouts
11188 68/push "add"/imm32/operation
11189 68/push 1/imm32
11190 89/<- %esi 4/r32/esp
11191
11192 c7 0/subop/copy *Curr-block-depth 0/imm32
11193 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11194 (flush _test-output-buffered-file)
11195 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11201
11202 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax")
11203
11204 89/<- %esp 5/r32/ebp
11205 5d/pop-to-ebp
11206 c3/return
11207
11208 test-add-literal-to-reg:
11209
11210
11211
11212
11213
11214 55/push-ebp
11215 89/<- %ebp 4/r32/esp
11216
11217 (clear-stream _test-output-stream)
11218 (clear-stream $_test-output-buffered-file->buffer)
11219
11220 68/push 0/imm32/right/null
11221 68/push 1/imm32/left/int
11222 68/push 1/imm32/is-atom
11223 89/<- %ecx 4/r32/esp
11224
11225 68/push "ecx"/imm32/register
11226 68/push 0/imm32/no-stack-offset
11227 68/push 1/imm32/block-depth
11228 51/push-ecx
11229 68/push "var1"/imm32
11230 89/<- %ecx 4/r32/esp
11231
11232 68/push 0/imm32/right/null
11233 68/push 0/imm32/left/literal
11234 89/<- %edx 4/r32/esp
11235
11236 68/push 0/imm32/no-register
11237 68/push 0/imm32/no-stack-offset
11238 68/push 1/imm32/block-depth
11239 52/push-edx
11240 68/push "0x34"/imm32
11241 89/<- %edx 4/r32/esp
11242
11243 68/push 0/imm32/is-deref:false
11244 68/push 0/imm32/next
11245 52/push-edx/var-var2
11246 89/<- %esi 4/r32/esp
11247
11248 68/push 0/imm32/is-deref:false
11249 68/push 0/imm32/next
11250 51/push-ecx/var-var1
11251 89/<- %edi 4/r32/esp
11252
11253 68/push 0/imm32/next
11254 57/push-edi/outputs
11255 56/push-esi/inouts
11256 68/push "add"/imm32/operation
11257 68/push 1/imm32
11258 89/<- %esi 4/r32/esp
11259
11260 c7 0/subop/copy *Curr-block-depth 0/imm32
11261 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11262 (flush _test-output-buffered-file)
11263 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11269
11270 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg")
11271
11272 89/<- %esp 5/r32/ebp
11273 5d/pop-to-ebp
11274 c3/return
11275
11276 test-add-literal-to-mem:
11277
11278
11279
11280
11281
11282 55/push-ebp
11283 89/<- %ebp 4/r32/esp
11284
11285 (clear-stream _test-output-stream)
11286 (clear-stream $_test-output-buffered-file->buffer)
11287
11288 68/push 0/imm32/right/null
11289 68/push 1/imm32/left/int
11290 68/push 1/imm32/is-atom
11291 89/<- %ecx 4/r32/esp
11292
11293 68/push 0/imm32/no-register
11294 68/push 8/imm32/stack-offset
11295 68/push 1/imm32/block-depth
11296 51/push-ecx
11297 68/push "var1"/imm32
11298 89/<- %ecx 4/r32/esp
11299
11300 68/push 0/imm32/right/null
11301 68/push 0/imm32/left/literal
11302 89/<- %edx 4/r32/esp
11303
11304 68/push 0/imm32/no-register
11305 68/push 0/imm32/no-stack-offset
11306 68/push 1/imm32/block-depth
11307 52/push-edx
11308 68/push "0x34"/imm32
11309 89/<- %edx 4/r32/esp
11310
11311 68/push 0/imm32/is-deref:false
11312 68/push 0/imm32/next
11313 52/push-edx/var-var2
11314 89/<- %esi 4/r32/esp
11315
11316 68/push 0/imm32/is-deref:false
11317 56/push-esi/next
11318 51/push-ecx/var-var1
11319 89/<- %esi 4/r32/esp
11320
11321 68/push 0/imm32/next
11322 68/push 0/imm32/outputs
11323 56/push-esi/inouts
11324 68/push "add-to"/imm32/operation
11325 68/push 1/imm32
11326 89/<- %esi 4/r32/esp
11327
11328 c7 0/subop/copy *Curr-block-depth 0/imm32
11329 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11330 (flush _test-output-buffered-file)
11331 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11337
11338 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem")
11339
11340 89/<- %esp 5/r32/ebp
11341 5d/pop-to-ebp
11342 c3/return
11343
11344 test-compare-mem-with-reg:
11345
11346
11347
11348
11349
11350 55/push-ebp
11351 89/<- %ebp 4/r32/esp
11352
11353 (clear-stream _test-output-stream)
11354 (clear-stream $_test-output-buffered-file->buffer)
11355
11356 68/push 0/imm32/right/null
11357 68/push 1/imm32/left/int
11358 68/push 1/imm32/is-atom
11359 89/<- %ecx 4/r32/esp
11360
11361 68/push "eax"/imm32/register
11362 68/push 0/imm32/no-stack-offset
11363 68/push 1/imm32/block-depth
11364 51/push-ecx
11365 68/push "var2"/imm32
11366 89/<- %ecx 4/r32/esp
11367
11368 68/push 0/imm32/no-register
11369 68/push 8/imm32/stack-offset
11370 68/push 1/imm32/block-depth
11371 ff 6/subop/push *(ecx+4)
11372 68/push "var1"/imm32
11373 89/<- %edx 4/r32/esp
11374
11375 68/push 0/imm32/is-deref:false
11376 68/push 0/imm32/next
11377 51/push-ecx/var-var2
11378 89/<- %esi 4/r32/esp
11379
11380 68/push 0/imm32/is-deref:false
11381 56/push-esi
11382 52/push-edx/var-var1
11383 89/<- %esi 4/r32/esp
11384
11385 68/push 0/imm32/next
11386 68/push 0/imm32/outputs
11387 56/push-esi/inouts
11388 68/push "compare"/imm32/operation
11389 68/push 1/imm32
11390 89/<- %esi 4/r32/esp
11391
11392 c7 0/subop/copy *Curr-block-depth 0/imm32
11393 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11394 (flush _test-output-buffered-file)
11395 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11401
11402 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg")
11403
11404 89/<- %esp 5/r32/ebp
11405 5d/pop-to-ebp
11406 c3/return
11407
11408 test-compare-reg-with-mem:
11409
11410
11411
11412
11413
11414 55/push-ebp
11415 89/<- %ebp 4/r32/esp
11416
11417 (clear-stream _test-output-stream)
11418 (clear-stream $_test-output-buffered-file->buffer)
11419
11420 68/push 0/imm32/right/null
11421 68/push 1/imm32/left/int
11422 68/push 1/imm32/is-atom
11423 89/<- %ecx 4/r32/esp
11424
11425 68/push "eax"/imm32/register
11426 68/push 0/imm32/no-stack-offset
11427 68/push 1/imm32/block-depth
11428 51/push-ecx
11429 68/push "var1"/imm32
11430 89/<- %ecx 4/r32/esp
11431
11432 68/push 0/imm32/no-register
11433 68/push 8/imm32/stack-offset
11434 68/push 1/imm32/block-depth
11435 ff 6/subop/push *(ecx+4)
11436 68/push "var2"/imm32
11437 89/<- %edx 4/r32/esp
11438
11439 68/push 0/imm32/is-deref:false
11440 68/push 0/imm32/next
11441 52/push-edx/var-var2
11442 89/<- %esi 4/r32/esp
11443
11444 68/push 0/imm32/is-deref:false
11445 56/push-esi
11446 51/push-ecx/var-var1
11447 89/<- %esi 4/r32/esp
11448
11449 68/push 0/imm32/next
11450 68/push 0/imm32/outputs
11451 56/push-esi/inouts
11452 68/push "compare"/imm32/operation
11453 68/push 1/imm32
11454 89/<- %esi 4/r32/esp
11455
11456 c7 0/subop/copy *Curr-block-depth 0/imm32
11457 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11458 (flush _test-output-buffered-file)
11459 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11465
11466 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem")
11467
11468 89/<- %esp 5/r32/ebp
11469 5d/pop-to-ebp
11470 c3/return
11471
11472 test-compare-mem-with-literal:
11473
11474
11475
11476
11477
11478 55/push-ebp
11479 89/<- %ebp 4/r32/esp
11480
11481 (clear-stream _test-output-stream)
11482 (clear-stream $_test-output-buffered-file->buffer)
11483
11484 68/push 0/imm32/right/null
11485 68/push 1/imm32/left/int
11486 68/push 1/imm32/is-atom
11487 89/<- %ecx 4/r32/esp
11488
11489 68/push 0/imm32/no-register
11490 68/push 8/imm32/stack-offset
11491 68/push 1/imm32/block-depth
11492 51/push-ecx
11493 68/push "var1"/imm32
11494 89/<- %ecx 4/r32/esp
11495
11496 68/push 0/imm32/right/null
11497 68/push 0/imm32/left/literal
11498 89/<- %edx 4/r32/esp
11499
11500 68/push 0/imm32/no-register
11501 68/push 0/imm32/no-stack-offset
11502 68/push 1/imm32/block-depth
11503 52/push-edx
11504 68/push "0x34"/imm32
11505 89/<- %edx 4/r32/esp
11506
11507 68/push 0/imm32/is-deref:false
11508 68/push 0/imm32/next
11509 52/push-edx/var-var2
11510 89/<- %esi 4/r32/esp
11511
11512 68/push 0/imm32/is-deref:false
11513 56/push-esi/next
11514 51/push-ecx/var-var1
11515 89/<- %esi 4/r32/esp
11516
11517 68/push 0/imm32/next
11518 68/push 0/imm32/outputs
11519 56/push-esi/inouts
11520 68/push "compare"/imm32/operation
11521 68/push 1/imm32
11522 89/<- %esi 4/r32/esp
11523
11524 c7 0/subop/copy *Curr-block-depth 0/imm32
11525 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11526 (flush _test-output-buffered-file)
11527 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11533
11534 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal")
11535
11536 89/<- %esp 5/r32/ebp
11537 5d/pop-to-ebp
11538 c3/return
11539
11540 test-compare-eax-with-literal:
11541
11542
11543
11544
11545
11546 55/push-ebp
11547 89/<- %ebp 4/r32/esp
11548
11549 (clear-stream _test-output-stream)
11550 (clear-stream $_test-output-buffered-file->buffer)
11551
11552 68/push 0/imm32/right/null
11553 68/push 1/imm32/left/int
11554 68/push 1/imm32/is-atom
11555 89/<- %ecx 4/r32/esp
11556
11557 68/push "eax"/imm32/register
11558 68/push 0/imm32/no-stack-offset
11559 68/push 1/imm32/block-depth
11560 51/push-ecx
11561 68/push "var1"/imm32
11562 89/<- %ecx 4/r32/esp
11563
11564 68/push 0/imm32/right/null
11565 68/push 0/imm32/left/literal
11566 89/<- %edx 4/r32/esp
11567
11568 68/push 0/imm32/no-register
11569 68/push 0/imm32/no-stack-offset
11570 68/push 1/imm32/block-depth
11571 52/push-edx
11572 68/push "0x34"/imm32
11573 89/<- %edx 4/r32/esp
11574
11575 68/push 0/imm32/is-deref:false
11576 68/push 0/imm32/next
11577 52/push-edx/var-var2
11578 89/<- %esi 4/r32/esp
11579
11580 68/push 0/imm32/is-deref:false
11581 56/push-esi/next
11582 51/push-ecx/var-var1
11583 89/<- %esi 4/r32/esp
11584
11585 68/push 0/imm32/next
11586 68/push 0/imm32/outputs
11587 56/push-esi/inouts
11588 68/push "compare"/imm32/operation
11589 68/push 1/imm32/regular-stmt
11590 89/<- %esi 4/r32/esp
11591
11592 c7 0/subop/copy *Curr-block-depth 0/imm32
11593 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11594 (flush _test-output-buffered-file)
11595 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11601
11602 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal")
11603
11604 89/<- %esp 5/r32/ebp
11605 5d/pop-to-ebp
11606 c3/return
11607
11608 test-compare-reg-with-literal:
11609
11610
11611
11612
11613
11614 55/push-ebp
11615 89/<- %ebp 4/r32/esp
11616
11617 (clear-stream _test-output-stream)
11618 (clear-stream $_test-output-buffered-file->buffer)
11619
11620 68/push 0/imm32/right/null
11621 68/push 1/imm32/left/int
11622 68/push 1/imm32/is-atom
11623 89/<- %ecx 4/r32/esp
11624
11625 68/push "ecx"/imm32/register
11626 68/push 0/imm32/no-stack-offset
11627 68/push 1/imm32/block-depth
11628 51/push-ecx
11629 68/push "var1"/imm32
11630 89/<- %ecx 4/r32/esp
11631
11632 68/push 0/imm32/right/null
11633 68/push 0/imm32/left/literal
11634 89/<- %edx 4/r32/esp
11635
11636 68/push 0/imm32/no-register
11637 68/push 0/imm32/no-stack-offset
11638 68/push 1/imm32/block-depth
11639 52/push-edx
11640 68/push "0x34"/imm32
11641 89/<- %edx 4/r32/esp
11642
11643 68/push 0/imm32/is-deref:false
11644 68/push 0/imm32/next
11645 52/push-edx/var-var2
11646 89/<- %esi 4/r32/esp
11647
11648 68/push 0/imm32/is-deref:false
11649 56/push-esi/next
11650 51/push-ecx/var-var1
11651 89/<- %esi 4/r32/esp
11652
11653 68/push 0/imm32/next
11654 68/push 0/imm32/outputs
11655 56/push-esi/inouts
11656 68/push "compare"/imm32/operation
11657 68/push 1/imm32/regular-stmt
11658 89/<- %esi 4/r32/esp
11659
11660 c7 0/subop/copy *Curr-block-depth 0/imm32
11661 (emit-subx-stmt _test-output-buffered-file %esi Primitives)
11662 (flush _test-output-buffered-file)
11663 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11669
11670 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal")
11671
11672 89/<- %esp 5/r32/ebp
11673 5d/pop-to-ebp
11674 c3/return
11675
11676 test-emit-subx-stmt-function-call:
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694 55/push-ebp
11695 89/<- %ebp 4/r32/esp
11696
11697 (clear-stream _test-output-stream)
11698 (clear-stream $_test-output-buffered-file->buffer)
11699
11700 68/push 0/imm32/right/null
11701 68/push 1/imm32/left/int
11702 68/push 1/imm32/is-atom
11703 89/<- %ecx 4/r32/esp
11704
11705 68/push 0/imm32/no-register
11706 68/push -8/imm32/stack-offset
11707 68/push 0/imm32/block-depth
11708 51/push-ecx
11709 68/push "foo"/imm32
11710 89/<- %ecx 4/r32/esp
11711
11712 68/push 0/imm32/is-deref:false
11713 68/push 0/imm32/next
11714 51/push-ecx/var-foo
11715 89/<- %esi 4/r32/esp
11716
11717 68/push 0/imm32/next
11718 68/push 0/imm32/outputs
11719 56/push-esi/inouts
11720 68/push "f"/imm32/operation
11721 68/push 1/imm32
11722 89/<- %esi 4/r32/esp
11723
11724 c7 0/subop/copy *Curr-block-depth 0/imm32
11725 (emit-subx-stmt _test-output-buffered-file %esi 0)
11726 (flush _test-output-buffered-file)
11727 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11733
11734 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call")
11735
11736 89/<- %esp 5/r32/ebp
11737 5d/pop-to-ebp
11738 c3/return
11739
11740 test-emit-subx-stmt-function-call-with-literal-arg:
11741
11742
11743
11744
11745
11746
11747 55/push-ebp
11748 89/<- %ebp 4/r32/esp
11749
11750 (clear-stream _test-output-stream)
11751 (clear-stream $_test-output-buffered-file->buffer)
11752
11753 68/push 0/imm32/right/null
11754 68/push 0/imm32/left/literal
11755 89/<- %ecx 4/r32/esp
11756
11757 68/push 0/imm32/no-register
11758 68/push 0/imm32/no-stack-offset
11759 68/push 0/imm32/block-depth
11760 51/push-ecx
11761 68/push "34"/imm32
11762 89/<- %ecx 4/r32/esp
11763
11764 68/push 0/imm32/is-deref:false
11765 68/push 0/imm32/next
11766 51/push-ecx/var-foo
11767 89/<- %esi 4/r32/esp
11768
11769 68/push 0/imm32/next
11770 68/push 0/imm32/outputs
11771 56/push-esi/inouts
11772 68/push "f"/imm32/operation
11773 68/push 1/imm32
11774 89/<- %esi 4/r32/esp
11775
11776 c7 0/subop/copy *Curr-block-depth 0/imm32
11777 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx)
11778 (flush _test-output-buffered-file)
11779 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------
11785
11786 (check-next-stream-line-equal _test-output-stream "(f 34)" "F - test-emit-subx-stmt-function-call-with-literal-arg")
11787
11788 89/<- %esp 5/r32/ebp
11789 5d/pop-to-ebp
11790 c3/return
11791
11792 emit-indent:
11793
11794 55/push-ebp
11795 89/<- %ebp 4/r32/esp
11796
11797 50/push-eax
11798
11799 8b/-> *(ebp+0xc) 0/r32/eax
11800 {
11801
11802 3d/compare-eax-with 0/imm32
11803 7e/jump-if-<= break/disp8
11804 (write-buffered *(ebp+8) " ")
11805 48/decrement-eax
11806 eb/jump loop/disp8
11807 }
11808 $emit-indent:end:
11809
11810 58/pop-to-eax
11811
11812 89/<- %esp 5/r32/ebp
11813 5d/pop-to-ebp
11814 c3/return
11815
11816 emit-subx-prologue:
11817
11818 55/push-ebp
11819 89/<- %ebp 4/r32/esp
11820
11821 (write-buffered *(ebp+8) " # . prologue\n")
11822 (write-buffered *(ebp+8) " 55/push-ebp\n")
11823 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n")
11824 $emit-subx-prologue:end:
11825
11826 89/<- %esp 5/r32/ebp
11827 5d/pop-to-ebp
11828 c3/return
11829
11830 emit-subx-epilogue:
11831
11832 55/push-ebp
11833 89/<- %ebp 4/r32/esp
11834
11835 (write-buffered *(ebp+8) " # . epilogue\n")
11836 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n")
11837 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n")
11838 (write-buffered *(ebp+8) " c3/return\n")
11839 $emit-subx-epilogue:end:
11840
11841 89/<- %esp 5/r32/ebp
11842 5d/pop-to-ebp
11843 c3/return