Data Dependences
An instruction is data dependent on instruction
if
there is a path from
to
and
Where:
: set of read data by instruction
: set of written data by instruction
Classification of data dependences #
1: add R1,R2,R3 ;; R1 = R2 + R3
2: sub R4,R5,R6
3: add R6,R1,R8
4: xor R4,R1,R11
True dependences (write … read) #
- In example from instruction 1 to instruction 3.
- 1 writes to
R1while 3 reads fromR1
Anti dependences (read … write) #
-
In example from 2 to 3
-
2 reads from
R6while 3 writes toR6 -
Name depencency (can be avoided by using different registers)
Output dependences (write … write) #
-
In example from 2 to 4
-
2 and 4 both write to
R4 -
Name depencency (can be avoided by using different registers)