Live-variable analysis
In compilers, live variable analysis (or simply liveness analysis) is a classic data-flow analysis to calculate the variables that are live at each point in the program. A variable is live at some point if it holds a value that may be needed in the future, or equivalently if its value may be read before the next time the variable is written to.
In compilers, live variable analysis (or simply liveness analysis) is a classic data-flow analysis to calculate the variables that are live at each point in the program. A variable is live at some point if it holds a value that may be needed in the future, or equivalently if its value may be read before the next time the variable is written to. b = 3 c = 5 a = f(b * c) The set of live variables between lines 2 and 3 is { b , c } because both are used in the multiplication on line 3. But the set of live variables after line 1 is only { b }, since variable c is updated later, on line 2. The value of variable a is not used in this code. Note that the assignment to a may be eliminated as a is not used later, but there is insufficient information to justify removing all of line 3 as f may have side effects (printing b * c , perhaps). {\mbox{LIVE}}_{\mathrm{in}}[s] = {\mbox{GEN}}[s] \cup ({\mbox{LIVE}}_{\mathrm{out}}[s] - {\mbox{KILL}}[s]) {\mbox{LIVE}}_{\mathrm{out}}[\mathit{final}] = {\emptyset} {\mbox{LIVE}}_{\mathrm{out}}[s] = \bigcup_{p \in \mathrm{succ}[s]} {\mbox{LIVE}}_{\mathrm{in}}[p] {\mbox{GEN}}[d : y \leftarrow f(x_1,\cdots,x_n)] = \{x_1,...,x_n\} {\mbox{KILL}}[d : y \leftarrow f(x_1,\cdots,x_n)] = \{y\} The in-state of a block is the set of variables that are live at the start of the block. Its out-state is the set of variables that are live at the end of it. The out-state is the union of the in-states of the block's successors. The transfer function of a statement is applied by making the variables that are written dead, then making the variables that are read live. ==References==
References
No reference rows published for this article.
Cite this article
MLA
"Live-variable analysis." encyclopegia.org, 2026, https://encyclopegia.org/wiki/live-variable-analysis. Accessed 24 November 2026.
Chicago
"Live-variable analysis." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/live-variable-analysis.
APA
encyclopegia.org. (2026). Live-variable analysis. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/live-variable-analysis
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON