SSA Phi Functions at Control-Flow Joins
Read a phi input on the predecessor edge that selected it and translate parallel phi assignments without overwriting needed values.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Every assignment gets a distinct name
In single static assignment form, a source variable written on two branches can become \(x_1\) and \(x_2\). At their join, \(x_3=\phi(x_1,x_2)\) is determined by the incoming edge, with the operand associated explicitly with its predecessor. A phi is not an ordinary function that evaluates both inputs. Each incoming value must be available on its own edge. For ordinary instructions, a definition is available along paths indicated by dominance.
Phi copies conceptually happen together
One predecessor may require \(a_{\mathrm{new}}\gets b_{\mathrm{old}}\) and \(b_{\mathrm{new}}\gets a_{\mathrm{old}}\). Emitting sequential overwrites without a temporary would lose one old value. Allocate a temporary for a copy cycle. A critical edge can need a fresh block so the copies execute only on that particular transition. Static single assignment theory develops placement using dominance frontiers.[1][2]