Skip to content

References — Chapter 11 · Lowering & Code Generation: AST → PIR → LLVM IR

Every source this chapter cites, grouped by kind. Lessons cite entries inline as [KEY]; each entry says why and when to read it. Core reading marks the entries the chapter assumes you will open.

Foundational and research papers

  • [AGG62] Bruce W. Arden, Bernard A. Galler, and Robert M. Graham. An Algorithm for Translating Boolean Expressions. Journal of the ACM 9(2), pp. 222–239, 1962. doi:10.1145/321119.321123
    Why and when: The origin of jumping code: a Boolean expression becomes tests and jumps that stop as soon as the result is known. Compare its scheme with Algorithm 11.2.2 after Lesson 11.2 §2.
    Note: DOI recorded from the journal; not re-resolved from the course container.
    Cited in: overview, 02-short-circuit-lowering

  • [AJ89] Andrew W. Appel and Trevor Jim. Continuation-Passing, Closure-Passing Style. POPL 1989, pp. 293–302, 1989. doi:10.1145/75277.75303
    Why and when: Closure conversion as a source-to-source transformation in a CPS compiler, with flat vs linked environments and space safety; read after Lesson 11.8 §2 and §6.
    Note: DOI recorded from the proceedings; not re-resolved from the course container.
    Cited in: overview, 08-closure-conversion

  • [BBH+13] Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon, and Andreas Zwinkau. Simple and Efficient Construction of Static Single Assignment Form. CC 2013, LNCS 7791, pp. 102–122, 2013. doi:10.1007/978-3-642-37051-9_6
    Why and when: Core reading. On-the-fly SSA construction with sealing and trivial-phi removal, and the minimality proof for reducible CFGs. Section 2's pseudocode is the ★ E6 exercise; read it with Lesson 11.1 §2 (Algorithm 11.1.9, Theorem 11.1.11).
    Cited in: overview, exercises, 01-ssa-generation-strategies

  • [Ber85] Robert L. Bernstein. Producing Good Code for the Case Statement. Software—Practice and Experience 15(10), 1985.
    Why and when: The classic heuristic: split a sparse switch into dense jump tables joined by a comparison tree. The starting point of Lesson 11.3 §6 and of Kannan and Proebsting's correction.
    Note: Wiley journal; no DOI was re-resolved from the course container — find it by title.
    Cited in: overview, 03-switch-lowering

  • [CFRWZ91] Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM TOPLAS 13(4), pp. 451–490, 1991. doi:10.1145/115372.115320
    Why and when: Core reading. Phi placement at iterated dominance frontiers and renaming: what mem2reg does to the allocas of Lesson 11.1 (Algorithm 11.1.6). Read the placement and renaming sections; Chapter 16 implements them.
    Cited in: overview, 01-ssa-generation-strategies

  • [DS02] Olivier Danvy and Ulrik P. Schultz. Lambda-Lifting in Quadratic Time. FLOPS 2002, LNCS 2441, 2002.
    Why and when: Computes the extra parameters with a graph algorithm in quadratic time and describes lambda dropping, the inverse; the complexity row of Lesson 11.8 §5.
    Note: Springer LNCS; no DOI was re-resolved from the course container — find it by title.
    Cited in: overview, 08-closure-conversion

  • [HM82] John L. Hennessy and Noah Mendelsohn. Compilation of the Pascal Case Statement. Software—Practice and Experience 12(9), 1982.
    Why and when: Binary search over sorted case values and its comparison with tables; read with Lesson 11.3's Algorithm 11.3.4 and Theorem 11.3.5.
    Note: Wiley journal; no DOI was re-resolved from the course container — find it by title.
    Cited in: overview, 03-switch-lowering

  • [Iro61] Edgar T. Irons. A Syntax Directed Compiler for ALGOL 60. Communications of the ACM 4(1), pp. 51–55, 1961. doi:10.1145/366062.366083
    Why and when: The origin of attaching a translation to each grammar rule and producing code in one walk, the scheme of Lesson 11.1's Algorithm 11.1.3. Five pages; read it for the idea, not the ALGOL details.
    Note: DOI recorded from the journal; not re-resolved from the course container (doi.org is blocked there).
    Cited in: overview, 01-ssa-generation-strategies

  • [Joh85] Thomas Johnsson. Lambda Lifting: Transforming Programs to Recursive Equations. FPCA 1985, LNCS 201, pp. 190–203, 1985. doi:10.1007/3-540-15975-4_37
    Why and when: Lambda lifting: pass free variables as extra parameters and move local functions to the top level, with the fixed point over mutually recursive functions of Algorithm 11.8.4.
    Note: DOI recorded from the proceedings; not re-resolved from the course container.
    Cited in: overview, 08-closure-conversion

  • [KP94] Sampath Kannan and Todd A. Proebsting. Correction to 'Producing Good Code for the Case Statement'. Software—Practice and Experience 24(2), 1994.
    Why and when: Core reading. The dynamic program that partitions sorted cases into the fewest dense clusters, which LLVM's findJumpTables implements (with a score). Read after Lesson 11.3 §2 (Algorithm 11.3.7, Theorem 11.3.8).
    Note: Wiley journal; no DOI was re-resolved from the course container — find it by title.
    Cited in: overview, 03-switch-lowering

  • [Lan64] Peter J. Landin. The Mechanical Evaluation of Expressions. The Computer Journal 6(4), pp. 308–320, 1964. doi:10.1093/comjnl/6.4.308
    Why and when: The SECD machine, whose closures pair code with the environment of definition; the idea Lesson 11.8's closure conversion makes explicit.
    Note: DOI recorded from the journal; not re-resolved from the course container.
    Cited in: overview, 08-closure-conversion

  • [MMH96] Yasuhiko Minamide, Greg Morrisett, and Robert Harper. Typed Closure Conversion. POPL 1996, pp. 271–283, 1996. doi:10.1145/237721.237791
    Why and when: Closure conversion for typed languages, with environments as existential types and a correctness proof by logical relations; the full proof behind Theorem 11.8.3.
    Note: DOI recorded from the proceedings; not re-resolved from the course container.
    Cited in: overview, 08-closure-conversion

  • [Sal81] Arthur Sale. The Implementation of Case Statements in Pascal. Software—Practice and Experience 11(9), 1981.
    Why and when: When a jump table is worth its space for Pascal case statements; the density argument of Lesson 11.3 §1 and Algorithm 11.3.3.
    Note: Wiley journal; no DOI was re-resolved from the course container — find it by title in the journal's 1981 volume.
    Cited in: overview, 03-switch-lowering

  • [SG95] Vugranam C. Sreedhar and Guang R. Gao. A Linear Time Algorithm for Placing φ-Nodes. Proc. 22nd ACM Symposium on Principles of Programming Languages (POPL), pp. 62-73, 1995. doi:10.1145/199448.199464
    Why and when: The linear-time DF+ computation behind LLVM's IDFCalculator, which mem2reg calls; read it if Lesson 11.1 §5's cost of phi placement needs justifying.
    Cited in: 01-ssa-generation-strategies

  • [Str00] Christopher Strachey. Fundamental Concepts in Programming Languages. Higher-Order and Symbolic Computation 13(1–2), pp. 11–49 (lecture notes from 1967), 2000. doi:10.1023/A:1010000313106
    Why and when: Where L-values and R-values come from: an expression denotes a location or its contents, and the left of an assignment is evaluated for its location. Read §3.3 with Lesson 11.4 §1.
    Note: DOI recorded from the journal; not re-resolved from the course container.
    Cited in: overview, 04-places-values-and-loops

