Step 02 · ORC overview
ORC = On-Request Compilation. ORCv2 is the current modular JIT framework inside LLVM.
ExecutionSession
├── JITDylibs (≈ shared libraries; symbol namespaces)
│ └── MaterializationUnits (lazy producers of symbols)
└── Layers (stack):
ObjectLinkingLayer (loads .o into memory)
↑
IRCompileLayer (Module → .o via TargetMachine)
↑
IRTransformLayer (optional: run passes per-Module)
↑
CompileOnDemandLayer / SpeculativeJIT (lazy & tiering)
Each layer is a MaterializationUnit that produces symbols on demand.
When lookup("main") runs, ORC chains downward until the right
machine code is in memory.
LLJIT
LLJIT is a turnkey façade that pre-wires those layers with sensible
defaults (one main JITDylib, IR-compile + linking layers, native
target). For a simple compile-and-run scenario you never need to
touch ORC's plumbing directly.