Skip to content

Commit 9e346c9

Browse files
camelidJoshua Nelson
authored andcommitted
Add a section on data-flow convergence
1 parent f36f645 commit 9e346c9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/mir/dataflow.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,21 @@ statement must be considered separately from the left-hand side.
8989

9090
### Convergence
9191

92-
TODO
92+
Your analysis must converge to "fixpoint", otherwise it will run forever.
93+
Converging to fixpoint is just another way of saying "reaching equilibrium".
94+
In order to reach equilibrium, your analysis must obey some laws. One of the
95+
laws it must obey is that the bottom value joined with some other value equals
96+
the second value. Or, as an equation:
97+
98+
> *bottom* join *x* = *x*
99+
100+
Another law is that your analysis must have a "top value" such that
101+
102+
> *top* join *x* = *top*
103+
104+
Having a top value ensures that your semilattice has a finite height, and the
105+
law state above ensures that once the dataflow state reaches top, it will no
106+
longer change (the fixpoint will be top).
93107

94108
## Inspecting the Results of a Dataflow Analysis
95109

0 commit comments

Comments
 (0)