PrevPrev UpUp NextNext


Control and Data Dependencies

When you analyze a program, you'll often ask yourself the questions:

  1. What influences the value of this variable here?
  2. What depends on the value of this variable?
There are two important dependencies between expressions in your program that are relevant to these questions:
data dependency:
there is a def-use influence from expression A to expression B if A defines a value used in B
control dependency:
there is a control influence from predicate A to expression B if A decides whether B is executed or not
Example:
  1:   a = 1;
  2:   if (a > 0) 
  3:     b = 1;
  4:   c = a;

The assignment in line 1 has a def-use influence on the value of c in line 4 and to a in line 2. The predicate in line 2 has a control influence on the statement in line 3.

Bauhaus computes all these influences for you and then allows you traverse these influences. This traversal is also known as program slicing.

backward slice:
follows backward all def-use and control influences; it gives you the answer to question 1
forward slice:
follows forward all def-use and control influences; it gives you the answer to question 2
Example:

The backward slice for the above example with respect to line 4 is:

  1:   a = 1;
  2:   
  3:   
  4:   c = a;

The forward slice for the above example with respect to line 1 is the complete program fragment.

Last modified: Wed Aug 27 11:14:17 MET DST 2003