There seem to be a lot of very good tutorials on writing a simple compiler, like http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf http://compilers.iecc.com/crenshaw/
There are also readable code bases like tinyc or this one.
However these always use a simple template based approach to code generation and stop there.
Of course there are real world compiler (lvm, gcc, ...). However because of their size and complexity it's hard to learn from them.
What I am interested in would be going from: "I have an AST and for this node type I output this assembly." to "I translate the AST to an IR. Transform an the IR in multiple passes and finally output decent asm."
That is, something that talks about CFG analysis, register scheduling or maybe SSA form? I have read papers on SSA and Sea-of-Nodes IRs, but these of course always assume that you know how and why to use them. A more approachable text/github-repo that shows how to take the step from template base code gen to more advanced techniques would be great.
(I hope it is ok to ask this here. Did not want to hijack the thread.)