4 ms·
If you want a simple modern compiler backend intended for production-readiness, consider Cranelift [1]. It's largely written by Dan Gohman, who is a longtime LL
by pcwalton 7y ago
If you want a simple modern compiler backend intended for production-readiness, consider Cranelift [1]. It's largely written by Dan Gohman, who is a longtime LLVM contributor (and a colleague of mine). It does a lot of the things LLVM's backend passes do, but it's cleaner and better factored, with the benefit of a decade of hindsight [2]. Cranelift should be great for teaching purposes.
[1]: https://github.com/CraneStation/cranelift https://github.com/CraneStation/cranelift
[2]: https://cranelift.readthedocs.io/en/latest/compare-llvm.html https://cranelift.readthedocs.io/en/latest/compare-llvm.html
- dhuramas 7y agoI was wondering where I had heard of Cranelift before- seems like it is the default backend for wasmer[1]. [1] https://github.com/wasmerio/wasmer#building https://github.com/wasmerio/wasmer#building
- ChuckMcM 7y agoThat is a pretty neat backend for compilers. Definitely worth using when going to the 'next level' between how do we take text and turn it into binary as level 1, and then level 2, how do we improve the binary we're going to generate by understanding what the ASTs are telling us.
- nickpsecurity 7y agoThanks. I'll check it out. In that vein, what do you think of QBE (open-source) and LCC for understandable compilers? https://c9x.me/compile/ https://c9x.me/compile/ https://en.wikipedia.org/wiki/LCC_(compiler) https://en.wikipedia.org/wiki/LCC_(compiler)
- ndesaulniers 7y agoAny plan to use this in rustc? If so, is there a plan to maintain cross language LTO w/ C++?
- masklinn 7y ago> Any plan to use this in rustc? One of the primary expectations / use cases for cranelift is its use for rustc's debug builds: https://github.com/CraneStation/cranelift/blob/master/rustc.md https://github.com/CraneStation/cranelift/blob/master/rustc....
- pcwalton 7y agoDefinitely, for debug builds. Eventually perhaps for release—LTO is one of the many things we would have to figure out if we go down this road.