Fix linear register allocator bug involving read/write to same registers.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 4 Apr 2011 11:58:31 +0000 (12:58 +0100)
committerEdward Z. Yang <ezyang@mit.edu>
Tue, 5 Apr 2011 10:29:33 +0000 (11:29 +0100)
commit06bf361cae4364f7f568688d30d22a4a3fc914ec
treed1115ac8b9220e3065f889f004273e6bf1200f7a
parent9be618cdf99b04ce7eef6eeabc168b59174bb843
Fix linear register allocator bug involving read/write to same registers.

When we read a temporary value from memory, we should update its
assignment to be both in memory and in register.  This was only
occurring when there was a free register, but not if we needed
to spill an existing value in a register to the stack.  I generalized
the code for this case and applied it to the other two cases where
this occurs (spilled value is in memory and in a register, and when
the spilled value is only in a register.)

Furthermore, I tightened the invariants on allocRegsAndSpill_spill
with a new data type SpillLoc that captures more precisely than
Maybe Loc the possible locations we are spilling from.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
compiler/nativeGen/RegAlloc/Linear/Main.hs