Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of Building an optimizing compiler

    Building an optimizing compiler

    Robert Morgan · 1998

    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.

    Computer ScienceProgramming
    Open LibraryAmazon
    Stats for nerds
    5recommend
    8mentions
    7people
    2010–2023years
    63% recommend38% neutral

    Mentions per year

    20102012201420162018202020222023

    What Hacker News says

    1. trealiraDec 2023
      Bob Morgan's book Building an Optimizing Compiler is entirely focused on modern compiler optimizations (and it was published in 1997). It goes over building a control flow graph, various optimizations you can do with that, alias analysis, static single assignment form, CFG dominator-based optimizations, instruction scheduling, register allocation, and emitting object code. It doesn't talk about lexing, parsing, NFAs/DFAs, etc. like most compiler books.

      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.

      [1]: https://cs.au.dk/~amoeller/spa/

      [2]: https://gchandbook.org/

      thread
    2. astrangeJun 2022
      The Dragon Book is a bad compiler book. Don’t recommend it just because it has a cool name.

      Grune’s Parsing Techniques and Morgan’s Building an Optimizing Compiler are okay.

      thread
    3. SamReidHughesJul 2018
      This book is not completionist but instead it's to the point and avoids wasting your time: https://www.amazon.com/gp/aw/d/155558179X/

      [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.

      thread
    4. cestithFeb 2017
      I already answered about "The Art of the Metaobject Protocol" but then two more language-implementation-centric books came to mind today.

      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.

      thread
    5. kenjacksonAug 2010
      Compilers is a huge topic. Think a topic the size of databases, with way less visibility.

      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.

      thread
    6. trealiraDec 2023
      > heavily optimising compilers a lot less common.

      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.

      thread

    Related

    Cover of Writing compilers and interpreters
    2010–2022

    Writing compilers and interpreters

    Ronald Mak
    4 recommend · 7
    Cover of Program Construction
    2016–2023

    Program Construction

    Roland C. Backhouse
    3 recommend · 4
    Cover of Advanced compiler design and implementation
    2008–2025

    Advanced compiler design and implementation

    Steven S. Muchnick
    13 recommend · 25
    Cover of Accelerated C++
    2007–2026

    Accelerated C++

    Andrew Koenig
    47 recommend · 70
    Cover of Engineering a compiler
    2007–2026

    Engineering a compiler

    Keith D. Cooper
    39 recommend · 91
    Cover of Optimizing compilers for modern architectures
    2010–2025

    Optimizing compilers for modern architectures

    Randy Allen
    3 recommend · 5
    Cover of Compiler construction
    2008–2026

    Compiler construction

    Niklaus Wirth
    30 recommend · 81
    Cover of Compilers, principles, techniques, and tools
    2007–2026

    Compilers, principles, techniques, and tools

    Alfred V. Aho
    195 recommend · 958