Instructions for homework 4 in comp 412, a fall 2008 computer science course. Students are required to compute immediate dominators and dominance frontiers for a given graph, transform code into ssa form, and understand the differences between maximal, minimal, semi-pruned, and pruned ssa. The document also includes examples and instructions for showing live-in and live-out sets, phi-nodes, and code renaming.
Download COMP 412 Fall 2008 HW 4: Computing Immediate Dominators, Dominance Frontiers, and SSA Form and more Assignments Computer Science in PDF only on Docsity!
COMP 412
Fall 2008 Homework 4 Due Friday, December 5th 2008 , 5:00 p.m.
Compute the immediate dominators and dominance frontiers for the following graph:
For this problem, we will transform the code on the next page into SSA form. The code is from one of our compiler benchmarks, and it is in our production form of iloc – you don’t have to know what each of the instructions mean: we will build SSA form for virtual registers (an ‘r’ followed by a number), and the FRAME statement is, essentially, a procedure header. a. First, show the dominators and dominance frontiers for each block. b. Next, compute liveness: i. Show the live-in and live-out sets for each block. ii. The live-in set for A is non-empty – what does this mean, and what would you do to the code to correct the problem? c. Show the phi-nodes that need to be inserted. d. Rename the code. Show the order that you iterate over the blocks. e. Between page 468 of the book and the class notes, we introduced four flavors of SSA: maximal, minimal, semi-pruned, and pruned – these are distinguished by the amount of data-flow analysis required and by the number of phi-nodes each method inserts. Which flavor did you build in part c? Give at least one example of a phi-node that the other three methods would have produced or not produced. That is, if you built pruned SSA, then show examples of phi-nodes that maximal, minimal, and semi-pruned would have put it but pruned did not; on the other hand, if you built minimal SSA, show a phi-node that maximal would have put in, and show at least one phi-node that you did put in that would have been avoided by, first, semi-pruned, and second, pruned.