1
0
mirror of https://github.com/janet-lang/janet synced 2025-01-25 06:36:52 +00:00
Commit Graph

28 Commits

Author SHA1 Message Date
Calvin Rose
bc79489068 Begin working on drawing example. 2024-11-24 15:53:20 -06:00
Calvin Rose
80ed6538d0 Add constant checking in sysir middle end. 2024-10-05 12:05:04 -05:00
Calvin Rose
6577a18cef Better printing for complex constants.
Also added stub for checking if constants are valid in IR, but it is
not currently used.
2024-09-30 08:14:01 -05:00
Calvin Rose
ea332ff81e More work on making the temporary frontend a little nicer.
We need to create abstractions around more of the backend
to properly test and experiment with things, even if the frontend
is not final.
2024-09-29 15:55:10 -05:00
Calvin Rose
e96dd512f3 Work on some local type inference.
Right to left type inference in expressions for binary operators.
2024-09-29 11:37:04 -05:00
Calvin Rose
a588f1f242 More small tweaks to compile-opt. 2024-09-29 07:13:27 -05:00
Calvin Rose
3510e235ee More work on compile-opt 2024-06-21 17:16:56 -05:00
Calvin Rose
b6fb7ae69c x64 allow dynamically switching between windows and sysv target. 2024-06-17 23:02:05 -05:00
Calvin Rose
e5765b26d4 Working examples on windows.
Add some support for windows x64 ABI.
2024-06-17 07:07:20 -07:00
Calvin Rose
cdb3baaca3 Work on windows. 2024-06-16 13:37:25 -07:00
Calvin Rose
c413bc2b4e Don't assign variables positions on the stack that clobber import info.
(return address, previous basepoint, etc.)
2024-06-16 10:06:22 -05:00
Calvin Rose
314e684097 More work on x64 backend. 2024-06-14 16:57:32 -05:00
Calvin Rose
232a8faa35 More work compile-opt. 2024-06-13 07:27:48 -05:00
Calvin Rose
c31d8b52ff Add typed constants and lots more. 2024-06-12 13:57:33 -05:00
Calvin Rose
f0395763b7 More work on x86 target.
Also remove all (limited) type inference from the sysir. Type
inference is better done in frontend, limited inference in backend
just covers compilers issues.

Simple hello world with nasm working.
2024-06-10 20:16:04 -05:00
Calvin Rose
5b3c5a5969 Lots of work on calling conventions and x86 backend.
We need the ability to represent multiple calling conventions in IR.
All backends need to support a :default CC, but can also support more
for interop with system libraries, code from other compilers, syscalls, etc.

Also allow void returns.
2024-06-10 08:47:27 -05:00
Calvin Rose
af10c1d4b5 More work on x64 backend, especially branching.
Needs changes to IR to allow encoding immediates in all
instructions where possible. This makes the IR denser, means
we don't need `constant` and `callk`, and allows certain optimizations
like comparing to zero, using `inc` and `dec`, etc which are
specializations of more general instructions with constants.
2024-06-08 13:20:34 -05:00
Calvin Rose
25b7c74089 More work on register allocation and spilling.
Setup frontend.janet to show the basics of what is going on. Currently
emitting "fake" instructions just to hash out the idea.

One apparent issue is how we handle register spilling during variable
argument IR instructions (function calls). Arguments should come
_before_ the function call not after.
2024-06-05 17:50:11 -05:00
Calvin Rose
7ea118f248 Begin work on simple x64 backend.
Introduce register allocation, spilling, etc. First implementation
will likely emit textual assembly and use a very bad register allocation
algorithm.
2024-06-03 08:35:08 -05:00
Calvin Rose
480c5b5e9d Change how labels are recorded.
Disallow jumping to arbitrary instructions - instead, only allow jumps
to label ids. This will make various transformations and validations
easier since adding or remove instructions does not break jumps.
2024-06-02 09:43:33 -05:00
Calvin Rose
08e6051af8 More work on sysir compiler - basic function calls (without prototypes). 2024-05-15 07:24:15 -05:00
Calvin Rose
745567a2e0 More work on frontend. 2024-05-09 22:22:38 -05:00
Calvin Rose
ef2dfcd7c3 More work on a proof of concept frontend.
Basic frontend being prototyped in examples/sysir/frontend.janet. Still
a lot of work needs to be done here, and some of this code will
eventually move to C most likely, but this is a good way to better
exercise our backend.

Type inference - at the very least _forward_ inference, is the most
needed change here. While one could do this in the compiler
frontend, doing so in sysir/asm is not so much of an issue. "Inference"
here means inserting "bind" instructions when there is only a single
type that will work correctly.
2024-05-05 14:45:00 -05:00
Calvin Rose
3a782d27b1 Allow for multiple functions in a sysir "context".
Allows for in memory linking.
2023-10-22 16:05:38 -05:00
Calvin Rose
efbc46c69e Add support for using operators on arrays (and pointers to arrays).
Allows more expressive yet type checked representation of array
algorithms.
2023-09-03 12:32:28 -05:00
Calvin Rose
b939671b79 Add check for redefining types. 2023-08-13 11:09:20 -05:00
Calvin Rose
4b8e7a416f Have separate instructions for pointer arith 2023-08-12 17:36:06 -05:00
Calvin Rose
a2bd98390e More work on the sysir. 2023-08-12 13:42:52 -05:00