Compiler IR Design: Local Decisions and Optimization

2025-06-17
Compiler IR Design: Local Decisions and Optimization

This post explores compiler intermediate representation (IR) design, focusing on making decisions using only local information. The author compares control-flow graphs (CFGs), register-based IRs, and Static Single Assignment (SSA) form, introducing more advanced designs like Static Single Information (SSI) and Sea of Nodes (SoN). SSA simplifies analysis by assigning each variable only once, while SSI allows adding finer-grained information to the same variable across different program branches. SoN represents all instructions as graph nodes, explicitly representing data and control dependencies for more flexible optimization. These designs aim to make compiler optimizers more efficient, ultimately generating more optimized code.