X-Git-Url: https://git.lukelau.me/?p=scheme.git;a=blobdiff_plain;f=codegen.scm;h=2d60c0aed64c22d3f1933544bf1a5df7101ce62c;hp=4e05bcf797b31d175a9629aac4b75868bbd9c72e;hb=d0e9f5296b7510fe057be4a2f9e2a31ed856652c;hpb=91145e54f41ee88f1e279a80430b3f5ed4e7a8c6 diff --git a/codegen.scm b/codegen.scm index 4e05bcf..2d60c0a 100644 --- a/codegen.scm +++ b/codegen.scm @@ -67,17 +67,12 @@ (emit "not %rcx") ; -%rcx = strlen + 1 (emit "dec %rcx") - (case target - ('darwin (emit "movq %rbx, %rsi") ; string addr (emit "movq %rcx, %rdx") ; num bytes (emit "movq $1, %rdi") ; file handle (stdout) - (emit "movq $0x2000004, %rax")) ; syscall 4 (write) - ('linux - (emit "mov %rbx, %rsi") ; string addr - (emit "mov %rcx, %rdx") ; num bytes - (emit "mov $1, %rax") ; file handle (stdout) - (emit "mov $1, %rdi"))) ; syscall 1 (write) + (case target + ('darwin (emit "mov $0x2000004, %rax")) ; syscall 4 (write) + ('linux (emit "mov $1, %rax"))) ; syscall 1 (write) (emit "syscall")) (define (range s n) @@ -309,7 +304,6 @@ (else (error #f "don't know how to codegen this")))) -(define (fold-map f x) (fold-left append '() (map f x))) (define (free-vars prog) (define bound '())