recategorized
2,377 views
0 votes
0 votes

DU-chains(Definition-Use) in compiler design:

  1. consist of a definition of a variable and all its uses, reachable from that definition
  2. are created using a form static code analysis
  3. are prerequisite for many compiler optimization including constant propagation and common sub-expression elimination
  4. All of the above
recategorized

2 Answers

1 votes
1 votes

$\underline{\textbf{Answer:}\Rightarrow}$

$\underline{\textbf{Explanation:}\Rightarrow}\;\mathrm {(d)}.$

$\underline{\textbf{Definition-Use Chain (DU Chain):}}$

It consists of definition(D) of a variable, and all the uses, U reachable from that definition without getting involved in other definitions.

$\underline{\textbf{Use-Definition Chain (UD Chain):}}$

It is a counterpart of Definition-Use Chain (DU Chain).

It is a $\color{blue}{\text{data structure}}$ that consists of use, $\mathbf U$, of a variable, and all the definitions $\mathbf{(D)}$ of that variable that can reach that use without getting involved in any other definitions.

  • UD Chain most of the time means $\color{blue}{\text{assigning}}$ some value to a variable.

$\textbf{Applications:}$

  1. Knowing the use-def and def-use chains are helpful in compiler optimizations including constant propagation and common sub-expression elimination.
  2. Helpful in dead-code elimination.
  3. instruction reordering.
  4. (Implementation of ) scoping/shadowing.

Both of them are created by using $\color{magenta}{\textbf{Data flow analysis}}$. It is a form of $\color{blue}{\text{static code analysis}}$.


https://en.m.wikipedia.org/wiki/Use-define_chain

Answer:

Related questions

4 votes
4 votes
2 answers
1
2 votes
2 votes
1 answer
2
6 votes
6 votes
3 answers
3
Arjun asked Apr 22, 2018
5,710 views
A particular BNF definition for a "word is given by the following rules.<word :: = <letter I <letter <charpair I <letter <intpair <charpair :: = <letter <letter I <charpa...