Textbooks and monographs

  • [ALSU07] Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools, 2nd ed.. Addison-Wesley, 2007. Read: §6.2 (three-address code), §6.4 (translation of expressions), §6.6 (control flow: jumping code for boolean expressions), §6.7 (backpatching), §6.8 (switch statements).
    Why and when: Core reading. The textbook version of Lessons 11.1–11.3: syntax-directed translation of expressions, conditions as jumps to true/false labels, and switch translation. Read §6.4 and §6.6 before E1–E2.
    Cited in: overview, 01-ssa-generation-strategies, 02-short-circuit-lowering

  • [Appel] Andrew W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998. Read: §7.1–7.2 (translation to intermediate trees: Ex, Nx and Cx, conditionals), §19.1 (converting to SSA form).
    Why and when: Represents a condition as a function from two labels to code (Cx), a clean formulation of Lesson 11.2's jumping code; read §7.2 with Algorithm 11.2.2. The C and Java editions share the numbering.
    Cited in: 02-short-circuit-lowering

  • [Lev00] John R. Levine. Linkers and Loaders. Morgan Kaufmann, 2000. Read: Ch. 3 (Object files), Ch. 6 (Libraries: archive search), Ch. 7 (Relocation).
    Why and when: How the linker resolves the runtime's symbols and searches archives; Ch. 6 is the long version of Theorem 11.9.6 (archive order). Read after Lesson 11.9.
    Cited in: overview, 09-runtime-and-linking

