summaryrefslogtreecommitdiff
path: root/compiler.scm
diff options
context:
space:
mode:
Diffstat (limited to 'compiler.scm')
-rw-r--r--compiler.scm62
1 files changed, 31 insertions, 31 deletions
diff --git a/compiler.scm b/compiler.scm
index 411fe65..2e34ad2 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -64,55 +64,55 @@
(define (emit-tag-check x mask tag si)
(emit-expr x si)
- (emit "andl $~a, %eax" mask)
- (emit "cmpl $~a, %eax" tag)
- (emit "movl $0, %eax")
+ (emit "and $~a, %rax" mask)
+ (emit "cmp $~a, %rax" tag)
+ (emit "mov $0, %rax")
(emit "sete %al")
- (emit "sall $~a, %eax" boolean-shift)
- (emit "orl $~a, %eax" boolean-tag))
+ (emit "sal $~a, %rax" boolean-shift)
+ (emit "or $~a, %rax" boolean-tag))
(define (emit-comparison x y instruction si)
(emit-expr y si)
- (emit "movl %eax, ~a(%rsp)" si)
+ (emit "mov %rax, ~a(%rsp)" si)
(emit-expr x (- si wordsize))
- (emit "cmpl ~a(%rsp), %eax" si)
- (emit "movl $0, %eax")
+ (emit "cmp ~a(%rsp), %rax" si)
+ (emit "mov $0, %rax")
(emit "~a %al" instruction)
- (emit "sall $~a, %eax" boolean-shift)
- (emit "orl $~a, %eax" boolean-tag))
+ (emit "sal $~a, %rax" boolean-shift)
+ (emit "or $~a, %rax" boolean-tag))
(define (emit-primitive-call x si)
(case (primcall-op x)
((add1)
(emit-expr (primcall-operand1 x) si)
- (emit "addl $~a, %eax" (immediate-rep 1)))
+ (emit "add $~a, %rax" (immediate-rep 1)))
((sub1)
(emit-expr (primcall-operand1 x) si)
- (emit "subl $~a, %eax" (immediate-rep 1)))
+ (emit "sub $~a, %rax" (immediate-rep 1)))
((integer->char)
(emit-expr (primcall-operand1 x) si)
- (emit "sall $~a, %eax" (- char-shift fixnum-shift))
- (emit "orl $~a, %eax" char-tag))
+ (emit "sal $~a, %rax" (- char-shift fixnum-shift))
+ (emit "or $~a, %rax" char-tag))
((char->integer)
(emit-expr (primcall-operand1 x) si)
- (emit "shr $~a, %eax" (- char-shift fixnum-shift)))
+ (emit "shr $~a, %rax" (- char-shift fixnum-shift)))
((zero?)
(emit-expr (primcall-operand1 x) si)
;; Since the tag of fixnums is 0, we can skip an 'andl'
;; instruction that would apply the mask to the immediate
;; value.
- (emit "cmpl $0, %eax")
- (emit "movl $0, %eax")
+ (emit "cmp $0, %rax")
+ (emit "mov $0, %rax")
(emit "sete %al")
- (emit "sall $~a, %eax" boolean-shift)
- (emit "orl $~a, %eax" boolean-tag))
+ (emit "sal $~a, %rax" boolean-shift)
+ (emit "or $~a, %rax" boolean-tag))
((null?)
(emit-expr (primcall-operand1 x) si)
- (emit "cmpl $~a, %eax" empty-list)
- (emit "movl $0, %eax")
+ (emit "cmp $~a, %rax" empty-list)
+ (emit "mov $0, %rax")
(emit "sete %al")
- (emit "sall $~a, %eax" boolean-shift)
- (emit "orl $~a, %eax" boolean-tag))
+ (emit "sal $~a, %rax" boolean-shift)
+ (emit "or $~a, %rax" boolean-tag))
((integer?)
(emit-tag-check (primcall-operand1 x) fixnum-mask fixnum-tag si))
((char?)
@@ -121,23 +121,23 @@
(emit-tag-check (primcall-operand1 x) boolean-mask boolean-tag si))
((+)
(emit-expr (primcall-operand2 x) si)
- (emit "movl %eax, ~a(%rsp)" si)
+ (emit "mov %rax, ~a(%rsp)" si)
(emit-expr (primcall-operand1 x) (- si wordsize))
- (emit "addl ~a(%rsp), %eax" si))
+ (emit "add ~a(%rsp), %rax" si))
((-)
(emit-expr (primcall-operand2 x) si)
- (emit "movl %eax, ~a(%rsp)" si)
+ (emit "mov %rax, ~a(%rsp)" si)
(emit-expr (primcall-operand1 x) (- si wordsize))
- (emit "subl ~a(%rsp), %eax" si))
+ (emit "sub ~a(%rsp), %rax" si))
((*)
(emit-expr (primcall-operand2 x) si)
- (emit "movl %eax, ~a(%rsp)" si)
+ (emit "mov %rax, ~a(%rsp)" si)
(emit-expr (primcall-operand1 x) (- si wordsize))
- (emit "imull ~a(%rsp), %eax" si)
+ (emit "imul ~a(%rsp), %rax" si)
;; When two fixnums (which have 2 tag bits) are multiplied, the
;; relevant bits for the result are now 4 bytes to the left, so
;; we have to shift back 2 bytes.
- (emit "shr $~a, %eax" fixnum-shift))
+ (emit "shr $~a, %rax" fixnum-shift))
((=)
(emit-comparison (primcall-operand1 x) (primcall-operand2 x) "sete" si))
((<)
@@ -159,7 +159,7 @@
(define (emit-expr x si)
(cond
((immediate? x)
- (emit "movl $~a, %eax" (immediate-rep x)))
+ (emit "mov $~a, %rax" (immediate-rep x)))
((primcall? x)
(emit-primitive-call x si))
(else