cons example
This commit is contained in:
@@ -329,7 +329,7 @@ lowerArithmetic r p = QBE.BinaryOp r bop x y
|
|||||||
PrimMul a b -> (QBE.Mul,a,b)
|
PrimMul a b -> (QBE.Mul,a,b)
|
||||||
_ -> _
|
_ -> _
|
||||||
|
|
||||||
sizeofScm :: Int
|
sizeofScm :: Integral a => a
|
||||||
sizeofScm = 8
|
sizeofScm = 8
|
||||||
|
|
||||||
lowerCons
|
lowerCons
|
||||||
|
|||||||
BIN
example/cons
Executable file
BIN
example/cons
Executable file
Binary file not shown.
4
example/cons.anf
Normal file
4
example/cons.anf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
;;; -*- mode:scheme -*-
|
||||||
|
|
||||||
|
(let ((x0 (prim:cons 4 5)) (x1 (prim:write x0))) x1)
|
||||||
|
|
||||||
18
example/cons.s
Normal file
18
example/cons.s
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.text
|
||||||
|
.globl main
|
||||||
|
main:
|
||||||
|
pushq %rbp
|
||||||
|
movq %rsp, %rbp
|
||||||
|
movl $16, %edi
|
||||||
|
callq GC_malloc
|
||||||
|
movq %rax, %rdi
|
||||||
|
movq $18, (%rdi)
|
||||||
|
movq $22, 8(%rdi)
|
||||||
|
callq scm_write
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
.type main, @function
|
||||||
|
.size main, .-main
|
||||||
|
/* end function main */
|
||||||
|
|
||||||
|
.section .note.GNU-stack,"",@progbits
|
||||||
1
example/cons.scm
Normal file
1
example/cons.scm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(prim:write (prim:cons 4 5))
|
||||||
10
example/cons.ssa
Normal file
10
example/cons.ssa
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
export
|
||||||
|
function w $main () {
|
||||||
|
@start
|
||||||
|
%x0 =l call $GC_malloc (l 16)
|
||||||
|
%.2 =l add %x0, 8
|
||||||
|
storel 18, %x0
|
||||||
|
storel 22, %.2
|
||||||
|
%x1 =l call $scm_write (l %x0)
|
||||||
|
ret %x1
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user