projects
/
scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
94d1c48
)
Fix static string addressing
author
Luke Lau
<luke.lau@intel.com>
Wed, 24 Jul 2019 12:21:09 +0000
(13:21 +0100)
committer
Luke Lau
<luke.lau@intel.com>
Wed, 24 Jul 2019 12:21:09 +0000
(13:21 +0100)
codegen.scm
patch
|
blob
|
history
diff --git
a/codegen.scm
b/codegen.scm
index 5303b4975854be55bfc5d36aedcf5e607ebe8db9..25d99a199da43889ef289b1e6af1292595aa4af0 100644
(file)
--- a/
codegen.scm
+++ b/
codegen.scm
@@
-213,7
+213,7
@@
('bool-literal (emit "movq $~a, %rax" (if e 1 0)))
('int-literal (emit "movq $~a, %rax" e))
('bool-literal (emit "movq $~a, %rax" (if e 1 0)))
('int-literal (emit "movq $~a, %rax" e))
- ('static-string (emit "movq
$~a
, %rax" (cadr e))) ; move label
+ ('static-string (emit "movq
(~a)
, %rax" (cadr e))) ; move label
(else (error #f "don't know how to codegen this"))))
(else (error #f "don't know how to codegen this"))))
@@
-279,7
+279,7
@@
(let ((transformed (extract program)))
(cons strings transformed))))
(let ((transformed (extract program)))
(cons strings transformed))))
-(define (
codegen
-string-data s)
+(define (
emit
-string-data s)
(emit "~a:" (car s))
(emit "\t.string \"~a\"" (cdr s)))
(emit "~a:" (car s))
(emit "\t.string \"~a\"" (cdr s)))
@@
-350,7
+350,7
@@
(emit "\t.data")
(emit "\t.data")
- (for-each
codegen
-string-data strings)))
+ (for-each
emit
-string-data strings)))
(define (compile-to-binary program output)
(when (not (eq? (typecheck program) 'int)) (error #f "not an int"))
(define (compile-to-binary program output)
(when (not (eq? (typecheck program) 'int)) (error #f "not an int"))