Day 12 of 30 · LLVM IR
Connect IR learning to the C++ compiler
- Time
- About 150 minutes: 40 reading, 80 lab, 20 testing, 10 notes.
- Prerequisites
- Day 10: Compile and run a tiny program
Toolchain: LLVM 17 and current main
Today touches both toolchains. Keep separate build directories and explicit executable paths: LLVM 17 for book exercises, build/bin/clang++ from current main for Clang work. Setup guide
Learn
- C++ frontend responsibilities versus target-independent optimization.
Read Reading
- R1 · Learn LLVM 17, Second Edition
Chapter 5: skim aggregate and ABI topics · 25 min - R8 · Introduction to the Clang AST
AST introduction · 15 min
Reading budgets cover selected sections, not whole chapters. Link to the book; this site does not reproduce it.
Build Build or investigate
- Dump the Clang AST for a struct, function call and overloaded function.
- Compare AST and IR for one example.
- Freeze the toy project with a README and known limitations; move your main attention to Clang.
Done when
Checkpoint B: explain source → AST → IR → executable and identify which stage a C++ type error belongs to.
Recall question
Why is writing an LLVM IR optimization pass not the same task as changing C++ overload resolution?
Completion checks
Progress tracking needs JavaScript. The lesson above is complete without it.
Notes
Saved only in this browser. Keep it short enough to finish in ten minutes; none of the prompts are required. All notes, export and import