Add print integer fn
This commit is contained in:
parent
8f94d4673b
commit
c8ba7704e4
2 changed files with 5 additions and 0 deletions
|
@ -9,6 +9,7 @@ let _types_ =
|
||||||
; "%sub", Func_t (Int_t, [ Int_t; Int_t ])
|
; "%sub", Func_t (Int_t, [ Int_t; Int_t ])
|
||||||
; "%mul", Func_t (Int_t, [ Int_t; Int_t ])
|
; "%mul", Func_t (Int_t, [ Int_t; Int_t ])
|
||||||
; "%div", Func_t (Int_t, [ Int_t; Int_t ])
|
; "%div", Func_t (Int_t, [ Int_t; Int_t ])
|
||||||
|
; "puti", Func_t (Int_t, [ Int_t ])
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -20,5 +21,6 @@ let builtins =
|
||||||
; "%sub", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Sub (V0, T0, T1) ]
|
; "%sub", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Sub (V0, T0, T1) ]
|
||||||
; "%mul", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Mul (V0, T0, T1) ]
|
; "%mul", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Mul (V0, T0, T1) ]
|
||||||
; "%div", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Div (V0, T0, T1) ]
|
; "%div", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Div (V0, T0, T1) ]
|
||||||
|
; "puti", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.print_int); Syscall ]
|
||||||
]
|
]
|
||||||
;;
|
;;
|
||||||
|
|
3
tests/19_print.test
Normal file
3
tests/19_print.test
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
void main () {
|
||||||
|
puti(1312);
|
||||||
|
}
|
Reference in a new issue