Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Use-define chain
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==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: <syntaxhighlight lang="c"> int x = 0; /* A */ x = x + y; /* B */ /* 1, some uses of x */ x = 35; /* C */ /* 2, some more uses of x */ </syntaxhighlight> Notice that <code>x</code> is assigned a value at three points (marked A, B, and C). However, at the point marked "1", the use-def chain for <code>x</code> 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 <code>x</code> indicates that its current value must have come from line C. Since the value of the <code>x</code> in block 2 does not depend on any definitions in block 1 or earlier, <code>x</code> might as well be a different variable there; practically speaking, it ''is'' a different variable — call it <code>x2</code>. <syntaxhighlight lang="c"> int x = 0; /* A */ x = x + y; /* B */ /* 1, some uses of x */ int x2 = 35; /* C */ /* 2, some uses of x2 */ </syntaxhighlight> The process of splitting <code>x</code> into two separate variables is called [[live range splitting]]. See also [[static single assignment form]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)