retagged by
1,818 views
1 votes
1 votes

Need to tell the Variables live at the Shown points. 

And Please explain because I know how to identify but I am little confused in applying the concept.

Thank you

retagged by

1 Answer

1 votes
1 votes

Naming as follows

naming blocks

Method-1:

Construct this table:

  Gen Kill IN OUT
Block-1 b,c,f a,d,e b,c,f d,e,c,f
Block-2 e f e,c c,f
Block-3 d,e b,e d,e,c,f c,f
Block-4 f,c b c,f ---

query-i = IN(Block-1) = {b,c,f}

query-ii = IN(Block-2) = {e,c}

query-iii = IN(Block-3) = {d,e,c,f}

query-iv = OUT(Block-2) = {c,f}

query-v = OUT(Block-2) = {c,f}

query-vi = OUT(Block-4) = NULL

Method-2:

Logic for query-i:

By identifying all those variables (from the point of query onwards to the end of the program via at least one path) which have been read by some statement before it has been over-written by some other statement, we can get the live variables at the point of query. 

Similarly, using the same logic for all the queries, we’ll get the same answer as in method-1.

Please correct me if anything is wrong.

Related questions

1 votes
1 votes
1 answer
2
santhoshdevulapally asked Jan 4, 2017
692 views
What is live variable and dead code elimination.please explain with example each
0 votes
0 votes
1 answer
3
spriti1991 asked Apr 4, 2015
1,134 views
https://gateoverflow.in/?qa=blob&qa_blobid=6419625116648850773
0 votes
0 votes
0 answers
4