Question: 3. a) Identify the basic blocks for the following program P3 written in pseudo-code. b) Draw the control flow graph. c) Draw the dominator tree.
3.
a) Identify the basic blocks for the following program P3 written in pseudo-code.
b) Draw the control flow graph.
c) Draw the dominator tree.
d) Draw the postdominator tree.
Program P3
1) integer A, B;
2) input (A);
3)
4) if (A > 7)
5) B = 1;
6) else
7) {
8) B = 2;
9) if (A < 2) then
10) B = 3;
11) } // end else A>7
12)
13) for (i=1, i<=A, i++) loop
14) {
15) if (B<0) then
16) B = B + 4;
17) else
18) B = B - 5;
19) } // end for loop
20) output (A,B);
21) end;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
