Weighted pushdown systems and their application to interprocedural dataflow analysis

Thomas Reps, Stefan Schwoon, Somesh Jha, David Melski
2005 Science of Computer Programming  
Recently, pushdown systems (PDSs) have been extended to weighted PDSs, in which each transition is labeled with a value, and the goal is to determine the meet-over-all-paths value (for paths that meet a certain criterion). This paper shows how weighted PDSs yield new algorithms for certain classes of interprocedural dataflow-analysis problems. Introduction This paper explores a connection between interprocedural dataflow analysis and model checking of pushdown systems (PDSs). Various
more » ... between dataflow analysis and model checking have been established in past work, e.g., [5, 8, 21, 25, 26] ; however, with one exception ([8]), past work has shed light only on the relationship between model checking and bit-vector dataflow-analysis problems, such as livevariable analysis and partial-redundancy elimination. In contrast, the results presented in this paper apply to (i) bit-vector problems, (ii) the one non-bit-vector problem addressed in [8], as well as (iii) certain dataflowanalysis problems that cannot be expressed as bit-vector problems, such as linear constant propagation. In general, the approach can be applied to any distributive dataflow-analysis problem for which the domain of transfer functions has no infinite descending chains. (Safe solutions are also obtained for problems that are monotonic but not distributive.) The paper makes use of a recent result that extends PDSs to weighted PDSs, in which each transition is labeled with a value, and the goal is to determine the meet-over-all-paths value (for paths that meet a certain criterion) [23] . The paper shows how weighted PDSs yield new algorithms for certain classes of interprocedural dataflow-analysis problems. These ideas are illustrated by the application of weighted PDSs to linear constant propagation. The contributions of the paper can be summarized as follows: ¢ Conventional dataflow-analysis algorithms merge together the values for all states associated with the same program point, regardless of the states' calling context. With the dataflow-analysis algorithm obtained via weighted PDSs, dataflow queries can be posed with respect to a regular language of stack configurations. Conventional merged dataflow information can also be obtained by issuing appropriate queries; thus, the new approach provides a strictly richer framework for interprocedural dataflow analysis than is provided by conventional interprocedural dataflow-analysis algorithms. ¢ Because the algorithm for solving path problems in weighted PDSs can provide a witness set of paths, it is possible to provide an explanation of why the answer to a dataflow query has the value reported. The algorithms described in the paper have been implemented: We have created an extended version of MOPED [22] (a model checker for pushdown systems) that solves reachability problems for weighted PDSs. This system was then used to create a prototype implementation of a context-sensitive interprocedural dataflow-analysis algorithm for linear constant propagation.
doi:10.1016/j.scico.2005.02.009 fatcat:5r7gez6ibbfuhadnbjtigsavy4