In a computer processor executing a computer compiler, a computer implemented method for performing interprocedural data flow analysis over a program call graph (PCG) that supports recursion, while performing only one flow-sensitive analysis of each routine, comprising the steps of:
- a. constructing the PCG of a computer application program, the PCG having a plurality of PCG nodes and PCG edges, each PCG node representing a procedure P in the computer application program and each PCG edge representing a procedure call site and connecting two nodes, a procedure call site being a statement in a program that invokes a procedure, a source node being a calling PCG node and a target node being a called PCG node and a PCG edge having a direction from the calling node to the called node, and some of the edges possibly being back edges;
- b. identifying any back edges of the PCG;
- c. performing a flow-insensitive interprocedural data flow analysis if there are back edges of the PCG;
- d. for each call site represented by a back edge, initializing a set representing a data flow value to the results of the flow-insensitive interprocedural data flow analysis solution of step c;
- e. for each procedure P in the PCG, performing a forward or reverse topological traversal of the PCG and, for each call site that invokes P, examining the set of data flow values and propagating the result to an entry of P;
- and
- f. performing a flow-sensitive intraprocedural data flow analysis of P without iteration and recording data flow values of the result at each call site within P.