
Building an Optimizing Compiler provides a high-level design for a thorough optimizer, code generator, scheduler, and register allocator for a generic modern RISC processor. In the process it addresses the small issues that have a large impact on the implementation. The book approaches this subject from a practical viewpoint. Theory is introduced where intuitive arguments are insufficient; however, the theory is described in practical terms. Building an Optimizing Compiler provides a complete theory for static single assignment methods and partial redundancy methods for code optimization. It also provides a new generalization of register allocation techniques. A single running example is used throughout the book to illustrate the compilation process.
Static Program Analysis[1] also seems helpful to someone trying to write a compiler that does optimizations that require advanced analyses: https://cs.au.dk/~amoeller/spa/
For garbage collection, there's the Garbage Collection handbook[2]. I'm not aware of better additional resources, though.
Grune’s Parsing Techniques and Morgan’s Building an Optimizing Compiler are okay.
[Edit: it's Building an Optimizing Compiler by Bob Morgan.]
That's assuming you don't want to waste your time reading about parsing, type checking, or serializing an AST into some form of assembly, the parts of a compiler which just aren't that interesting.
1. "Writing Compilers and Interpreters" by Ronald Mak 2. "Building an Optimizing Compiler" by Bob Morgan
Morgan's book is well sought after and out of print. It's one of the few books in the field for which the print edition prices keep climbing.
The Dragon book is probably the best introductory text. The new version that came out a few years ago actually did improve the original text a fair bit. Although there is a lack of discussion about SSA in the text.
While most compiler books spend most of the text talking about the front-end of the compiler the crazy interesting stuff is in the backend. The new Dragon book greatly improves here over the old one, but I'd also recommend two other texts:
1) Morgan, Building an Optimizing Compiler -- some people love the writing style. Others hate it, but the material is solid. 2) Muchnick, Advanced Compiler Design and Implementation -- Great book. Must read if you're serious about optimizations.
Not just that, but the theory that drives modern compilers, like graph coloring register allocation and static single assignment form, weren't conceived until the mid 1980s (1984 and 1986 each), and better implementations of those theories were written about in the 90s. Linear scan register allocation was first written about in 1999.
You can compare these books:
Engineering a compiler: VAX-11 code generation and optimization, which was published in 1982, talks about the design and implementation of the PL/I compiler for the DEC VAX-11.
You can compare it to Bob Morgan's Building an Optimizing Compiler, which was published in 1997. The techniques he discusses there are a lot closer to how LLVM works today than the 1982 book.