Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Consider the basic block given below.
    a = b + c
    c = a + d
    d = b + c
    e = d - b
    a = e + b
    The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
    1. 6 and 6
    2. 8 and 10
    3. 9 and 12
    4. 4 and 4
Correct Option: A

The given block is
a = b + c
c = a + d = b + c + d
d = b + c
= b + b + c + d = 2b + c + d
e = d – b = b + b + c + d – b = b + c + d
a = e + b = b + b + c + d = 2b + c + d
Therefore e and c are same, a and d are same. The DAG generated is as follows:

The maximum number of nodes and edges is (6, 6)



Your comments will be displayed only after manual approval.