mirror of
https://github.com/janet-lang/janet
synced 2025-05-05 00:44:14 +00:00

Makes it easier to add simpler backends without needing to completely handle vectorization.
24 lines
491 B
Plaintext
24 lines
491 B
Plaintext
(def ir-asm
|
|
'((link-name "add_vectorp")
|
|
(parameter-count 2)
|
|
|
|
# Types
|
|
(type-prim Double f64)
|
|
(type-array BigVec Double 100)
|
|
(type-pointer BigVecP BigVec)
|
|
|
|
# Declarations
|
|
(bind 0 BigVecP)
|
|
(bind 1 BigVecP)
|
|
(bind 2 BigVecP)
|
|
(add 2 0 1)
|
|
(return 2)))
|
|
|
|
(def ctx (sysir/context))
|
|
(sysir/asm ctx ir-asm)
|
|
(print (sysir/to-c ctx))
|
|
(printf "%.99M" (sysir/to-ir ctx))
|
|
(print (sysir/scalarize ctx))
|
|
(printf "%.99M" (sysir/to-ir ctx))
|
|
(print (sysir/to-c ctx))
|