Compilers and LLVM Demystified
summary
Builds a tiny Swift compiler for a language called calc using the Swift LLVM wrapper LLVMSwift and emits LLVM IR then object code. All values are doubles, print simply forwards its string to printf, variables use alloca store load, and the ternary compiles to a branch plus a phi nodes merge. Demonstrates running function-level optimization (instruction combining / constant folding) that removes deterministic checks and shows final codegen and linking with libSystem to produce a runnable binary.
AI-written summary · about
chapters (11)
- 0:00Intro
- 2:43What is LLVM?
- 3:43Example: CALC
- 7:36Calc: AST
- 10:49CALC: IR Code Generation
- 13:39LLVMSwift: pre Hello World
- 14:58LLVM IR: Allocate Memory a = 3
- 16:36LLVM IR: Call Function print("Hello World")
- 18:09LLVM IR: Phi Node
- 20:51Optimizations
- 22:22Target Code Generation








