References — Chapter 10 · The LLVM C++ API¶
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¶
-
[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: The definition of SSA and its dominance property that Lesson 10.2's RAUW theorem (Theorem 10.2.13) preserves; read §2–3 for the definitions, the construction is Ch 16's topic.
Cited in: 02-values-uses-and-def-use-chains -
[Ers58] Andrei P. Ershov. On Programming of Arithmetic Operations. Communications of the ACM 1(8), pp. 3–6, 1958. doi:10.1145/368892.368907
Why and when: The earliest use of hashing to detect identical expressions and share them, the idea LLVM's context uniquing (Lesson 10.1, Algorithm 10.1.4) applies to types and constants. Short; read it for the history, not for technique.
Cited in: 01-ownership-and-containers -
[LA04] Chris Lattner and Vikram Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. CGO 2004, pp. 75–86, 2004. doi:10.1109/CGO.2004.1281665
Why and when: Core reading. The paper behind the in-memory representation this chapter programs against: a typed SSA IR whose values carry explicit def-use information. Read §2 before Lesson 10.1 and compare its description of the C++ object model with LLVM 23's (opaque pointers, untracked ConstantData, debug records are later additions).
Cited in: 01-ownership-and-containers, 02-values-uses-and-def-use-chains -
[P0088] Axel Naumann. Variant: a type-safe union for C++17 (P0088R3). ISO/IEC JTC1/SC22/WG21 paper P0088R3, 2016. link
Why and when: The proposal that became std::variant and std::visit (Lesson 10.4): the design rationale for the index-plus-storage representation and for compile-time exhaustiveness of visitation.
Note: Also reachable as https://wg21.link/P0088R3. open-std.org was not reachable from the authoring container; the number, title and meeting (2016-06, Oulu) were checked against libc++'s libcxx/docs/Status/Cxx17Papers.csv at llvmorg-23.1.2.
Cited in: 04-casting-and-dispatch -
[P0323] Vicente J. Botet Escribá, JF Bastien, and Jonathan Wakely. std::expected (P0323R12). ISO/IEC JTC1/SC22/WG21 paper P0323R12, 2022. link
Why and when: The C++23 value-or-error type the Pebble code uses (Lesson 10.7). Read the design section on why expected has no "must check" state, and compare with llvm::Expected's checked bit.
Note: Also reachable as https://wg21.link/P0323R12. open-std.org was not reachable from the authoring container; the number, title and meeting (2022-02, virtual) were checked against libc++'s libcxx/docs/Status/Cxx23Papers.csv at llvmorg-23.1.2.
Cited in: 07-error-handling
Textbooks and monographs¶
-
[CLRS4] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, 4th ed.. MIT Press, 2022. Read: Ch. 11 (Hash Tables), §11.4 (open addressing), §16.4 (dynamic tables, amortized analysis).
Why and when: Open addressing under uniform hashing (the 1/(1−α) bound quoted in Lesson 10.6) and the amortized analysis of table doubling behind Theorem 10.6.13 on SmallVector growth.
Cited in: 06-adts -
[Col25] Quentin Colombet. LLVM Code Generation: A deep dive into compiler backend development. Packt, 2025. Read: Ch. 3 (Compiler Basics and How They Map to LLVM APIs), Ch. 4 (Writing Your First Optimization), Ch. 7 (Understanding LLVM IR); code: github.com/PacktPublishing/LLVM-Code-Generation.
Why and when: By the architect of GlobalISel; Ch. 3 walks through the same Value/Use/IRBuilder APIs with a backend developer's eye and Ch. 4 writes a first pass with them. Written against LLVM 20. Useful after Lesson 10.2 and as a bridge to the back-end chapters (Ch 21). -
[GoF94] Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1994. Read: Visitor, pp. 331–344.
Why and when: The classic (virtual, double-dispatch) visitor pattern; Lesson 10.4 contrasts it with LLVM's static CRTP InstVisitor and its delegation chain.
Cited in: 04-casting-and-dispatch -
[Lat11] Chris Lattner. LLVM, in: The Architecture of Open Source Applications, Vol. 1 (A. Brown, G. Wilson, eds.). aosabook.org (lulu.com), 2011. Read: §11.3 (LLVM IR), §11.4 (LLVM's implementation of the three-phase design), §11.5 (modular design). link
Why and when: Lattner's account of why LLVM is a set of libraries with an in-memory IR at their centre; the motivation for everything in this chapter. Read §11.4–11.5 before Lesson 10.1.
Cited in: 01-ownership-and-containers -
[Nac24] Kai Nacke and Amy Kwan. Learn LLVM 17: A beginner's guide to learning LLVM compiler tools and core libraries with C++, 2nd ed.. Packt, 2024. Read: Ch. 4–6 (generating IR with IRBuilder for a small language, tinylang), Ch. 9 (JIT compilation with LLJIT); code: github.com/PacktPublishing/Learn-LLVM-17.
Why and when: A book-length tutorial through the same APIs as this chapter (IRBuilder, the object model, LLJIT) on a complete small compiler. Written against LLVM 17: expect to adapt insertion points (iterators, debug records) and the pass plugin header. Read alongside Labs 10.1 and 10.3. -
[Str94] Bjarne Stroustrup. The Design and Evolution of C++. Addison-Wesley, 1994. Read: §14.2 (Run-Time Type Information), pp. 306–327.
Why and when: Why C++ RTTI and dynamic_cast look the way they do, and the costs Stroustrup accepted; read with Lesson 10.4 to see what LLVM-style RTTI gives up (open hierarchies, multiple inheritance) and gains (speed, no vtable).
Cited in: 04-casting-and-dispatch -
[TAOCP1] Donald E. Knuth. The Art of Computer Programming, Vol. 1: Fundamental Algorithms, 3rd ed.. Addison-Wesley, 1997. Read: §2.2.5 (doubly linked lists), pp. 280–298.
Why and when: Doubly linked lists with a sentinel and O(1) insertion and deletion at a known node, the structure behind LLVM's ilist (Lesson 10.1, Definition 10.1.6 and Lemma 10.1.13).
Cited in: 01-ownership-and-containers -
[TAOCP3] Donald E. Knuth. The Art of Computer Programming, Vol. 3: Sorting and Searching, 2nd ed.. Addison-Wesley, 1998. Read: §6.4 (hashing): Algorithm L (linear probing), Algorithm R (deletion with linear probing), Theorem K (expected probes), pp. 513–558.
Why and when: Core reading. The source of LLVM 23's DenseMap design: linear probing and deletion by backward shifting (Algorithm R), which the DenseMap.h header comment cites. Theorem K gives the probe counts used in Lesson 10.6's Proposition 10.6.16; read after Lesson 10.6 §2.
Cited in: overview, 06-adts
Theses and technical reports¶
- [Lat02] Chris Lattner. LLVM: An Infrastructure for Multi-Stage Optimization. Master's thesis, Department of Computer Science, University of Illinois at Urbana-Champaign, 2002. link
Why and when: The original description of the ownership tree and the def-use representation; optional background for Lesson 10.1 §1.
Cited in: 01-ownership-and-containers
Source code (pinned versions)¶
-
[CL-DFG] Cranelift's data-flow graph (arenas and value aliases) —
cranelift/codegen/src/ir/dfg.rsinbytecodealliance/wasmtimeatv37.0.2. Symbols:DataFlowGraph,DataFlowGraph::change_to_alias,DataFlowGraph::resolve_aliases.
Why and when: Instructions in a PrimaryMap, order in Layout, and value aliases instead of use lists: the contrast case for Lessons 10.1 and 10.2.
Cited in: 01-ownership-and-containers, 02-values-uses-and-def-use-chains -
[CL-Entity] Cranelift's entity arenas —
cranelift/entity/src/lib.rsinbytecodealliance/wasmtimeatv37.0.2. Symbols:PrimaryMap,SecondaryMap,EntityList,EntityRef.
Why and when: The index-based alternative to LLVM's ownership tree (Lesson 10.1, Definition 10.1.9); the module comment explains the design in a page.
Cited in: 01-ownership-and-containers -
[CLANG-CGBuilder] Clang's IRBuilder (TargetFolder + a custom inserter) —
clang/lib/CodeGen/CGBuilder.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:CGBuilderInserter,CGBuilderBaseTy,CGBuilderTy.
Why and when: A production builder configuration (Lesson 10.3 real-world box); CGBuilderInserter::InsertHelper is defined in clang/lib/CodeGen/CodeGenFunction.cpp.
Cited in: 03-building-ir-with-irbuilder -
[LLVM-APInt] Arbitrary-precision integers (and APFloat.h next to it) —
llvm/include/llvm/ADT/APInt.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:APInt::uadd_ov,APInt::sdiv,APInt::udiv,APInt::ashr,APInt::getLowBitsSet.
Why and when: Definition 10.6.12 in code; Lab 10.2 uses getLowBitsSet for the urem mask.
Cited in: 06-adts -
[LLVM-Casting] LLVM-style RTTI templates —
llvm/include/llvm/Support/Casting.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:isa,cast,dyn_cast,isa_and_present,dyn_cast_if_present,cast_if_present,CastInfo.
Why and when: Core reading. Algorithm 10.4.3 and the CastInfo customization point; the file's long comments explain the simplify_type and CastInfo layers.
Cited in: overview, 04-casting-and-dispatch -
[LLVM-CtxImpl] The context's uniquing tables —
llvm/lib/IR/LLVMContextImpl.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:LLVMContextImpl,IntegerTypes,IntConstants,StructConstants,AnonStructTypes.
Why and when: Where every uniqued type and constant lives (Lesson 10.1, Algorithm 10.1.4); pair with ConstantInt::get in llvm/lib/IR/Constants.cpp.
Cited in: 01-ownership-and-containers -
[LLVM-DenseMap] DenseMap in LLVM 23 (linear probing, used bits, Algorithm R) —
llvm/include/llvm/ADT/DenseMap.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:DenseMapBase::LookupBucketFor,DenseMapBase::eraseFromFilledBucket,DenseMapBase::remove_if,DenseMapBase::findBucketForInsertion.
Why and when: Core reading. Algorithm 10.6.5 as shipped; the file comment names Knuth's Algorithm R. The hash functions are in DenseMapInfo.h (densemap::detail::mix). Read after Lesson 10.6 §2.
Cited in: overview, 06-adts -
[LLVM-DenseMap22] DenseMap before LLVM 23 (quadratic probing, tombstones) —
llvm/include/llvm/ADT/DenseMap.hinllvm/llvm-projectatllvmorg-22.1.0. Symbols:DenseMapBase::LookupBucketFor,DenseMapBase::findBucketForInsertion,getTombstoneKey.
Why and when: The design most existing documentation and books describe; compare ProbeAmt and the tombstone rehash rule with LLVM 23 (Lesson 10.6 §3's second trace).
Cited in: 06-adts -
[LLVM-Error] Error and Expected —
llvm/include/llvm/Support/Error.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Error,Expected,ErrorInfo,handleErrors,handleAllErrors,cantFail,ExitOnError,Error::assertIsChecked.
Why and when: Definition 10.7.2's state table is read directly from the constructors, operator bool and assertIsChecked; do the must-check drill with this file open.
Cited in: 07-error-handling -
[LLVM-Folders] The IRBuilder folders —
llvm/include/llvm/IR/ConstantFolder.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:ConstantFolder::FoldBinOp,NoFolder,InstSimplifyFolder,TargetFolder.
Why and when: ConstantFolder here; NoFolder in llvm/include/llvm/IR/NoFolder.h; InstSimplifyFolder and TargetFolder in llvm/include/llvm/Analysis/. Definition 10.3.2's domains read off directly.
Cited in: 03-building-ir-with-irbuilder -
[LLVM-Function] Function destruction and dropAllReferences —
llvm/lib/IR/Function.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Function::~Function,Function::deleteBodyImpl.
Why and when: "After this it is safe to delete instructions": why use edges are cut before the ownership tree is deleted (Theorem 10.1.12).
Cited in: 01-ownership-and-containers -
[LLVM-ilist] Intrusive lists (and simple_ilist.h, ilist_node.h) —
llvm/include/llvm/ADT/ilist.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:iplist_impl::erase,iplist_impl::remove,simple_ilist::size.
Why and when: The container of instructions, blocks and functions; note the file comment on the linear size() and read simple_ilist.h and ilist_node.h next to it (Lesson 10.1).
Cited in: 01-ownership-and-containers -
[LLVM-Instr] Instruction insertion and the debug-record head bit —
llvm/lib/IR/Instruction.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Instruction::insertBefore,Instruction::insertInto,InsertPosition.
Why and when: The head-bit logic and the "Inserting PHI after debug-records!" assertion of Lesson 10.3; InsertPosition is declared (and its Instruction* constructor deprecated) in Instruction.h.
Cited in: 03-building-ir-with-irbuilder -
[LLVM-InstVisitor] The CRTP instruction visitor —
llvm/include/llvm/IR/InstVisitor.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:InstVisitor::visit,DELEGATE,InstVisitor::delegateCallInst.
Why and when: Definition 10.4.8's delegation chains, generated from Instruction.def; the answer to the visitMemCpyInst quiz question is in delegateCallInst.
Cited in: 04-casting-and-dispatch -
[LLVM-Interp] LLVM's IR interpreter (lli -force-interpreter) —
llvm/lib/ExecutionEngine/Interpreter/Execution.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Interpreter::run,Interpreter::visitBinaryOperator.
Why and when: Algorithm 10.8.2 in full; also an example of an InstVisitor (Lesson 10.4). Find where intrinsics are lowered and why unsupported ones abort.
Cited in: 04-casting-and-dispatch, 08-running-ir-and-linking-llvm -
[LLVM-IRB] IRBuilder (folders, inserters, state) —
llvm/include/llvm/IR/IRBuilder.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:IRBuilderBase::Insert,IRBuilderBase::SetInsertPoint,IRBuilderDefaultInserter,IRBuilderCallbackInserter,IRBuilderBase::FastMathFlagGuard,IRBuilderBase::InsertPointGuard.
Why and when: Core reading. Algorithm 10.3.3 is CreateAdd → Folder.FoldNoWrapBinOp → Insert; read the class after Lesson 10.3 §2 and keep it open during Lab 10.1.
Cited in: overview, 03-building-ir-with-irbuilder -
[LLVM-LLJIT] LLJIT and LLLazyJIT —
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:LLJIT,LLJIT::lookup,LLJIT::getIRTransformLayer,LLLazyJIT::addLazyIRModule,LLJITBuilder.
Why and when: The API Lab 10.1's tests and Lab 10.3 use; LLJIT.cpp (prepareForConstruction) shows the default layer stack of Algorithm 10.8.5.
Cited in: 08-running-ir-and-linking-llvm -
[LLVM-Metadata] Metadata as value and value as metadata —
llvm/lib/IR/Metadata.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:MetadataAsValue::get,ValueAsMetadata::handleRAUW,ValueAsMetadata::handleDeletion.
Why and when: How metadata follows RAUW without use lists (Lesson 10.2 §4); the declarations are in llvm/include/llvm/IR/Metadata.h.
Cited in: 01-ownership-and-containers, 02-values-uses-and-def-use-chains -
[LLVM-Module] Module destruction (drop references, then clear the lists) —
llvm/lib/IR/Module.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Module::~Module,Module::dropAllReferences.
Why and when: Algorithm 10.1.5 in five lines; read with Function::~Function.
Cited in: 01-ownership-and-containers -
[LLVM-PatternMatch] The PatternMatch combinator library —
llvm/include/llvm/IR/PatternMatch.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:match,BinaryOp_match,bind_ty,deferredval_ty,specificval_ty,m_Not,m_Neg,m_SMax.
Why and when: Core reading. Algorithm 10.5.3 is BinaryOp_match::match; note that m_SMax matches only the intrinsic in LLVM 23 (Lesson 10.5 real-world box).
Cited in: 05-pattern-matching -
[LLVM-Reassociate] A pass built on hand-written matching —
llvm/lib/Transforms/Scalar/Reassociate.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:isReassociableOp,LinearizeExprTree.
Why and when: Tree manipulation with dyn_cast and opcode tests (Lesson 10.5 §7); contrast with InstCombineAddSub.cpp's PatternMatch style.
Cited in: 05-pattern-matching -
[LLVM-SmallVector] SmallVector growth policy —
llvm/lib/Support/SmallVector.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:getNewCapacity,SmallVectorBase::grow_pod,SmallVectorBase::mallocForGrow.
Why and when: The 2 * OldCapacity + 1 rule of Definition 10.6.1; the template itself is in llvm/include/llvm/ADT/SmallVector.h.
Cited in: 06-adts -
[LLVM-STLExtras] make_early_inc_range and friends —
llvm/include/llvm/ADT/STLExtras.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:early_inc_iterator_impl,make_early_inc_range,enumerate,zip_equal.
Why and when: Theorem 10.1.14's early increment is operator* doing (I)++; the comment states the exact contract ("the current iterator can be invalidated", the next one must not be).
Cited in:* 01-ownership-and-containers -
[llvm-tutor] llvm-tutor — out-of-tree LLVM passes and tools with the new pass manager —
README.mdinbanach-space/llvm-tutoratmain.
Why and when: A collection of small, well-commented out-of-tree passes (OpcodeCounter, MBASub, RIV …) that use exactly this chapter's APIs (InstVisitor-style iteration, IRBuilder, PatternMatch-free rewrites) with a CMake setup like Lesson 10.8's. Browse after Lab 10.2; its README on the main branch states LLVM 23 as the supported version. -
[LLVM-Twine] Twine (lazy concatenation) —
llvm/include/llvm/ADT/Twine.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Twine,Twine::concat,Twine::str,Twine::toStringRef.
Why and when: Read the class comment ("A Twine is not intended for use directly and should not be stored") and concat, which decides between storing a leaf and a pointer (Theorem 10.6.18).
Cited in: 06-adts -
[LLVM-Use] The Use class and its intrusive use list —
llvm/include/llvm/IR/Use.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Use::addToList,Use::removeFromList,Use::Prev.
Why and when: Algorithm 10.2.3 verbatim; the Use ** Prev trick is worth reading slowly.
Cited in: 02-values-uses-and-def-use-chains -
[LLVM-User] Co-allocated and hung-off operand storage —
llvm/include/llvm/IR/User.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:User::operator new,IntrusiveOperandsAllocMarker,HungOffOperandsAllocMarker,User::getOperandList.
Why and when: Definition 10.2.5 in code; read with llvm/lib/IR/User.cpp (growHungoffUses).
Cited in: 02-values-uses-and-def-use-chains -
[LLVM-Value] RAUW and value-handle notification —
llvm/lib/IR/Value.cppinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Value::doRAUW,Value::replaceUsesWithIf,ValueHandleBase::ValueIsDeleted,ValueHandleBase::ValueIsRAUWd.
Why and when: Algorithm 10.2.6 (the loop taking the head of the use list) and Algorithm 10.2.8.
Cited in: 02-values-uses-and-def-use-chains -
[LLVM-ValueH] Value, its use list head, and Use::set —
llvm/include/llvm/IR/Value.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:Value::addUse,Value::hasUseList,Value::uses,Value::users,Use::set.
Why and when: Where ConstantData is excluded from use lists (hasUseList) and where Use::set is defined; the answer to Lesson 10.2's "Find where LLVM does it" task.
Cited in: 02-values-uses-and-def-use-chains -
[LLVM-VH] Value handle kinds —
llvm/include/llvm/IR/ValueHandle.hinllvm/llvm-projectatllvmorg-23.1.2. Symbols:WeakVH,WeakTrackingVH,AssertingVH,TrackingVH,CallbackVH,PoisoningVH.
Why and when: The table of Definition 10.2.7; note how AssertingVH compiles to a plain pointer without ABI-breaking checks.
Cited in: 02-values-uses-and-def-use-chains
Official documentation and specifications¶
-
[BAJIT] Building a JIT: Starting out with KaleidoscopeJIT (tutorial chapters 1–3). LLVM 23.1.2. link
Why and when: Builds an ORC JIT layer by layer (compile layer, optimize layer, lazy compile-on-demand); the hands-on companion to Algorithm 10.8.5 and 10.8.6. Chapters 2–3 are the neighbouring files BuildingAJIT2.rst and BuildingAJIT3.rst.
Cited in: 08-running-ir-and-linking-llvm -
[GCC-matchpd] GCC Internals: Match and Simplify (the match.pd language), with gcc/match.pd. GCC 15.2.0. link
Why and when: GCC's pattern DSL compiled by genmatch into GENERIC and GIMPLE folders; compare its (simplify …) forms with PatternMatch and GlobalISel rules after Lesson 10.5. The rules themselves are in gcc/match.pd at the same tag.
Cited in: 05-pattern-matching -
[IEEE754] IEEE Standard for Floating-Point Arithmetic (IEEE Std 754-2019). 754-2019. link
Why and when: The formats and correctly rounded operations APFloat implements in software (Lesson 10.6); §4 (rounding) and §7 (exceptions/status flags) map onto APFloat's roundingMode and opStatus.
Cited in: 06-adts -
[ISLE] ISLE language reference (Cranelift's instruction-selection and rewrite DSL). Wasmtime v37.0.2. link
Why and when: A term-rewriting DSL with overlapping rules and explicit priorities; the third point in Lesson 10.5's comparison of rule DSLs.
Cited in: 05-pattern-matching -
[ItaniumABI] Itanium C++ ABI (§2.9 Run-Time Type Information). link
Why and when: The type_info layout and the __dynamic_cast interface and algorithm (§2.9.5–2.9.7) behind Lesson 10.4's C++ RTTI; the rationale paragraph explains why only direct bases are stored.
Cited in: 04-casting-and-dispatch -
[ItaniumEH] Itanium C++ ABI: Exception Handling. link
Why and when: The two-phase unwinding model (search, then cleanup) and __cxa_throw that Lesson 10.7's Algorithm 10.7.5 outlines.
Cited in: 07-error-handling -
[KAL] My First Language Frontend with LLVM (Kaleidoscope), chapters 3–4: code generation to LLVM IR, JIT and optimizer support. LLVM 23.1.2. link
Why and when: The canonical first use of IRBuilder, a module and a context; chapter 4 (LangImpl04.rst) adds a JIT. Work through them before Lab 10.1 if IRBuilder is new to you.
Cited in: 03-building-ir-with-irbuilder -
[LLVM-CMake] Building LLVM with CMake — Embedding LLVM in your project. LLVM 23.1.2. link
Why and when: find_package(LLVM CONFIG), llvm_map_components_to_libnames and the variables LLVMConfig.cmake exports (Lesson 10.8 §2); the section this chapter's examples/CMakeLists.txt follows.
Cited in: 08-running-ir-and-linking-llvm -
[LLVM-CS] LLVM Coding Standards. LLVM 23.1.2. link
Why and when: "Do not use RTTI or Exceptions", "Use of auto", naming and early exits; the rules LLVM-facing code in this course follows. Read the RTTI/exceptions section with Lessons 10.4 and 10.7.
Cited in: 04-casting-and-dispatch, 07-error-handling, 08-running-ir-and-linking-llvm -
[LLVM-DbgRecords] Debug info migration: From intrinsics to records (RemoveDIsDebugInfo). LLVM 23.1.2. link
Why and when: Why insertion must use iterators with a head bit (Lesson 10.3, Definition 10.3.1) and why Instruction* insertion positions are deprecated; the "API changes" section is the one to read.
Cited in: 01-ownership-and-containers, 02-values-uses-and-def-use-chains, 03-building-ir-with-irbuilder -
[LLVM-EH] Exception Handling in LLVM. LLVM 23.1.2. link
Why and when: invoke, landingpad, personality functions and the Itanium tables that Lesson 10.7's real-world box shows in IR; read "Itanium ABI Zero-cost Exception Handling".
Cited in: 07-error-handling -
[LLVM-ICGuide] InstCombine contributor guide. LLVM 23.1.2. link
Why and when: How PatternMatch-based peepholes are written and tested in LLVM, canonical forms, and why one canonical form per pattern avoids infinite combine loops (Lesson 10.5 §4).
Cited in: 05-pattern-matching -
[LLVM-MCJIT] MCJIT Design and Implementation. LLVM 23.1.2. link
Why and when: How MCJIT compiles whole modules to in-memory objects and links them with RuntimeDyld (Algorithm 10.8.3); read to understand what ORC replaced.
Cited in: 08-running-ir-and-linking-llvm -
[LLVM-MIRPatterns] MIR Patterns in TableGen (GlobalISel combiner rules). LLVM 23.1.2. link
Why and when: The declarative rule language of the GlobalISel combiner (GICombineRule, PatFrags, GIReplaceReg) shown in Lesson 10.5's real-world box.
Cited in: 05-pattern-matching -
[LLVM-ORC] ORC Design and Implementation (ORCv2). LLVM 23.1.2. link
Why and when: The reference for LLJIT, LLLazyJIT, JITDylibs, link order, materialization units and the MCJIT→ORC migration notes. Read after Lesson 10.8 §2 and before Lab 10.3's engines.
Cited in: overview, 01-ownership-and-containers, 08-running-ir-and-linking-llvm -
[LLVM-PM] LLVM Programmer's Manual. LLVM 23.1.2. link
Why and when: Core reading. The chapter's primary reference. Sections by lesson: "The isa<>, cast<> and dyn_cast<> templates" (10.4); "Passing strings (StringRef and Twine)", "Picking the Right Data Structure" (10.6); "Error handling" (10.7); "Iterating over def-use & use-def chains", "Replacing an Instruction with another Value", "The User and owned Use classes' memory layout" (10.1–10.2).
Cited in: overview, 01-ownership-and-containers, 02-values-uses-and-def-use-chains, 04-casting-and-dispatch, 06-adts, 07-error-handling -
[LLVM-RTTI] How to set up LLVM-style RTTI for your class hierarchy. LLVM 23.1.2. link
Why and when: The step-by-step recipe for a kind enum plus classof, including "Concrete Bases and Deeper Hierarchies" (the preorder ranges of Theorem 10.4.10) and "Advanced Use Cases" (CastInfo). Do it for the Pebble AST after Lesson 10.4.
Cited in: 04-casting-and-dispatch
Talks and videos¶
-
[Car14] Chandler Carruth. Efficiency with Algorithms, Performance with Data Structures. CppCon 2014, 2014. link
Why and when: The argument, from an LLVM developer, that cache misses from node-based containers dominate, and why LLVM uses flat vectors, open addressing and small-size optimization. Watch before Lesson 10.6 (slides in the linked CppCon repository; the video is on YouTube).
Cited in: 06-adts -
[Ham16] Lang Hames. ORC -- LLVM's Next Generation of JIT API. 2016 LLVM Developers' Meeting, 2016. link
Why and when: The introduction of ORC by its author: layers, lazy compilation and why MCJIT was replaced. Watch after Lesson 10.8 §2; some API names predate ORCv2.
Cited in: 08-running-ir-and-linking-llvm -
[Ham18] Lang Hames and Breckin Loggins. Updating ORC JIT for Concurrency. 2018 LLVM Developers' Meeting (tutorial), 2018. link
Why and when: The ORCv2 redesign behind LLJIT: ExecutionSession, JITDylibs, symbol states and ThreadSafeModule (Lesson 10.8, Proposition 10.8.9). Watch before reading ORCv2.rst.
Cited in: 08-running-ir-and-linking-llvm