Back to directory

LLVM Code Generation by Example

The companion source repository for the Packt book "LLVM Code Generation", offering a chapter-by-chapter, tag-marked implementation of an LLVM backend built from scratch on top of the LLVM 20.1.1 release.

LLVM Code Generation by Example

This repository is the second companion repository for the book "LLVM Code Generation" and is based on the llvmorg-20.1.1 tag of the upstream LLVM project. It provides a step-by-step implementation of an LLVM backend, with begin_chXX/end_chXX tags marking the state of the code at each chapter.

A h2blb_utils directory holds a script that resets those chapter tags to the right commits after the underlying LLVM tree is rebased. The repository is force-pushed and rebased regularly to keep this chapter history readable, so it is not meant as a stable LLVM checkout; readers who want a stable LLVM copy should use the official LLVM repository instead.

Beyond the book material, the repository carries the full LLVM Compiler Infrastructure source: the core LLVM libraries and tools such as the assembler, disassembler and bitcode tools, the Clang C/C++/Objective-C frontend, the libc++ standard library and the LLD linker.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.