Consider the following Three Address code sample for solving the questions:
100: t1 = y+2
101: initial = x/t1
102: limit = 10
103: if i > j goto 105
104: goto 111
105: if num > b goto 107
106: goto 111
107: num = limit-1
108: b = y+2
109: i = i - num
110: goto 103
111: j = i - num
112: k= j+b
To solve this problem, we need to determine which blocks are dominated by Block 3 and Block 5 in the flow graph derived from the given Three Address Code (TAC). Dominance in a control flow graph implies that a block B is said to dominate another block C if every path from the start block to block C goes through block B.
Let's first break down the given TAC to identify the basic blocks:
Now, examining the flow of the control graph:
Block 3 is a branching block due to the conditional jumps in instructions 103 and 104. Block 3's control transfers either to Block 5 (via instruction 103) or Block 6 (via instruction 104).
Block 5 receives control from both Block 4 and Block 3 via instruction 105, and it loops back to Block 3 at instruction 110.
Let's analyze the dominance:
Thus, the correct answer is:
Therefore, the correct answer from the given options is:
Block 3:3 ; Block 5:5
Consider the control flow graph given below.
Which one of the following options is the set of live variables at the exit point of each basic block?
| LIST-I Input | LIST-II Compiler Phase |
|---|---|
| A. Syntax Tree | I. Code Generator |
| B. Character Stream | II. Syntax Analyzer |
| C. Intermediate Representation | III. Semantic Analyzer |
| D. Token Stream | IV. Lexical Analyzer |