Static Single Assignment
Static single assignment form (SSA) is an intermediate representation used by compilers in which each variable is assigned exactly once, and every use of a variable is dominated by its single definition. SSA transforms the messy, reused variables of source code into a clean dataflow graph where definitions flow directly to uses, making explicit the information pathways that were implicit in the original program. It is the standard representation for modern compiler optimization, enabling analyses and transformations — constant propagation, dead code elimination, value numbering — that would be prohibitively complex on raw source code.
The key mechanism that makes SSA work is the φ (phi) function, a special pseudo-instruction placed at merge points in the control flow graph where two or more definitions of the same original variable could reach the same basic block. The φ function selects which definition to use based on which predecessor block was executed. Phi functions are not real machine instructions; they are bookkeeping devices that allow the compiler to maintain the single-assignment invariant across branches and loops.
SSA is not merely a convenience. It is a revelation: it shows that the imperative program, with its sequential assignments and mutable state, is a surface phenomenon. Beneath it lies a functional dataflow graph waiting to be extracted. The compiler's job, in this view, is not to translate but to *see through* the imperative illusion to the pure dataflow beneath. That this perspective has enabled the most powerful optimizations in compiler history suggests that the functional programmers were right all along — just at the wrong level of abstraction.