X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FGraph%2FMain.hs;h=cdbe98755acf48e3a1952bb997911b94a1b5d850;hb=f8f0e76ad302fda30196ebc9230e5fcbc97be537;hp=6b01298ac68e1c2423d9d07a03d149f17d1c0336;hpb=1c0deb50a7d84e14e0a425a0e1b4293c19718bb3;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs b/compiler/nativeGen/RegAlloc/Graph/Main.hs index 6b01298..cdbe987 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Main.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs @@ -43,7 +43,6 @@ maxSpinCount = 10 -- | The top level of the graph coloring register allocator. --- regAlloc :: (Outputable instr, Instruction instr) => DynFlags @@ -169,9 +168,6 @@ regAlloc_spin -- and rewrite SPILL/RELOAD pseudos into real instructions along the way let code_final = map stripLive code_spillclean --- let spillNatTop = mapGenBlockTop spillNatBlock --- let code_final = map spillNatTop code_nat - -- record what happened in this stage for debugging let stat = RegAllocStatsColored @@ -212,8 +208,10 @@ regAlloc_spin <- regSpill code_coalesced slotsFree rsSpill -- recalculate liveness --- let code_nat = map stripLive code_spilled - code_relive <- mapM regLiveness code_spilled + -- NOTE: we have to reverse the SCCs here to get them back into the reverse-dependency + -- order required by computeLiveness. If they're not in the correct order + -- that function will panic. + code_relive <- mapM (regLiveness . reverseBlocksInTops) code_spilled -- record what happened in this stage for debugging let stat = @@ -238,9 +236,7 @@ regAlloc_spin code_relive - -- | Build a graph from the liveness and coalesce information in this code. - buildGraph :: Instruction instr => [LiveCmmTop instr] @@ -268,7 +264,6 @@ buildGraph code -- | Add some conflict edges to the graph. -- Conflicts between virtual and real regs are recorded as exclusions. --- graphAddConflictSet :: UniqSet Reg -> Color.Graph VirtualReg RegClass RealReg @@ -291,7 +286,6 @@ graphAddConflictSet set graph -- | Add some coalesence edges to the graph -- Coalesences between virtual and real regs are recorded as preferences. --- graphAddCoalesce :: (Reg, Reg) -> Color.Graph VirtualReg RegClass RealReg