projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try and rewrite reloads to reg-reg moves in the spill cleaner
[ghc-hetmet.git]
/
compiler
/
nativeGen
/
RegAllocColor.hs
diff --git
a/compiler/nativeGen/RegAllocColor.hs
b/compiler/nativeGen/RegAllocColor.hs
index
c2cefc3
..
a2b98f1
100644
(file)
--- 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
-- 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
Nothing -> reg
let code_coalesced
= map (patchEraseLive patchF) code
@@
-135,7
+135,7
@@
regAlloc_spin dflags (spinCount :: Int) triv regsFree slotsFree debug_codeGraphs
let code_spillclean = map cleanSpills code_patched
-- strip off liveness information
let code_spillclean = map cleanSpills code_patched
-- strip off liveness information
- let code_nat = map stripLive code_patched
+ let code_nat = map stripLive code_spillclean
-- rewrite SPILL/RELOAD pseudos into real instructions
let spillNatTop = mapGenBlockTop spillNatBlock
-- rewrite SPILL/RELOAD pseudos into real instructions
let spillNatTop = mapGenBlockTop spillNatBlock
@@
-246,16
+246,18
@@
buildGraph code
let (conflictList, moveList) =
unzip $ map slurpConflicts 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
-- 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 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
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.
-- | 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)
( text "There is no node in the graph for register " <> ppr reg
$$ ppr code
$$ Color.dotGraph (\_ -> text "white") trivColorable graph)
-
+
in patchEraseLive patchF code
in patchEraseLive patchF code