diff options
author | Ben.Lippmeier@anu.edu.au <unknown> | 2009-09-17 10:44:29 +0000 |
---|---|---|
committer | Ben.Lippmeier@anu.edu.au <unknown> | 2009-09-17 10:44:29 +0000 |
commit | af6e6c7022596e69b6aa0269cca18d7b8b1dcbf7 (patch) | |
tree | 0179226f459fcb6246bf459a8553b8bd1043b221 /compiler/nativeGen/RegAlloc/Liveness.hs | |
parent | e17cf7ff32778f4e6b3622855f25426251e843d6 (diff) | |
download | haskell-af6e6c7022596e69b6aa0269cca18d7b8b1dcbf7.tar.gz |
NCG: Remember to keep the entry block first when erasing liveness info
Diffstat (limited to 'compiler/nativeGen/RegAlloc/Liveness.hs')
-rw-r--r-- | compiler/nativeGen/RegAlloc/Liveness.hs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs index 69ec7ae418..18dd01aa17 100644 --- a/compiler/nativeGen/RegAlloc/Liveness.hs +++ b/compiler/nativeGen/RegAlloc/Liveness.hs @@ -457,10 +457,21 @@ stripLive live = stripCmm live where stripCmm (CmmData sec ds) = CmmData sec ds - stripCmm (CmmProc (LiveInfo info _ _) label params sccs) - = CmmProc info label params - (ListGraph $ map stripLiveBlock $ flattenSCCs sccs) - + + stripCmm (CmmProc (LiveInfo info (Just first_id) _) label params sccs) + = let final_blocks = flattenSCCs sccs + + -- make sure the block that was first in the input list + -- stays at the front of the output. This is the entry point + -- of the proc, and it needs to come first. + ((first':_), rest') + = partition ((== first_id) . blockId) final_blocks + + in CmmProc info label params + (ListGraph $ map stripLiveBlock $ first' : rest') + + stripCmm _ + = panic "RegAlloc.Liveness.stripLive: no first_id on proc" -- | Strip away liveness information from a basic block, -- and make real spill instructions out of SPILL, RELOAD pseudos along the way. |