R – Live Range vs Reaching Definitions


In compiler data flow analysis, what is the difference between a live range of a variable and it's reaching definition? Both seem to refer to the same thing…

Best Solution

They’re very different things, and I suggest that you go back and reread whichever definitions confused you. A reaching definition of a variable for a point which uses the given variable must be, among other things, a definition of that variable. The lifetime of a variable is the portion of the program in which it can be used, which includes things other than definitions, e.g., reading it.

See, for instance, the 1986 Dragon Book, pages 534 (perhaps too general to be helpful) and 610.