string
This commit is contained in:
BIN
play/a.out
BIN
play/a.out
Binary file not shown.
BIN
play/string
Executable file
BIN
play/string
Executable file
Binary file not shown.
4
play/string.anf
Normal file
4
play/string.anf
Normal file
@@ -0,0 +1,4 @@
|
||||
;;; -*- mode:scheme -*-
|
||||
|
||||
(let ((x0 (prim:write "abc"))) x0)
|
||||
|
||||
23
play/string.s
Normal file
23
play/string.s
Normal file
@@ -0,0 +1,23 @@
|
||||
.data
|
||||
.balign 8
|
||||
.1:
|
||||
.ascii "abc"
|
||||
/* end data */
|
||||
|
||||
.text
|
||||
.globl main
|
||||
main:
|
||||
pushq %rbp
|
||||
movq %rsp, %rbp
|
||||
movl $3, %esi
|
||||
leaq .1(%rip), %rdi
|
||||
callq scm_from_utf8_string
|
||||
movq %rax, %rdi
|
||||
callq scm_write
|
||||
leave
|
||||
ret
|
||||
.type main, @function
|
||||
.size main, .-main
|
||||
/* end function main */
|
||||
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
1
play/string.scm
Normal file
1
play/string.scm
Normal file
@@ -0,0 +1 @@
|
||||
(prim:write "abc")
|
||||
10
play/string.ssa
Normal file
10
play/string.ssa
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
data $.1 =
|
||||
{b "abc"}
|
||||
export
|
||||
function w $main () {
|
||||
@start
|
||||
%.2 =l call $scm_from_utf8_string (l $.1, l 3)
|
||||
%x0 =l call $scm_write (l %.2)
|
||||
ret %x0
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
;;; -*- mode:scheme -*-
|
||||
|
||||
(let ((x0 (prim:cons 4 2)) (x1 (prim:cdr x0)) (x2 (prim:* 3 x1)) (x3 (prim:write x2))) x3)
|
||||
(let ((x0 (prim:cons 4 2)) (x1 (prim:write x0))) x1)
|
||||
|
||||
|
||||
6
play/t.s
6
play/t.s
@@ -5,9 +5,9 @@ main:
|
||||
movq %rsp, %rbp
|
||||
movl $16, %edi
|
||||
callq GC_malloc
|
||||
movq $18, (%rax)
|
||||
movq $10, 8(%rax)
|
||||
movl $26, %edi
|
||||
movq %rax, %rdi
|
||||
movq $18, (%rdi)
|
||||
movq $10, 8(%rdi)
|
||||
callq scm_write
|
||||
leave
|
||||
ret
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
(prim:write (prim:* 3
|
||||
(prim:cdr (prim:cons 4 2))))
|
||||
(prim:write (prim:cons 4 2))
|
||||
|
||||
15
play/t.ssa
15
play/t.ssa
@@ -2,16 +2,9 @@ export
|
||||
function w $main () {
|
||||
@start
|
||||
%x0 =l call $GC_malloc (l 16)
|
||||
%.4 =l add %x0, 8
|
||||
%.2 =l add %x0, 8
|
||||
storel 18, %x0
|
||||
storel 10, %.4
|
||||
%.5 =l add %x0, 8
|
||||
%x1 =l loadl %.5
|
||||
%.6 =l shr 14, 2
|
||||
%.7 =l shr %x1, 2
|
||||
%.8 =l mul %.6, %.7
|
||||
%.9 =l shl %.8, 2
|
||||
%x2 =l add %.9, 2
|
||||
%x3 =l call $scm_write (l %x2)
|
||||
ret %x3
|
||||
storel 10, %.2
|
||||
%x1 =l call $scm_write (l %x0)
|
||||
ret %x1
|
||||
}
|
||||
31
play/wtf.s
Normal file
31
play/wtf.s
Normal file
@@ -0,0 +1,31 @@
|
||||
.data
|
||||
.balign 8
|
||||
fstr:
|
||||
.ascii "%s"
|
||||
.byte 0
|
||||
/* end data */
|
||||
|
||||
.data
|
||||
.balign 8
|
||||
str:
|
||||
.ascii "안녕하세요"
|
||||
.byte 0
|
||||
/* end data */
|
||||
|
||||
.text
|
||||
.globl main
|
||||
main:
|
||||
pushq %rbp
|
||||
movq %rsp, %rbp
|
||||
leaq str(%rip), %rsi
|
||||
leaq fstr(%rip), %rdi
|
||||
movl $0, %eax
|
||||
callq printf
|
||||
movl $0, %eax
|
||||
leave
|
||||
ret
|
||||
.type main, @function
|
||||
.size main, .-main
|
||||
/* end function main */
|
||||
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
8
play/wtf.ssa
Normal file
8
play/wtf.ssa
Normal file
@@ -0,0 +1,8 @@
|
||||
data $fstr = { b "%s", b 0 }
|
||||
data $str = { b "안녕하세요", b 0 }
|
||||
|
||||
export function w $main () {
|
||||
@start
|
||||
call $printf (l $fstr, ..., l $str)
|
||||
ret 0
|
||||
}
|
||||
Reference in New Issue
Block a user