|
|
@ -45,7 +45,15 @@
|
|
45
|
45
|
(emit "xorl $15, %eax"))
|
|
46
|
46
|
((char->integer)
|
|
47
|
47
|
(emit-expr (primcall-operand1 x))
|
|
48
|
|
(emit "shrl $6, %eax"))))))
|
|
|
48
|
(emit "shrl $6, %eax"))
|
|
|
49
|
((zero?)
|
|
|
50
|
(emit-expr (primcall-operand1 x))
|
|
|
51
|
(emit "cmpl $0, %eax") ; x == 0
|
|
|
52
|
(emit "movl $0, %eax") ; zero %eax to put the result of the comparison into
|
|
|
53
|
(emit "sete %al") ; set low byte of %eax to 1 if cmp succeeded
|
|
|
54
|
(emit "sall $~a, %eax" boolean-shift) ; construct correctly tagged boolean value
|
|
|
55
|
(emit "xorl $31, %eax"))
|
|
|
56
|
))))
|
|
49
|
57
|
|
|
50
|
58
|
(define (compile-program x)
|
|
51
|
59
|
(display ".globl scheme_entry\n\n")
|
|
|
@ -54,4 +62,4 @@
|
|
54
|
62
|
(emit-expr x)
|
|
55
|
63
|
(emit "ret"))
|
|
56
|
64
|
|
|
57
|
|
(compile-program '(char->integer #\y))
|
|
|
65
|
(compile-program '(zero? -1))
|