Source code (pinned versions)

  • [CL-SSA] Cranelift's SSA construction (Braun et al.) for its front-end helper — cranelift/frontend/src/ssa.rs in bytecodealliance/wasmtime at v37.0.2. Symbols: SSABuilder.
    Why and when: A production Braun-style builder with explicit sealing (seal_one_block, use_var); read it next to ★ E6 and Lesson 11.1 §7.
    Cited in: overview, 01-ssa-generation-strategies

  • [CLANG-AArch64ABI] Clang's AAPCS64 argument classification — clang/lib/CodeGen/Targets/AArch64.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: AArch64ABIInfo::classifyArgumentType.
    Why and when: Homogeneous floating-point aggregates, [2 x i64] coercion and indirect passing by caller copy on AArch64; the macOS side of Lesson 11.5.
    Cited in: overview, 05-aggregates-and-the-abi

  • [CLANG-BranchOnBool] Clang's jumping code for conditions — clang/lib/CodeGen/CodeGenFunction.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: CodeGenFunction::EmitBranchOnBoolExpr.
    Why and when: Recurses through &&, ||, ! and ?: with a true and a false block, exactly Algorithm 11.2.2; read with Lesson 11.2 §7.
    Cited in: 02-short-circuit-lowering

  • [CLANG-Call] Clang's call emission with ABI-adjusted arguments — clang/lib/CodeGen/CGCall.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: CodeGenFunction::EmitCall, ClangToLLVMArgMapping.
    Why and when: Applies the ABI classification to every argument (direct, coerced, sret, byval, indirect); read after Lesson 11.5 §2.
    Cited in: 05-aggregates-and-the-abi

  • [CLANG-CGExpr] Clang's l-value emission, stack slots and trap checks — clang/lib/CodeGen/CGExpr.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: CodeGenFunction::CreateTempAlloca, CodeGenFunction::EmitLValue, CodeGenFunction::EmitTrapCheck.
    Why and when: Three techniques of the chapter in one file: one alloca per local (Lesson 11.1), places (EmitLValue, Lesson 11.4) and trap blocks for -fsanitize-trap (Lesson 11.6).
    Cited in: overview, 01-ssa-generation-strategies, 04-places-values-and-loops, 06-safety-checks

  • [CLANG-EH] Clang's landing pads for C++ exceptions — clang/lib/CodeGen/CGException.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: CodeGenFunction::EmitLandingPad.
    Why and when: Where invoke targets and landingpad clauses of Lesson 11.7's box come from.
    Cited in: 07-exception-handling

  • [CLANG-ExprScalar] Clang's assignment and compound assignment — clang/lib/CodeGen/CGExprScalar.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: ScalarExprEmitter::VisitBinAssign, ScalarExprEmitter::EmitCompoundAssignLValue.
    Why and when: The evaluation order of a place and a value in C and C++ assignments; compare with Pebble's rule (Algorithm 11.4.4) after Lesson 11.4 §7.
    Cited in: 04-places-values-and-loops

  • [CLANG-GnuLink] The link line Clang's driver builds for GNU ld — clang/lib/Driver/ToolChains/Gnu.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: tools::gnutools::Linker::ConstructJob.
    Why and when: Start-up objects, -pie, the dynamic linker and libgcc/libc after the user's inputs, as in Lesson 11.9's clang -### box; macOS's is darwin::Linker::ConstructJob in Darwin.cpp.
    Cited in: overview, 09-runtime-and-linking

  • [CLANG-Lambda] C++ lambdas as closure classes — clang/lib/Sema/SemaLambda.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: Sema::BuildLambdaExpr.
    Why and when: Closure conversion in a C++ front end: the lambda becomes a class whose fields are the captures (Lesson 11.8 §7).
    Cited in: 08-closure-conversion

  • [CLANG-X86ABI] Clang's System V x86-64 classification and coercion — clang/lib/CodeGen/Targets/X86.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: X86_64ABIInfo::classify, X86_64ABIInfo::GetINTEGERTypeAtOffset, X86_64ABIInfo::GetSSETypeAtOffset, X86_64ABIInfo::classifyArgumentType.
    Why and when: Algorithm 11.5.4 in production, including the rule that picks i32 or i64 for an INTEGER eightbyte; the abi-classify drill's oracle matches its output. Read after Lesson 11.5 §2.
    Cited in: overview, 05-aggregates-and-the-abi

  • [COMPILERRT-Divti3] compiler-rt's 128-bit signed division helper — compiler-rt/lib/builtins/divti3.c in llvm/llvm-project at llvmorg-23.1.2. Symbols: __divti3.
    Why and when: A runtime-library function in its smallest form: one file per function, so an archive links only what is used (Lesson 11.9 §3 and §6).
    Cited in: overview, 09-runtime-and-linking

  • [GCC-Gimplify] GCC's gimplifier (temporaries and jumping code for conditions) — gcc/gimplify.cc in gcc-mirror/gcc at releases/gcc-15.1.0. Symbols: gimplify_expr, shortcut_cond_expr.
    Why and when: Syntax-directed temporaries (Lesson 11.1) and shortcut_cond_expr's jumping code (Lesson 11.2) in GCC; the GIMPLE boxes come from here.
    Cited in: 01-ssa-generation-strategies, 02-short-circuit-lowering

  • [GCC-I386] GCC's System V x86-64 argument classification — gcc/config/i386/i386.cc in gcc-mirror/gcc at releases/gcc-15.1.0. Symbols: classify_argument.
    Why and when: The same psABI rules as Clang's, applied to RTL modes; read with Algorithm 11.5.4 for a second implementation.
    Cited in: overview, 05-aggregates-and-the-abi

  • [GCC-LoopCH] GCC's loop header copying (loop rotation) — gcc/tree-ssa-loop-ch.cc in gcc-mirror/gcc at releases/gcc-15.1.0. Symbols: pass_ch.
    Why and when: GCC's rotation of top-tested loops into guarded do-while form (Lesson 11.4, Algorithm 11.4.7).
    Cited in: overview, 04-places-values-and-loops

  • [GCC-SwitchConv] GCC's switch clustering and decision trees — gcc/tree-switch-conversion.cc in gcc-mirror/gcc at releases/gcc-15.1.0. Symbols: jump_table_cluster::can_be_handled, bit_test_cluster::find_bit_tests, switch_decision_tree::analyze_switch_statement.
    Why and when: GCC's version of Algorithm 11.3.7: its own jump-table and bit-test clusters, then a decision tree; compare its dump with LLVM's choice in Lesson 11.3 §7.
    Cited in: overview, 03-switch-lowering

  • [GO-Bounds] Go's run-time panics for failed bounds checks — src/runtime/panic.go in golang/go at go1.24.7. Symbols: panicIndex.
    Why and when: The unwind policy of Lesson 11.6: a failed check calls a panic function that can be recovered; the compiler side is boundsCheck in ssagen/ssa.go.
    Cited in: overview, 06-safety-checks

  • [GO-Closure] Go's direct closure calls (lambda lifting a called function literal) — src/cmd/compile/internal/walk/closure.go in golang/go at go1.24.7. Symbols: directClosureCall.
    Why and when: Turns a directly called function literal into a call with its captures as arguments; the quiz's find-in-Go question for Lesson 11.8.
    Cited in: overview, 08-closure-conversion

  • [GO-Phi] Go's phi insertion from forward references — src/cmd/compile/internal/ssagen/phi.go in golang/go at go1.24.7. Symbols: insertPhis, simplePhiState.
    Why and when: Go builds SSA directly with forward-reference placeholders and places phis afterwards; the Go box of Lesson 11.1 §7.
    Cited in: overview, 01-ssa-generation-strategies

  • [GO-Switch] Go's switch lowering (binary search and jump tables) — src/cmd/compile/internal/walk/switch.go in golang/go at go1.24.7. Symbols: binarySearch, tryJumpTable.
    Why and when: Algorithm 11.3.4 and a jump-table heuristic in a compiler without LLVM; read with Lesson 11.3 §7.
    Cited in: 03-switch-lowering

  • [JAVAC-Gen] javac's bytecode generation for assignments — src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java in openjdk/jdk at jdk-21+35. Symbols: visitAssign.
    Why and when: Java's left-to-right evaluation of the target's place before the value, as in Pebble (Lesson 11.4 §7).
    Cited in: 04-places-values-and-loops

  • [JAVAC-Lambda] javac's lifting of lambda bodies into synthetic methods — src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java in openjdk/jdk at jdk-21+35. Symbols: LambdaToMethod.
    Why and when: Lambda lifting with the captures as leading parameters (Algorithm 11.8.4); the javap box of Lesson 11.8.
    Cited in: overview, 08-closure-conversion

  • [LLVM-CodeGenTM] Adding the code-generation passes and the object writer — llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: CodeGenTargetMachineImpl::addPassesToEmitFile, CodeGenTargetMachineImpl::addAsmPrinter.
    Why and when: What pebblec's emitObjectFile calls (Algorithm 11.9.5): codegen passes, then an AsmPrinter on an object streamer. Read after Lesson 11.9 §2.
    Cited in: overview, 09-runtime-and-linking

  • [LLVM-DwarfEH] Lowering resume to _Unwind_Resume before instruction selection — llvm/lib/CodeGen/DwarfEHPrepare.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: DwarfEHPrepare.
    Why and when: The small IR pass between invoke/landingpad and the tables; read with Lesson 11.7 §7.
    Cited in: 07-exception-handling

  • [LLVM-EHStreamer] Emission of the call-site and action tables (LSDA) — llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: EHStreamer::computeCallSiteTable, EHStreamer::emitExceptionTable.
    Why and when: Builds the call-site table the unwinder searches in Algorithm 11.7.2, merging adjacent ranges and adding "no landing pad" gaps; read after Lesson 11.7 §3.
    Cited in: overview, 07-exception-handling

  • [LLVM-LegalizeInt] Type legalization that turns a too-wide division into a libcall — llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: DAGTypeLegalizer::ExpandIntRes_SDIV.
    Why and when: Algorithm 11.9.2's "LibCall" outcome in the code generator: RTLIB::getSDIV then makeLibCall. The quiz's find-in-LLVM question for Lesson 11.9.
    Cited in: 09-runtime-and-linking

  • [LLVM-LoopRotate] Loop rotation (top-tested to guarded do-while) — llvm/lib/Transforms/Utils/LoopRotationUtils.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: LoopRotate::rotateLoop.
    Why and when: Algorithm 11.4.7 in production: duplicate the header into the preheader as a guard and move the test to the latch. The header-size limit lives in LoopRotation.cpp (LoopRotatePass::run).
    Cited in: overview, 04-places-values-and-loops

  • [LLVM-Mem2Reg] LLVM's mem2reg (phi placement by iterated dominance frontiers) — llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: PromoteMem2Reg::run, PromoteMem2Reg::ComputeLiveInBlocks.
    Why and when: Promotes the allocas a front end emits (Lesson 11.1, Algorithm 11.1.6); ComputeLiveInBlocks prunes the phis, the answer to the quiz's find-in-LLVM question.
    Cited in: overview, 01-ssa-generation-strategies

  • [LLVM-Mem2RegPass] The mem2reg pass wrapper (which allocas are collected, the repeat loop) — llvm/lib/Transforms/Utils/Mem2Reg.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: promoteMemoryToRegister, PromotePass::run.
    Why and when: Collects the promotable allocas of the entry block, which is why E5 puts every alloca there; read with Lesson 11.1 §7.
    Cited in: 01-ssa-generation-strategies

  • [LLVM-RuntimeLibcalls] The table of every runtime library call LLVM may emit — llvm/include/llvm/IR/RuntimeLibcalls.td in llvm/llvm-project at llvmorg-23.1.2. Symbols: SDIV_I128, __divti3.
    Why and when: Maps libcalls (Definition 11.9.1) to symbols per target, such as __divti3 for a 128-bit signed division; read with Lesson 11.9 §7.
    Cited in: overview, 09-runtime-and-linking

  • [LLVM-SDB] Where an LLVM switch becomes clusters and a comparison tree — llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: SelectionDAGBuilder::visitSwitch, SelectionDAGBuilder::lowerWorkItem, SelectionDAGBuilder::splitWorkItem.
    Why and when: Sorts the cases, forms clusters and emits the balanced tree of Algorithm 11.3.7; read visitSwitch then splitWorkItem after Lesson 11.3 §2.
    Cited in: overview, 03-switch-lowering

  • [LLVM-SimplifyCFG] SimplifyCFG, LLVM's CFG canonicalizer — llvm/lib/Transforms/Utils/SimplifyCFG.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: foldBranchToCommonDest, simplifySwitchLookup.
    Why and when: foldBranchToCommonDest turns jumping code into boolean values when speculation is safe (Lesson 11.2 §7; the lab's --O2 runs); simplifySwitchLookup turns switches into lookup tables (Lesson 11.3 §6).
    Cited in: overview, 02-short-circuit-lowering, 03-switch-lowering

  • [LLVM-SjLj] setjmp/longjmp exception handling preparation — llvm/lib/CodeGen/SjLjEHPrepare.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: SjLjEHPrepareImpl.
    Why and when: Inserts the function context registration, the call-site index stores and the dispatch of Algorithm 11.7.4; compare its per-call cost with zero-cost tables (Lesson 11.7 §5).
    Cited in: overview, 07-exception-handling

  • [LLVM-SROA] Scalar replacement of aggregates (SROA), which ends by calling PromoteMemToReg — llvm/lib/Transforms/Scalar/SROA.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: SROA::runOnAlloca, SROA::promoteAllocas.
    Why and when: Splits aggregate allocas (Pebble's structs and caller copies) into scalars before promotion; the reason -O1 removes most of E5's memory traffic (Lesson 11.1 §6).
    Cited in: 01-ssa-generation-strategies

  • [LLVM-SwiftError] Keeping a swifterror value in a register across a function — llvm/lib/CodeGen/SwiftErrorValueTracking.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: SwiftErrorValueTracking.
    Why and when: How LLVM supports explicit error returns in a dedicated register (Lesson 11.7, Definition 11.7.5); read after the Swift box.
    Cited in: overview, 07-exception-handling

  • [LLVM-SwitchLowering] LLVM's jump-table and bit-test clustering — llvm/lib/CodeGen/SwitchLoweringUtils.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: SwitchCG::SwitchLowering::findJumpTables, SwitchCG::SwitchLowering::findBitTestClusters, SwitchCG::SwitchLowering::buildJumpTable, SwitchCG::sortAndRangeify.
    Why and when: The Kannan–Proebsting dynamic program with LLVM's score, and the bit-test clusters; the oracle of the switch-lowering drill reproduces it. Read with Lesson 11.3 §2 and §7.
    Cited in: overview, 03-switch-lowering

  • [LLVM-TLB] The target's jump-table density and size thresholds — llvm/lib/CodeGen/TargetLoweringBase.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: TargetLoweringBase::isSuitableForJumpTable.
    Why and when: The density test (at least 10%, 40% when optimizing for size) and minimum table size that decide Lesson 11.3's jump-table clusters; TargetLowering.h holds isSuitableForBitTests.
    Cited in: 03-switch-lowering

  • [LLVM-ValueTracking] LLVM's speculation legality check — llvm/lib/Analysis/ValueTracking.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: isSafeToSpeculativelyExecute.
    Why and when: The production version of Definition 11.2.5 (speculatable expression): which instructions may be executed on a path where the source would not run them. Read with Theorem 11.2.7.
    Cited in: overview, 02-short-circuit-lowering

  • [LLVM-X86ELF] Choosing x86-64 ELF relocation types — llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp in llvm/llvm-project at llvmorg-23.1.2. Symbols: X86ELFObjectWriter::getRelocType.
    Why and when: Where a call becomes R_X86_64_PLT32 and a string address R_X86_64_PC32, as in Lesson 11.9's llvm-objdump box.
    Cited in: 09-runtime-and-linking

  • [OCAML-Closure] OCaml's closure conversion (non-flambda middle end) — middle_end/closure/closure.ml in ocaml/ocaml at 4.14.1. Symbols: close_functions.
    Why and when: Builds flat closures and their environments; the source of Lesson 11.8's Clambda box.
    Cited in: overview, 08-closure-conversion

  • [RUST-Rt] Rust's runtime entry point — library/std/src/rt.rs in rust-lang/rust at 1.94.1. Symbols: lang_start, lang_start_internal.
    Why and when: The runtime side of a generated main: initialize, run main, catch a panic and return 101. Compare with Pebble's pebble_main.c (Lesson 11.9).
    Cited in: overview, 09-runtime-and-linking

  • [RUSTC-AsPlace] rustc's place lowering (with as_operand.rs next to it) — compiler/rustc_mir_build/src/builder/expr/as_place.rs in rust-lang/rust at 1.94.1. Symbols: as_place.
    Why and when: The place/operand split of Definition 11.4.1 in a production MIR builder; read with Lesson 11.4 §7.
    Cited in: overview, 04-places-values-and-loops

  • [RUSTC-Assert] rustc's lowering of MIR Assert to a panic call — compiler/rustc_codegen_ssa/src/mir/block.rs in rust-lang/rust at 1.94.1. Symbols: codegen_assert_terminator.
    Why and when: The unwind policy of Lesson 11.6: a failed check calls a panic function whose call has an unwind edge.
    Cited in: overview, 06-safety-checks

  • [RUSTC-LogicalOp] rustc's MIR building for && and || — compiler/rustc_mir_build/src/builder/expr/into.rs in rust-lang/rust at 1.94.1. Symbols: LogicalOp.
    Why and when: Short-circuit operators become control flow in MIR, as in Algorithm 11.2.2; read with the rustc box of Lesson 11.2.
    Cited in: 01-ssa-generation-strategies, 02-short-circuit-lowering

  • [RUSTC-NonSSA] rustc's choice of which MIR locals get allocas — compiler/rustc_codegen_ssa/src/mir/analyze.rs in rust-lang/rust at 1.94.1. Symbols: non_ssa_locals.
    Why and when: The hybrid of Lesson 11.1 §6: SSA values for locals assigned once and never borrowed, allocas for the rest.
    Cited in: 01-ssa-generation-strategies

  • [RUSTC-Try] rustc's desugaring of the ? operator — compiler/rustc_ast_lowering/src/expr.rs in rust-lang/rust at 1.94.1. Symbols: lower_expr_try.
    Why and when: Error returns as ordinary control flow (Lesson 11.6, Definition 11.7.5): ? becomes a match on the Try trait's result and an early return.
    Cited in: overview, 06-safety-checks, 07-exception-handling

  • [RUSTC-X86ABI] rustc's System V x86-64 classification — compiler/rustc_target/src/callconv/x86_64.rs in rust-lang/rust at 1.94.1. Symbols: classify, classify_arg.
    Why and when: The same psABI classes with a different but equivalent coercion (i64 for a lone int); read with Lesson 11.5's rustc box.
    Cited in: overview, 05-aggregates-and-the-abi

  • [SWIFT-CondFail] Swift's cond_fail lowered to a trap — lib/IRGen/IRGenSIL.cpp in swiftlang/swift at swift-6.1-RELEASE. Symbols: IRGenSILFunction::visitCondFailInst.
    Why and when: The trap policy of Lesson 11.6 in a production language: a failed check branches to a cold block that traps.
    Cited in: overview, 06-safety-checks

Official documentation and specifications

  • [AAPCS64] Procedure Call Standard for the Arm 64-bit Architecture (AArch64). abi-aa 2025Q4. link
    Why and when: AArch64's rules for composite types (HFAs, the 16-byte limit, indirect passing), the macOS side of Lesson 11.5.
    Cited in: overview, 05-aggregates-and-the-abi

  • [ItaniumEH] Itanium C++ ABI: Exception Handling. link
    Why and when: The two-phase unwinding model and personality routines of Algorithm 11.7.2; read §1–2 after Lesson 11.7 §2.
    Cited in: overview, 07-exception-handling

  • [KAL7] My First Language Frontend with LLVM (Kaleidoscope), chapter 7: mutable variables. LLVM 23.1.2. link
    Why and when: The tutorial statement of the allocas + mem2reg strategy E5 uses; read before E5 if you have not seen it.
    Cited in: overview, 01-ssa-generation-strategies

  • [LLVM-EH] Exception Handling in LLVM. LLVM 23.1.2. link
    Why and when: Core reading. invoke, landingpad, resume, personality functions, the LSDA and SjLj; the reference for Lesson 11.7.
    Cited in: overview, 07-exception-handling

  • [LLVM-LangRef] LLVM Language Reference Manual. LLVM 23.1.2. link
    Why and when: Core reading. The switch, invoke, landingpad, select instructions and the sret, byval, noalias, nobuiltin attributes the chapter uses; keep it open while doing E5.
    Cited in: overview, 02-short-circuit-lowering, 05-aggregates-and-the-abi

  • [LLVM-LoopTerm] LLVM Loop Terminology (and Canonical Forms). LLVM 23.1.2. link
    Why and when: Defines rotated loops, preheaders and latches as LLVM uses them; read with Lesson 11.4's Definition 11.4.6.
    Cited in: overview, 04-places-values-and-loops

  • [SWIFT-Error] Swift error handling rationale. swift-6.1-RELEASE. link
    Why and when: Why Swift chose explicit error returns in a register over table-driven unwinding; the design argument behind Lesson 11.7's third technique.
    Cited in: overview, 07-exception-handling

  • [SysV-ABI] System V Application Binary Interface, AMD64 Architecture Processor Supplement. link
    Why and when: Core reading. The parameter-passing algorithm (eightbyte classes INTEGER, SSE, MEMORY and the merge rules) of Algorithm 11.5.4, and the relocation types of Lesson 11.9.
    Cited in: overview, 05-aggregates-and-the-abi