Content deleted Content added
m Added IR link |
Merged existing SSA page and put more info |
||
Line 1:
In [[compilers]], '''static single assignment form''', more often abbreviated '''SSA form''' or just '''SSA''', is an [[intermediate representation]] in which every variable is assigned exactly once. Existing variables in the original IR are split into <i>versions</i>, new variables typically indicated by the original name with a subscript, so that every definition gets its own version. In SSA form, [[use-def chains]] are explicit and each contain a single element.
SSA was developed by researchers at [[International Business Machines|IBM]] in the 80's.
=== Benefits of SSA ===
The primary usefulness of SSA comes from how it simultaneously simplifies and improves the results of a variety of optimizations, by simplifying the properties of variables. For example, consider this piece of code:
y := 1<br>
y := 2<br>
x := y<br>
As humans, we can see that the first assignment isn't necessary, and that the value of <code>y</code> being used in the third line comes from the second assignment of <code>y</code>. A program would have to perform [[reaching definition|reaching definition analysis]] to determine this. But if the program is in SSA form, both of these are immediate:
y<sub>1</sub> := 1
y<sub>2</sub> := 2
x<sub>1</sub> := y<sub>1</sub>
Algorithms which are either permitted or strongly enhanced by the use of SSA include:
*[[constant propagation]]
*[[dead code elimination]]
*[[global value numbering]]
*[[partial redundancy elimination]]
*[[register allocation]]
*[[sparse conditional constant propagation]]
=== Converting to SSA ===
<i>More needed here describing need for phi functions, the dominance-frontier based algorithm for computing "minimal" SSA, and other things.</i>
See also: [[Compiler optimization]]
|