Docsity

Assignment 3 for Compiler Design | CS 6241, Assignments of Computer Science

Toggle sidebar
bg1
CS 6241 : Homework III
Total points : 75
Due : Beginning of class, Wednesday, March 4
th
2009
Important Policies:
1. Homeworks are non-collaborative, please direct questions regarding clarifications to the TA
2. Although some homework problems may have solutions available in books, internet sources
etc. you are supposed to solve them on your own without looking up such solutions. This rule
will be STRICTLY enforced and any act of such lookup will be considered an act of plagiarism
and will result in the strictest penalty as per Georgia Tech honor code.
3. When necessary make suitable reasonable assumptions and clearly state them. The solutions
should be neatly written/typed using standard pseudo code notations.
Problem I (75 points) [PRE] Our goal in this homework is to understand PRE thoroughly. We will
construct our own example for this matter and work through the details.
(a) Construct a control flow graph of about 10 basic blocks populated with a good
number of instances of the expression X+Y. Include definitions of X and Y throughout
making sure there are ample instances of partially redundant expressions left out.
The example must include a combination of loop invariants and some straight line
code.
(b) On the above example, fully work out the dataflow framework of PRE showing all the
details of the different sets computed.
(c) Using the above sets, show the expressions that were eliminated (because they were
redundant) and the ones which were hoisted on edges at basic blocks. Show the new
CFG with the new evaluation points for the expressions.
(d) Finally, will PRE completely remove redundancy (consider only lexical redundancy, not
value redundancy)? By working through examples, show instances where redundancy is
still left out.

Partial preview of the text

Download Assignment 3 for Compiler Design | CS 6241 and more Assignments Computer Science in PDF only on Docsity!

CS 6241 : Homework III

Total points : 75

Due : Beginning of class, Wednesday, March 4th^2009

Important Policies:

  1. Homeworks are non-collaborative, please direct questions regarding clarifications to the TA
  2. Although some homework problems may have solutions available in books, internet sources etc. you are supposed to solve them on your own without looking up such solutions. This rule will be STRICTLY enforced and any act of such lookup will be considered an act of plagiarism and will result in the strictest penalty as per Georgia Tech honor code.
  3. When necessary make suitable reasonable assumptions and clearly state them. The solutions should be neatly written/typed using standard pseudo code notations.

Problem I (75 points) [PRE] Our goal in this homework is to understand PRE thoroughly. We will construct our own example for this matter and work through the details.

(a) Construct a control flow graph of about 10 basic blocks populated with a good number of instances of the expression X+Y. Include definitions of X and Y throughout making sure there are ample instances of partially redundant expressions left out. The example must include a combination of loop invariants and some straight line code.

(b) On the above example, fully work out the dataflow framework of PRE showing all the details of the different sets computed.

(c) Using the above sets, show the expressions that were eliminated (because they were redundant) and the ones which were hoisted on edges at basic blocks. Show the new CFG with the new evaluation points for the expressions.

(d) Finally, will PRE completely remove redundancy (consider only lexical redundancy, not value redundancy)? By working through examples, show instances where redundancy is still left out.