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:

    For the purpose of knowledge, one must know how to use that inner current that draws us to a thing, and then the one that, after a time, draws us away from it.
    Friedrich Nietzsche (1844–1900)

    During the cattle drives, Texas cowboy music came into national significance. Its practical purpose is well known—it was used primarily to keep the herds quiet at night, for often a ballad sung loudly and continuously enough might prevent a stampede. However, the cowboy also sang because he liked to sing.... In this music of the range and trail is “the grayness of the prairies, the mournful minor note of a Texas norther, and a rhythm that fits the gait of the cowboy’s pony.”
    —Administration in the State of Texa, U.S. public relief program (1935-1943)

    The chief want, in every State that I have been into, was a high and earnest purpose in its inhabitants. This alone draws out “the great resources” of Nature, and at last taxes her beyond her resources; for man naturally dies out of her.
    Henry David Thoreau (1817–1862)