X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FGraphOps.hs;h=880f3c65cd85983b1261e683309528ff32cdc9f0;hb=a1515d75e38a32d69636c98bb590f6195e2ab3d1;hp=ad5e18f3c07e6f755ad0ff14fa26efed47c7815e;hpb=1116b8749571c660d446258481e4e74798bbb864;p=ghc-hetmet.git diff --git a/compiler/utils/GraphOps.hs b/compiler/utils/GraphOps.hs index ad5e18f..880f3c6 100644 --- a/compiler/utils/GraphOps.hs +++ b/compiler/utils/GraphOps.hs @@ -1,8 +1,6 @@ +{-# OPTIONS -fno-warn-missing-signatures #-} -- | Basic operations on graphs. -- --- TODO: refine coalescing crieteria - -{-# OPTIONS -fno-warn-missing-signatures #-} module GraphOps ( addNode, delNode, getNode, lookupNode, modNode, @@ -273,7 +271,9 @@ coalesceGraph -- less colorable (aggressive coalescing) -> Triv k cls color -> Graph k cls color - -> (Graph k cls color, [(k, k)]) + -> ( Graph k cls color + , [(k, k)]) -- pairs of nodes that were coalesced, in the order that the + -- coalescing was applied. coalesceGraph aggressive triv graph = coalesceGraph' aggressive triv graph [] @@ -301,8 +301,8 @@ coalesceGraph' aggressive triv graph kkPairsAcc -- keep running until there are no more coalesces can be found in case catMaybes mPairs of - [] -> (graph', kkPairsAcc) - pairs -> coalesceGraph' aggressive triv graph' (pairs ++ kkPairsAcc) + [] -> (graph', reverse kkPairsAcc) + pairs -> coalesceGraph' aggressive triv graph' (reverse pairs ++ kkPairsAcc) -- | Coalesce this pair of nodes unconditionally / agressively.