Use-define Chain - Purpose

Purpose

Making the use-define or define-use chains is a step in liveness analysis, so that logical representations of all the variables can be identified and tracked through the code.

Consider the following snippet of code:

int x = 0; /* A */ x = x + y; /* B */ /* 1, some uses of x */ x = 35; /* C */ /* 2, some more uses of x */

Notice that x is assigned a value at three points (marked A, B, and C). However, at the point marked "1", the use-def chain for x should indicate that its current value must have come from line B (and its value at line B must have come from line A). Contrariwise, at the point marked "2", the use-def chain for x indicates that its current value must have come from line C. Since the value of the x in block 2 does not depend on any definitions in block 1 or earlier, x might as well be a different variable there; practically speaking, it is a different variable — call it x2.

int x = 0; /* A */ x = x + y; /* B */ /* 1, some uses of x */ int x2 = 35; /* C */ /* 2, some uses of x2 */

The process of splitting x into two separate variables is called live range splitting. See also static single assignment form.

Read more about this topic:  Use-define Chain

Famous quotes containing the word purpose:

    Civilization is a process in the service of Eros, whose purpose is to combine single human individuals, and after that families, then races, peoples and nations, into one great unity, the unity of mankind. Why this has to happen, we do not know; the work of Eros is precisely this.
    Sigmund Freud (1856–1939)

    To me the sole hope of human salvation lies in teaching Man to regard himself as an experiment in the realization of God, to regard his hands as God’s hand, his brain as God’s brain, his purpose as God’s purpose. He must regard God as a helpless Longing, which longed him into existence by its desperate need for an executive organ.
    George Bernard Shaw (1856–1950)

    ... the word “education” has an evil sound in politics; there is a pretense of education,
    when the real purpose is coercion without the use of force.
    Hannah Arendt (1906–1975)