In a sequence of possible instructions:
1: A[i] = B[i]
2: B[i] = A[i] + D[i - 1]
3: C[i] = A[i] - D[i - 1]
4: D[i] = B[i] + C[i]
I want to compute the dependency graph that will end up looking like:
What would be an efficient algorithm for doing so?
My current implementation looks like this:
Run through all of the instructions and generate
last_seenarray.A: 1, B: [2], C: [3], D: [4]
For every instruction iff is assignment:
Split into
leftandrightpartsGenerate new
node(left).for every identifier in
right: make newedge(left, last_seen[right])
