summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/RegAllocColor.hs
diff options
context:
space:
mode:
authorBen.Lippmeier@anu.edu.au <unknown>2007-09-11 14:50:54 +0000
committerBen.Lippmeier@anu.edu.au <unknown>2007-09-11 14:50:54 +0000
commit295d2a0018243d94a7bd4e72d88d056db32ff3cf (patch)
tree36a1b95113e1ff254c3f9fe8996693c0f7922389 /compiler/nativeGen/RegAllocColor.hs
parenta12bf21a5e9c2b7888cd0ed0c60b9ec1e7295df1 (diff)
downloadhaskell-295d2a0018243d94a7bd4e72d88d056db32ff3cf.tar.gz
Try and allocate vregs spilled/reloaded from some slot to the same hreg
Diffstat (limited to 'compiler/nativeGen/RegAllocColor.hs')
-rw-r--r--compiler/nativeGen/RegAllocColor.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/nativeGen/RegAllocColor.hs b/compiler/nativeGen/RegAllocColor.hs
index 271c1a5ebc..a2b98f1f6a 100644
--- a/compiler/nativeGen/RegAllocColor.hs
+++ b/compiler/nativeGen/RegAllocColor.hs
@@ -119,7 +119,7 @@ regAlloc_spin dflags (spinCount :: Int) triv regsFree slotsFree debug_codeGraphs
-- rewrite regs in the code that have been coalesced
let patchF reg = case lookupUFM rmCoalesce reg of
- Just reg' -> reg'
+ Just reg' -> patchF reg'
Nothing -> reg
let code_coalesced
= map (patchEraseLive patchF) code
@@ -246,16 +246,18 @@ buildGraph code
let (conflictList, moveList) =
unzip $ map slurpConflicts code
- let conflictBag = unionManyBags conflictList
- let moveBag = unionManyBags moveList
+ -- Slurp out the spill/reload coalesces
+ let moveList2 = map slurpReloadCoalesce code
-- Add the reg-reg conflicts to the graph
+ let conflictBag = unionManyBags conflictList
let graph_conflict = foldrBag graphAddConflictSet Color.initGraph conflictBag
-- Add the coalescences edges to the graph.
+ let moveBag = unionBags (unionManyBags moveList2) (unionManyBags moveList)
let graph_coalesce = foldrBag graphAddCoalesce graph_conflict moveBag
- return graph_coalesce
+ return $ Color.validateGraph (text "urk") graph_coalesce
-- | Add some conflict edges to the graph.
@@ -326,7 +328,7 @@ patchRegsFromGraph graph code
( text "There is no node in the graph for register " <> ppr reg
$$ ppr code
$$ Color.dotGraph (\_ -> text "white") trivColorable graph)
-
+
in patchEraseLive patchF code