X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FGraphOps.hs;h=308cae0467afe43d0c144f2eb997da61dc6b797c;hb=8672676c20d5c9a268a8f07dc7aa706df4ca315f;hp=e61b9d1f962f07a449bddd49dafe9e67291f51f3;hpb=a7f409e855291efece19970927156fae4e527b6e;p=ghc-hetmet.git diff --git a/compiler/nativeGen/GraphOps.hs b/compiler/nativeGen/GraphOps.hs index e61b9d1..308cae0 100644 --- a/compiler/nativeGen/GraphOps.hs +++ b/compiler/nativeGen/GraphOps.hs @@ -1,13 +1,6 @@ - -- | Basic operations on graphs. -- - -{-# OPTIONS -w #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and fix --- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings --- for details +{-# OPTIONS -fno-warn-missing-signatures #-} module GraphOps ( addNode, delNode, getNode, lookupNode, modNode, @@ -35,7 +28,6 @@ import UniqFM import Data.List hiding (union) import Data.Maybe - -- | Lookup a node from the graph. lookupNode :: Uniquable k @@ -195,13 +187,13 @@ addConflicts conflicts getClass | otherwise = graphMapModify - $ (\fm -> foldr (\u -> addConflictSet1 u getClass conflicts) fm + $ (\fm -> foldl' (\g u -> addConflictSet1 u getClass conflicts g) fm $ uniqSetToList conflicts) addConflictSet1 u getClass set - = let set' = delOneFromUniqSet set u - in adjustWithDefaultUFM + = case delOneFromUniqSet set u of + set' -> adjustWithDefaultUFM (\node -> node { nodeConflicts = unionUniqSets set' (nodeConflicts node) } ) (newNode u (getClass u)) { nodeConflicts = set' } u @@ -432,7 +424,7 @@ slurpNodeConflictCount slurpNodeConflictCount graph = addListToUFM_C - (\(c1, n1) (c2, n2) -> (c1, n1 + n2)) + (\(c1, n1) (_, n2) -> (c1, n1 + n2)) emptyUFM $ map (\node -> let count = sizeUniqSet $ nodeConflicts node @@ -454,6 +446,7 @@ setColor u color u +{-# INLINE adjustWithDefaultUFM #-} adjustWithDefaultUFM :: Uniquable k => (a -> a) -> a -> k @@ -461,11 +454,11 @@ adjustWithDefaultUFM adjustWithDefaultUFM f def k map = addToUFM_C - (\old new -> f old) + (\old _ -> f old) map k def - +{-# INLINE adjustUFM #-} adjustUFM :: Uniquable k => (a -> a) @@ -475,5 +468,4 @@ adjustUFM f k map = case lookupUFM map k of Nothing -> map Just a -> addToUFM map k (f a) -