Data-flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program. The information gathered is often used by compilers when optimizing a program. A canonical example data flow analysis theory and practice pdf a data-flow analysis is reaching definitions.
A simple way to perform data-flow analysis of programs is to set up data-flow equations for each node of the control flow graph and solve them by repeatedly calculating the output from the input locally at each node until the whole system stabilizes, i. This general approach was developed by Gary Kildall while teaching at the Naval Postgraduate School. It is the process of collecting information about the way the variables are used, defined in the program.
Data-flow analysis attempts to obtain particular information at each point in a procedure. Usually, it is enough to obtain this information at the boundaries of basic blocks, since from that it is easy to compute the information at points in the basic block.
In forward flow analysis, the exit state of a block is a function of the block’s entry state. This function is the composition of the effects of the statements in the block.