Final Exam, Fall 2006
=====================
Q.3: this
a
ra
x
temporaries
saved callee-save registers
Q.4 y=0
| y
>
a=1
| y,a
>
if y<0 then <-------
|a |y |y,a
| > |
| a=y |
| |a |
> > |
i=a+2 |
|a,i |
> |
y=i+1 |
|y,a,i |
> |
if i<100 then -------|
|i
>
return
Q.5 For the liveness analysis in the book to make sense,
we must recognize that the statement (2nd to last)
b=d+e is dead. When that statement is dead, also
e=a+c is dead. The resulting program has an
interference graph which can be colored with 3 colors.
Q.6 Linear scan with 3 registers does not spill;
linear scan with 2 register spills one variable (d).