9.8 Interprocedural Data Flow Analysis

The preceding sections have discussed intraprocedural data flow analysis, that is, data flow analysis within a procedure. Interprocedural data flow analysis discusses the same issues, but with intervening function or procedure calls. this is shown below, where we might ask if expression X + Op Y is available. If function f does not modify either x or y, then it will be available.

One method is to assume a worst case: no expressions will be available after a subprogram call, no variables are live, etc.

To perform a more accurate interprocedural data flow analysis, we need to calculate the call chain, that is, what subprograms are called within a subprogram.

Interprocedural analysis often involves finding aliases. A variable X is an alias of a variable Y if X and Y are different names for the same memory location. Reference parameters are an example of aliasing, as are assigning the value of one pointer to another. Thus, changing one of the variables effectively changes the other.

For languages which require explicit declaration of global variables and reference parameters, it may be reasonable to perform an interprocedural analysis. Reference parameters and globals which are changed in the procedure may be identified via Gen and Kill sets.

Changes to any element of an array are usually recorded as having changed the entire array since it may be impossible to tell at compile time which element will be changes.

Send questions and comments to: Karen Lemone