exam2sol

exam2sol - ECE 468& 573 — Midterm 2(Key and Rubric...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 468 & 573 — Midterm 2 (Key and Rubric) November 4, 2011 Name: ______________________________________ Purdue email: ______________________________________ Please sign the following: I afFrm that the answers given on this test are mine and mine alone. I did not receive help from any person or material (other than those explicitly allowed). X ___________________________________________ Part Points Score 1 10 2 30 [+10] 3 40 4 20 [+10] Total 100 [+20] Part 1: Common subexpression elimination (10 pts) For the next questions, consider the following piece of code: 1: A = B + C; 2: B = A + C; 3: Q = A + C; 4: A = A + C; 5: P = B + C; 1) Assume there is no aliasing between variables. For each statement, list which expressions are “available” after the statement executes (5 pts) 1 point per entry 1 B+C 2 A+C 3 A+C 4----- 5 B+C 2) What does the code look like after performing CSE (when eliminating a redundant expression, replace it with the variable that holds the calculated value of the expression) (5 pts) One point per line of code. Part 2: Register allocation (30 pts [+10 for ECE 573]) For the next 3 problems, consider the following code (assume this is the full program): 1: A = 7 2: B = 8 3: A = A + B 4: C = A + B 5: D = B + C 6: E = D + C 7: D = A + E 8: F = E + B 9: B = A + F 10: WRITE(B) //this counts as a use of B 1) Show which variables are live after each instruction (10 pts) (1 point per entry) 1 A 2 A, B 3 A, B 4 A, B, C 5 A, B, C, D 6 A, B, E 7 A, B, E 8 A, F 9 B----- If you shifted your answers (e.g., if you showed live-in instead of live-out), I took off half points for the shifted answers. 2) How many registers are needed to perform register allocation on this code without spills? (3 pts) no partial credit 3) Draw the interference graph for the code (7 pts) A B D E F C 2 points per missing/extra line Consider performing bottom up register allocation. For the following scenarios, Consider performing bottom up register allocation....
View Full Document

{[ snackBarMessage ]}

Page1 / 10

exam2sol - ECE 468& 573 — Midterm 2(Key and Rubric...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online