Reaching Definitions as Forward Dataflow

Identify which assignments can supply a later read and use the difference between generating and killing definitions at each statement.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Assignments introduce a new origin for a variable
  2. A may-analysis can report extra origins

Assignments introduce a new origin for a variable

A definition reaches a point if some path carries its assignment there without another definition of the same variable intervening. At a statement \(x:=y+1\), generate this definition of \(x\) and kill earlier definitions of \(x\) from the outgoing set. The assignment’s right-hand side can read old definitions before the kill. At a merge, union the reaching sets because any feasible incoming path can supply the value.

A may-analysis can report extra origins

If mutually exclusive branch conditions are ignored, a syntactic graph path may not correspond to an actual execution. The computed set can contain definitions whose routes are infeasible. That is a conservative answer for identifying possible origins. Path sensitivity can rule out selected routes. Phi functions make the choice of definition explicit at an SSA merge, replacing many repeated searches for which origins reach a use.[1][2]

References

  1. Andrew C. Myers, Cornell CS 4120: Compiler Course Notes ↩
  2. LLVM Project, LLVM Language Reference Manual ↩