r/Compilers • u/Retired-69 • Jun 27 '26
Thoughts on multi-target compilation?
I've just finished adding multi-target compilation to my language, and it actually works. Incremental compilation currently halts before the code generation stage, which is intentional and I have no plans to change that.
Currently, the compiler can target x86-64, ARM64, and RISC-V from the same frontend.Raw machine code and assembly.
Are there any common pitfalls or edge cases I should be aware of as I wrap up the backend?
Everything is handwritten—I'm not using LLVM or any other compiler framework. I started by writing raw machine code in Notepad, built an assembler from that, then ported everything to Linux. I'm in the final stage now, and if everything goes according to plan, I should have a demo ready in about 1–2 months.
View all comments
Show parent comment
1
u/Retired-69 Jun 29 '26
Good question. Until now I have used the build-in intrinsic to print basic values without importing anything. This is not user friendly, unless you are a low-level nerd This solution doesn't fit well with Windows API, so there will be a library file before I go public with a demo. The print() you see in the code I illustrated is from that library file.