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:
		| @@ -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
									
								
							
							
						
						
									
										25
									
								
								examples/sysir/x64.janet
									
									
									
									
									
										Normal 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))) | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose