QBE – Compiler Back End
QBE is a small C compiler backend targeting 70% of industrial optimizer performance in roughly 10% of the code, designed to stay hackable and foster new language implementations.
What Matters
- Explicit design constraint: codebase stays hobby-scale to prevent diminishing-returns optimization spirals.
- Targets amd64 (Linux/macOS), arm64, and riscv64 out of the box.
- Full C ABI support means QBE-compiled code calls into C and vice versa with no glue layer.
- SSA-based IL is used uniformly across all compilation stages, enabling a simpler split spiller/register allocator instead of graph coloring.
- Optimizations included: sparse conditional constant propagation, dead instruction elimination, copy elimination, loop-analysis spill heuristics, linear register allocator with hinting.
- Compile time benchmark: 2 seconds on a Core 2 Duo at -O2.
-
IEEE 754 32- and 64-bit float support included; entry point is
qbe -o out.s file.ssa && cc out.s.