r/ProgrammingLanguages • • Mar 26 '26

Discussion MIR intermediate compiler

https://github.com/vnmakarov/mir

i have been looking at MIR as a JIT backend for a language I’m building. Tiny, fast startup, not LLVM. Looks almost too good. Has anyone here built something on top of it?

For my language. I am thinking of having two modes, compiled and dynamic (neither of which I want to touch). Luajit for the default/dynamic and compiled functions if typed. I was going to just (try to) do (subset of)c transpilation with tinyC but then found something smaller, and faster and maybe easier to use?

25 Upvotes

16 comments sorted by

View all comments

Show parent comment

2

u/joonazan Mar 26 '26

Cranelift is nice but since it is meant for WASM, it has no support for arbitrary gotos.

The QBE source code is short but ugly and doesn't produce that good assembly.

I would really like to have a true portable assembly, so I think I have to make my own. I'm not sure if what I want is possible, though. LLVM does code generation by making a bad translation and the optimizing the result of the translation again. Maybe you just can't directly translate anything to perfect assembly.