Module 16: Data Flow Analysis in Presence of Procedure Calls
  Lecture 31: Data Dependence Analysis
 


Data Flow Analysis in Presence of Procedure Calls

Change[p ] set of global variables and formal parameters of p that might be changed during an execution of p.
Def[p ] set of formal parameters and global variables having explicit definition within p.
A: { a | a is a global variable or formal of p, such that for some procedure q and integer i, p calls q with a as the ith actual parameter and ith formal of q is in change[q] }
G: { g | g is a global in change[q] and p calls q }

Data Dependence Analysis

  • Used for instruction scheduling
  • Used for data cache optimization
  • Determines ordering relationship; a dependence between two statements constraints their execution order
  • Control dependence: arises from control flow
S1: a = b+c
S2: if a > 10 goto L1
S3: d = b*e
S4: e = d+1
S5: L1: d = e/2

Data Dependence

  • Arises from flow of data between two statements
  • Compiler must analyze programs to find constraints preventing the reordering of operations.
Consider:
A = 0
B = A
C = A + D
D = 2

(1)
(2)
(3)
(4)

  • Moving (2) above (1):: Value of A in (2) changes
  • Moving (4) above (3):: results in wrong value of D in (3)