1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-16 13:44:48 +00:00
janet/examples/sysir/arrays1.janet
Calvin Rose 3a782d27b1 Allow for multiple functions in a sysir "context".
Allows for in memory linking.
2023-10-22 16:05:38 -05:00

29 lines
549 B
Plaintext

(def types-asm
'((type-prim Double f64)
(type-array BigVec Double 100)))
(def add-asm
'((link-name "add_vector")
(parameter-count 2)
# Declarations
(bind a BigVec)
(bind b BigVec)
(bind c BigVec)
(add c a b)
(return c)))
(def sub-asm
'((link-name "sub_vector")
(parameter-count 2)
(bind a BigVec)
(bind b BigVec)
(bind c BigVec)
(subtract c a b)
(return c)))
(def ctx (sysir/context))
(sysir/asm ctx types-asm)
(sysir/asm ctx add-asm)
(sysir/asm ctx sub-asm)
(print (sysir/to-c ctx))