Data flow analysis

As -flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program. A program's control flow graph (cfg) is used to determine those parts of a program to which a particular value assigned to a variable might propagate. 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. In forward flow analysis, the exit state of a block is a function of the block's entry state. The transfer function of each statement separately can be applied to get information at a point inside a basic particular type of data-flow analysis has its own specific transfer function and join operation. This follows the same plan, except that the transfer function is applied to the exit state yielding the entry state, and the join operation works on the entry states of the successors to yield the exit entry point (in forward flow) plays an important role: since it has no predecessors, its entry state is well defined at the start of the analysis.

If the control flow graph does not contain cycles (there were no explicit or implicit loops in the procedure) solving the equations is straightforward. The control flow graph can then be topologically sorted; running in the order of this sort, the entry states can be computed at the start of each block, since all predecessors of that block have already been processed, so their exit states are available. If the control flow graph does contain cycles, a more advanced algorithm is iterative algorithm[edit]. Basic algorithm for solving data-flow equations is the round-robin iterative algorithm:While (sets are still changing). Efficiency of iteratively solving data-flow equations is influenced by the order at which local nodes are visited. 2] furthermore, it depends on whether the data-flow equations are used for forward or backward data-flow analysis over the cfg.

Intuitively, in a forward flow problem, it would be fastest if all predecessors of a block have been processed before the block itself, since then the iteration will use the latest information. In the absence of loops it is possible to order the blocks in such a way that the correct out-states are computed by processing each block only the following, a few iteration orders for solving data-flow equations are discussed (a related concept to iteration order of a cfg is tree traversal of a tree). Order - this iteration order is not aware whether the data-flow equations solve a forward or backward data-flow problem. Therefore, the performance is relatively poor compared to specialized iteration der - this is a typical iteration order for backward data-flow problems. Typically, the postorder iteration is implemented with the depth-first e postorder - this is a typical iteration order for forward data-flow problems. If the minimum element represents totally conservative information, the results can be used safely even during the data-flow iteration.

If it represents the most accurate information, fixpoint should be reached before the results can be following are examples of properties of computer programs that can be calculated by data-flow analysis. Note that the properties calculated by data-flow analysis are typically only approximations of the real properties. This is because data-flow analysis operates on the syntactical structure of the cfg without simulating the exact control flow of the program. However, to be still useful in practice, a data-flow analysis algorithm is typically designed to calculate an upper respectively lower approximation of the real program d analysis[edit]. Reaching definition analysis calculates for each program point the set of definitions that may potentially reach this program reaching definition of variable a at line 7 is the set of assignments a = 5 at line 2 and a = 3 at line rd analysis[edit]. Live variable analysis calculates for each program point the variables that may be potentially read afterwards before their next write update.

The definition of c in b2 can be removed, since c is not live immediately after the g the data-flow equations starts with initializing all in-states and out-states to the empty set. The work list is initialized by inserting the exit point (b3) in the work list (typical for backward flow). 2002, markus mohnen described a new method of data-flow analysis that does not require the explicit construction of a data-flow graph,[3] instead relying on abstract interpretation of the program and keeping a working set of program counters. Combination of control flow analysis and data flow analysis has shown to be useful and complementary in identifying cohesive source code regions implementing functionalities of a system (e. The transfer function for each block can be decomposed in so-called gen and kill an example, in live-variable analysis, the join operation is union. Data-flow analysis is typically path-insensitive, though it is possible to define data-flow equations that yield a path-sensitive analysis.

For example, a flow-insensitive pointer alias analysis may determine "variables x and y may refer to the same location", while a flow-sensitive analysis may determine "after statement 20, variables x and y may refer to the same location". Path-sensitive analysis computes different pieces of analysis information dependent on the predicates at conditional branch instructions. For instance, if a branch contains a condition x>0, then on the fall-through path, the analysis would assume that x<=0 and on the target of the branch it would assume that indeed x>0 holds. Context-sensitive analysis is an interprocedural analysis that considers the calling context when analyzing the target of a function call. In particular, using context information one can jump back to the original call site, whereas without that information, the analysis information has to be propagated back to all possible call sites, potentially losing of data-flow analyses[edit]. Springer science+business er le -invariant code nest tic subexpression ion variable recognition and store variable value conditional constant ction ction call rocedural -checking code access l flow re testing ries: compiler optimizationsdata-flow logged intalkcontributionscreate accountlog pagecontentsfeatured contentcurrent eventsrandom articledonate to wikipediawikipedia out wikipediacommunity portalrecent changescontact links hererelated changesupload filespecial pagespermanent linkpage informationwikidata itemcite this a bookdownload as pdfprintable h한국어日本語norskslovenčina中文.

A non-profit d: 04/26/2017 by computer -flow analysis is a technique used to assemble information about possible sets of values computed in a program. The data gained from this process are often used in program -flow analysis generally utilizes a control flow graph, a graphical representation, resembling a flow chart, of all paths that may be traversed through a program during execution to locate specific thm, data flow, programming this page useful? Yes d: 04/26/2017 by computer -flow analysis is a technique used to assemble information about possible sets of values computed in a program.