There seem to be an awful lot of resources on compiler frontends, and not so much on the backend.
There seem to be an awful lot of resources on compiler frontends, and not so much on the backend.
If you want to know more about LLVM IR specifically, check this [talk from 2019 EuroLLVM Developers’ Meeting][2]
Also -- and you knew it was coming -- I've written [a toy-compiler of a Scala subset][3] myself :)
I'm new to F# and writing compilers, so I'm sure the code is full of rookie mistakes. Still, it works and does generate assembly and executables for Linux and Windows.
[1]: https://www.cs.cornell.edu/courses/cs6120/2020fa/self-guided...
The GCC and LLVM machine models for example are very sophisticated and I've never seen anything like them documented in a textbook because they all basically assume a early 2000s RISC machine rather than a CISC with a very bulky decoder.
I think in general the backend is much easier (especially if you don't have to do your own optimizations) - you mostly need to know a couple of patterns for working with tree-like structures.