1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Add tool that lets us more easily compare compilation paths.

Compare:
IR -> C -> x64
vs.
IR -> x64
This commit is contained in:
Calvin Rose
2025-03-29 20:37:51 -05:00
parent af73e214b2
commit c677c72a73
4 changed files with 113 additions and 11 deletions

View File

@@ -57,11 +57,11 @@
(defsys test_arrays:myvec [a:myvec b:myvec]
(return (+ a b)))
(defsys make_array:myvec []
'(defsys make_array:myvec []
(def vec:myvec [0 0 0 0])
(return vec))
(defsys make_mat:mymat []
'(defsys make_mat:mymat []
(def mat:mymat [[1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]])
(return mat))

25
examples/sysir/x64.janet Normal file
View File

@@ -0,0 +1,25 @@
(use ./frontend)
(defn-external printf:int [fmt:pointer x:int])
(defn-external exit:void [x:int])
(defsys doloop [x:int y:int]
(var i:int x)
#(printf "i = %d\n" i)
(while (< i y)
(set i (+ 1 i))
(printf "i = %d\n" i))
(return x))
(defsys _start:void []
(doloop 10 20)
(exit (the int 0))
(return))
(defn main [& args]
(def [_ what] args)
(dump)
(eprint "MODE: " what)
(case what
"c" (dumpc)
"x64" (dumpx64)))