From 2ea560deac46530577c78cbae44a0cef240572ed Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 1 Feb 2020 22:55:30 -0800 Subject: 5971 - emit code with indentation This is easy now that we're tracking block depths everywhere. --- apps/mu | Bin 106911 -> 108030 bytes apps/mu.subx | 565 ++++++++++++++++++++++++++++++++--------------------------- 2 files changed, 309 insertions(+), 256 deletions(-) (limited to 'apps') diff --git a/apps/mu b/apps/mu index 058fafb4..ff3a006e 100755 Binary files a/apps/mu and b/apps/mu differ diff --git a/apps/mu.subx b/apps/mu.subx index b7d60fe2..113fce7e 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -458,14 +458,14 @@ test-convert-function-skeleton: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-skeleton/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-skeleton/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-skeleton/4") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-skeleton/6") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-skeleton/7") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -517,23 +517,23 @@ test-convert-multiple-function-skeletons: #? (rewind-stream _test-output-stream) #? # }}} # check first function - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/4") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/7") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7") # check second function - (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/11") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/12") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/14") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/17") + (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -573,14 +573,14 @@ test-convert-function-with-arg: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-arg/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-arg/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-arg/4") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-arg/6") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-arg/7") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -625,17 +625,17 @@ test-convert-function-with-arg-and-body: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-arg-and-body/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-arg-and-body/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-arg-and-body/4") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/5") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-arg-and-body/6") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-arg-and-body/7") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/8") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/9") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-arg-and-body/10") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/5") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/6") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/7") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/8") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/9") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/10") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -680,17 +680,17 @@ test-convert-function-distinguishes-args: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-distinguishes-args/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-distinguishes-args/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-distinguishes-args/4") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/5") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-distinguishes-args/6") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-distinguishes-args/7") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/8") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/9") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-distinguishes-args/10") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/5") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/6") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/7") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/8") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/9") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/10") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -738,18 +738,18 @@ test-convert-function-returns-result: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-returns-result/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-returns-result/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-returns-result/4") - (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/5") - (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-convert-function-returns-result/6") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-returns-result/7") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-returns-result/8") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/9") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-returns-result/10") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-returns-result/11") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-returns-result/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-returns-result/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-returns-result/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-returns-result/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-returns-result/4") + (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-returns-result/5") + (check-next-stream-line-equal _test-output-stream " 40/increment-eax" "F - test-convert-function-returns-result/6") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-returns-result/7") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-returns-result/8") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-returns-result/9") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-returns-result/10") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-returns-result/11") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -797,18 +797,18 @@ test-convert-function-literal-arg: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-literal-arg/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-literal-arg/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-literal-arg/4") - (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-literal-arg/5") - (check-next-stream-line-equal _test-output-stream "05/add-to-eax 1/imm32" "F - test-convert-function-literal-arg/6") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-literal-arg/7") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-literal-arg/8") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg/9") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-literal-arg/10") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-literal-arg/11") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg/4") + (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-literal-arg/5") + (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-literal-arg/6") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg/7") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg/8") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg/9") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg/10") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg/11") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -856,18 +856,18 @@ test-convert-function-literal-arg-2: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg-2/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-literal-arg-2/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-literal-arg-2/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg-2/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-literal-arg-2/4") - (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-literal-arg-2/5") - (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ebx 1/imm32" "F - test-convert-function-literal-arg-2/6") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-literal-arg-2/7") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-literal-arg-2/8") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg-2/9") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-literal-arg-2/10") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-literal-arg-2/11") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-literal-arg-2/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-literal-arg-2/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-literal-arg-2/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-literal-arg-2/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-literal-arg-2/4") + (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-literal-arg-2/5") + (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-literal-arg-2/6") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-literal-arg-2/7") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-literal-arg-2/8") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-literal-arg-2/9") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-literal-arg-2/10") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-literal-arg-2/11") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -933,29 +933,29 @@ test-convert-function-call-with-literal-arg: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-call-with-literal-arg/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-call-with-literal-arg/4") - (check-next-stream-line-equal _test-output-stream "(do-add 3 4)" "F - test-convert-function-call-with-literal-arg/5") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-call-with-literal-arg/6") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-call-with-literal-arg/7") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/8") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/9") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-call-with-literal-arg/10") - (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/11") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-call-with-literal-arg/12") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-call-with-literal-arg/13") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/14") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-call-with-literal-arg/15") - (check-next-stream-line-equal _test-output-stream "8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/16") - (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/17") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-call-with-literal-arg/18") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-call-with-literal-arg/19") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/20") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/21") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-call-with-literal-arg/22") + (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") + (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/5") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/6") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/7") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/8") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/9") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/10") + (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/11") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/12") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/13") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/14") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/15") + (check-next-stream-line-equal _test-output-stream " 8b/copy-from *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/16") + (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/17") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/18") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/19") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/20") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/21") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/22") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1004,19 +1004,19 @@ test-convert-function-with-local-var-in-mem: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-local-var-in-mem/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-mem/4") - (check-next-stream-line-equal _test-output-stream "68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/5") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/6") - (check-next-stream-line-equal _test-output-stream "81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/7") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-mem/8") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-local-var-in-mem/9") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/10") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/11") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-local-var-in-mem/12") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") + (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/5") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/6") + (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/7") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/8") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/9") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/10") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/11") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/12") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1066,20 +1066,20 @@ test-convert-function-with-local-var-in-reg: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-local-var-in-reg/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-reg/4") - (check-next-stream-line-equal _test-output-stream "ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/5") - (check-next-stream-line-equal _test-output-stream "b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/6") - (check-next-stream-line-equal _test-output-stream "41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/7") - (check-next-stream-line-equal _test-output-stream "8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/8") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-reg/9") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-local-var-in-reg/10") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/11") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/12") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-local-var-in-reg/13") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") + (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/5") + (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/6") + (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/7") + (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/8") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/9") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/10") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/11") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/12") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/13") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1134,21 +1134,21 @@ test-convert-function-with-local-var-in-block: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-local-var-in-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-block/5") - (check-next-stream-line-equal _test-output-stream "68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/6") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/7") - (check-next-stream-line-equal _test-output-stream "81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/8") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-block/9") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-block/10") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-local-var-in-block/11") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/12") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/13") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-local-var-in-block/14") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/5") + (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/6") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/7") + (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/8") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/9") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/10") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/11") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/12") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/13") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/14") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1205,23 +1205,23 @@ test-convert-function-with-local-var-in-named-block: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-local-var-in-named-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-named-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-local-var-in-named-block/5") - (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/6") - (check-next-stream-line-equal _test-output-stream "68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/7") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/8") - (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/9") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-named-block/10") - (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/11") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-local-var-in-named-block/12") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-local-var-in-named-block/13") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/14") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/15") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-local-var-in-named-block/16") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/5") + (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/6") + (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/7") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/8") + (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/9") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/10") + (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/11") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/12") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/13") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/14") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/15") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/16") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1281,22 +1281,22 @@ test-convert-function-with-branches-in-block: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-branches-in-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-branches-in-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-branches-in-block/5") - (check-next-stream-line-equal _test-output-stream "0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/6") - (check-next-stream-line-equal _test-output-stream "0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/7") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/8") - (check-next-stream-line-equal _test-output-stream "e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/9") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-branches-in-block/10") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-branches-in-block/12") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-branches-in-block/13") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/14") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/15") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-branches-in-block/16") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/5") + (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= break/disp32" "F - test-convert-function-with-branches-in-block/6") + (check-next-stream-line-equal _test-output-stream " 0f 82/jump-if-addr< loop/disp32" "F - test-convert-function-with-branches-in-block/7") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/8") + (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/9") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/10") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/12") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/13") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/14") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/15") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/16") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1358,24 +1358,24 @@ test-convert-function-with-branches-in-named-block: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-branches-in-named-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-branches-in-named-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-branches-in-named-block/5") - (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/6") - (check-next-stream-line-equal _test-output-stream "0f 8d/jump-if->= $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/7") - (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/8") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/9") - (check-next-stream-line-equal _test-output-stream "e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/10") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-branches-in-named-block/11") - (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/12") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-branches-in-named-block/13") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-branches-in-named-block/14") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/15") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/16") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-branches-in-named-block/17") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/5") + (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/6") + (check-next-stream-line-equal _test-output-stream " 0f 8d/jump-if->= $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/7") + (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/8") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/9") + (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/10") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") + (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/12") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/13") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/14") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/15") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/16") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/17") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1436,23 +1436,23 @@ test-convert-function-with-var-in-nested-block: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-var-in-nested-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/5") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/6") - (check-next-stream-line-equal _test-output-stream "68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/7") - (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/8") - (check-next-stream-line-equal _test-output-stream "81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/9") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/10") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/11") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/13") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-var-in-nested-block/14") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/15") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/16") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-var-in-nested-block/17") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/5") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") + (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/7") + (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/8") + (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/9") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/10") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/11") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/14") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/15") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/16") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/17") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -1517,26 +1517,26 @@ test-convert-function-with-multiple-vars-in-nested-blocks: #? (rewind-stream _test-output-stream) #? # }}} # check output - (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-with-var-in-nested-block/1") - (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/4") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/5") - (check-next-stream-line-equal _test-output-stream "ff 6/subop/push %eax" "F - test-convert-function-with-var-in-nested-block/6") - (check-next-stream-line-equal _test-output-stream "b8/copy-to-eax 0/imm32" "F - test-convert-function-with-var-in-nested-block/7") - (check-next-stream-line-equal _test-output-stream "{" "F - test-convert-function-with-var-in-nested-block/8") - (check-next-stream-line-equal _test-output-stream "68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/9") - (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-var-in-nested-block/10") - (check-next-stream-line-equal _test-output-stream "81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/11") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/12") - (check-next-stream-line-equal _test-output-stream "8f 0/subop/pop %eax" "F - test-convert-function-with-var-in-nested-block/13") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/14") - (check-next-stream-line-equal _test-output-stream "}" "F - test-convert-function-with-var-in-nested-block/15") - (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-with-var-in-nested-block/16") - (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/17") - (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/18") - (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-with-var-in-nested-block/19") + (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/5") + (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-var-in-nested-block/6") + (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-var-in-nested-block/7") + (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") + (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/9") + (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-var-in-nested-block/10") + (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/11") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/12") + (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-var-in-nested-block/13") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/14") + (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") + (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/16") + (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/17") + (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/18") + (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/19") # . epilogue 89/<- %esp 5/r32/ebp 5d/pop-to-ebp @@ -3121,7 +3121,7 @@ populate-mu-function-body: # in: (addr buffered-file), out: (handle function), # edi = out 8b/-> *(ebp+0xc) 7/r32/edi # initialize some global state - c7 0/subop/copy *Curr-block-depth 0/imm32 + c7 0/subop/copy *Curr-block-depth 1/imm32 c7 0/subop/copy *Next-local-stack-offset -4/imm32 # var eax: (handle block) = parse-mu-block(in, vars) (parse-mu-block %esi *(ebp+0x10) %edi) # => eax @@ -4467,8 +4467,8 @@ emit-subx-function: # out: (addr buffered-file), f: (handle function) # (write-buffered %edi *ecx) (write-buffered %edi ":\n") + c7 0/subop/copy *Curr-block-depth 1/imm32 (emit-subx-prologue %edi) - c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-block %edi *(ecx+0x10) %edx) # Function-body (emit-subx-epilogue %edi) $emit-subx-function:end: @@ -4498,11 +4498,13 @@ emit-subx-block: # out: (addr buffered-file), block: (handle block), vars: (add $emit-subx-block:check-empty: 81 7/subop/compare %esi 0/imm32 0f 84/jump-if-= break/disp32 - ff 0/subop/increment *Curr-block-depth + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "{\n") + ff 0/subop/increment *Curr-block-depth (emit-subx-stmt-list *(ebp+8) %esi *(ebp+0x10)) - (write-buffered *(ebp+8) "}\n") ff 1/subop/decrement *Curr-block-depth + (emit-indent *(ebp+8) *Curr-block-depth) + (write-buffered *(ebp+8) "}\n") } $emit-subx-block:end: # . restore registers @@ -4564,6 +4566,7 @@ $emit-subx-stmt-list:regvardef: 81 7/subop/compare *(eax+0x10) 0/imm32 # Var-register 0f 84/jump-if-= $emit-subx-stmt-list:abort-regvardef-without-register/disp32 # emit spill + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "ff 6/subop/push %") (write-buffered *(ebp+8) *(eax+0x10)) (write-buffered *(ebp+8) Newline) @@ -4600,6 +4603,7 @@ $emit-subx-stmt-list:reclaim-loop: { 74/jump-if-= break/disp8 $emit-subx-stmt-list:reclaim-var-in-register: + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "8f 0/subop/pop %") (write-buffered *(ebp+8) *(ecx+0x10)) (write-buffered *(ebp+8) Newline) @@ -4610,6 +4614,7 @@ $emit-subx-stmt-list:reclaim-var-in-register: $emit-subx-stmt-list:reclaim-var-on-stack: (size-of %ecx) # => eax 01/add *Next-local-stack-offset 0/r32/eax + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "81 0/subop/add %esp ") (print-int32-buffered *(ebp+8) %eax) (write-buffered *(ebp+8) "/imm32\n") @@ -4655,6 +4660,7 @@ emit-subx-var-def: # out: (addr buffered-file), stmt: (handle statement) { 3d/compare-eax-with 0/imm32 7e/jump-if-<= break/disp8 + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "68/push 0/imm32\n") # n -= 4 2d/subtract-from-eax 4/imm32 @@ -4738,15 +4744,17 @@ emit-subx-named-block: # out: (addr buffered-file), named-block: (handle named- $emit-subx-named-block:check-empty: 81 7/subop/compare %eax 0/imm32 0f 84/jump-if-= break/disp32 - ff 0/subop/increment *Curr-block-depth + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "{\n") (write-buffered *(ebp+8) *(esi+8)) # Named-block-name (write-buffered *(ebp+8) "loop:\n") + ff 0/subop/increment *Curr-block-depth (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10)) + ff 1/subop/decrement *Curr-block-depth + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "}\n") (write-buffered *(ebp+8) *(esi+8)) # Named-block-name (write-buffered *(ebp+8) "break:\n") - ff 1/subop/decrement *Curr-block-depth } $emit-subx-named-block:end: # . restore registers @@ -6114,6 +6122,7 @@ emit-subx-primitive: # out: (addr buffered-file), stmt: (handle statement), pri # ecx = primitive 8b/-> *(ebp+0x10) 1/r32/ecx # emit primitive name + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) *(ecx+0xc)) # Primitive-subx-name # emit rm32 if necessary (emit-subx-rm32 *(ebp+8) *(ecx+0x10) *(ebp+0xc)) # out, Primitive-subx-rm32, stmt @@ -6311,6 +6320,7 @@ emit-subx-call: # out: (addr buffered-file), stmt: (handle statement), callee: 50/push-eax 51/push-ecx # + (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "(") # - emit function name 8b/-> *(ebp+0x10) 1/r32/ecx @@ -6791,6 +6801,7 @@ test-emit-subx-statement-primitive: 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi %ebx 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -6876,6 +6887,7 @@ test-emit-subx-statement-primitive-register: 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi %ebx 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -6976,6 +6988,7 @@ test-emit-subx-statement-select-primitive: 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi %ebx 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7076,6 +7089,7 @@ test-emit-subx-statement-select-primitive-2: 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi %ebx 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7135,6 +7149,7 @@ test-increment-register: 68/push 1/imm32/regular-statement 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7194,6 +7209,7 @@ test-increment-var: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7254,6 +7270,7 @@ test-add-reg-to-reg: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7314,6 +7331,7 @@ test-add-reg-to-mem: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7374,6 +7392,7 @@ test-add-mem-to-reg: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7438,6 +7457,7 @@ test-add-literal-to-eax: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7502,6 +7522,7 @@ test-add-literal-to-reg: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7566,6 +7587,7 @@ test-add-literal-to-mem: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7625,6 +7647,7 @@ test-compare-mem-with-reg: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7684,6 +7707,7 @@ test-compare-reg-with-mem: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7748,6 +7772,7 @@ test-compare-mem-with-literal: 68/push 1/imm32 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7812,6 +7837,7 @@ test-compare-eax-with-literal: 68/push 1/imm32/regular-stmt 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7876,6 +7902,7 @@ test-compare-reg-with-literal: 68/push 1/imm32/regular-stmt 89/<- %esi 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi Primitives 0) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -7948,6 +7975,7 @@ test-emit-subx-statement-function-call: 68/push "f"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -8006,6 +8034,7 @@ test-emit-subx-statement-function-call-with-literal-arg: 68/push "f"/imm32/name 89/<- %ebx 4/r32/esp # convert + c7 0/subop/copy *Curr-block-depth 0/imm32 (emit-subx-statement _test-output-buffered-file %esi 0 %ebx) (flush _test-output-buffered-file) #? # dump _test-output-stream {{{ @@ -8021,14 +8050,38 @@ test-emit-subx-statement-function-call-with-literal-arg: 5d/pop-to-ebp c3/return +emit-indent: # out: (addr buffered-file), n: int + # . prologue + 55/push-ebp + 89/<- %ebp 4/r32/esp + # . save registers + 50/push-eax + # var i/eax: int = n + 8b/-> *(ebp+0xc) 0/r32/eax + { + # if (i <= 0) break + 3d/compare-eax-with 0/imm32 + 7e/jump-if-<= break/disp8 + (write-buffered *(ebp+8) " ") + 48/decrement-eax + eb/jump loop/disp8 + } +$emit-indent:end: + # . restore registers + 58/pop-to-eax + # . epilogue + 89/<- %esp 5/r32/ebp + 5d/pop-to-ebp + c3/return + emit-subx-prologue: # out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # - (write-buffered *(ebp+8) "# . prologue\n") - (write-buffered *(ebp+8) "55/push-ebp\n") - (write-buffered *(ebp+8) "89/<- %ebp 4/r32/esp\n") + (write-buffered *(ebp+8) " # . prologue\n") + (write-buffered *(ebp+8) " 55/push-ebp\n") + (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") $emit-subx-prologue:end: # . epilogue 89/<- %esp 5/r32/ebp @@ -8040,10 +8093,10 @@ emit-subx-epilogue: # out: (addr buffered-file) 55/push-ebp 89/<- %ebp 4/r32/esp # - (write-buffered *(ebp+8) "# . epilogue\n") - (write-buffered *(ebp+8) "89/<- %esp 5/r32/ebp\n") - (write-buffered *(ebp+8) "5d/pop-to-ebp\n") - (write-buffered *(ebp+8) "c3/return\n") + (write-buffered *(ebp+8) " # . epilogue\n") + (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") + (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") + (write-buffered *(ebp+8) " c3/return\n") $emit-subx-epilogue:end: # . epilogue 89/<- %esp 5/r32/ebp -- cgit 1.4.1-2-gfad0