closed by
1,113 views
1 1 vote
closed as a duplicate of: Program Flow Graph

someone please share detailed rules for this along with solution- would be of great help.

and we usually dont take start and end state- arent they extra here? coz count comes different

 

1 Answer

3 3 votes

In order to form control flow graph we must form basic blocks of instructions and assign edges in between them to show the flow of program as per condition met.Some rules to form basic blocks:

1.start and end blocks are added to show beginning and ending of data flow .

2. first statement is always a beginning of new block.

3. goto expression(conditional/ unconditional branching) pointing to any statement, form a new basic block starting with respective target statement no.

4. statement that follows immediately a conditional/ unconditional expression reflects beginning of new block.

The solutions must have 8 ans as per these rules. Please find below image for solution:

 

Position:
Show:

Related questions

0 0 votes
2 2 answers
2.0k
2.0k views
manisha11 asked Nov 18, 2018
2,046 views
a x b x c + d - a + e x f - g + horder of precedence : x>+>- ; with x is left associative and +, - as right.Min number of variables required in TAC?Should'nt the expressi...
2 2 votes
1 1 answer
1.8k
1.8k views
rahul sharma 5 asked Jan 24, 2018
1,779 views
Consider the intermediate code given below:The number of nodes and edges in the control-flow graph constructed for the above code, respectively are X and Y. The value of ...
4 4 votes
2 2 answers
2.2k
2.2k views
Saikat Dutta asked Jan 22, 2018
2,247 views
The following program uses six temporary variables p, q, r, s, t and u. The code is :Assuming that all operations take their operands from registers. The minimum number o...