Add vreg-conflicts and vreg-conflict-lifetimes to drop-asm-stats
[ghc-hetmet.git] / compiler / nativeGen / GraphOps.hs
index 86bf6bd..92058e9 100644 (file)
@@ -10,7 +10,8 @@ module GraphOps (
        addExclusion,   
        addPreference,
        setColor,
-       verify
+       verify,
+       slurpNodeConflictCount
 )
 where
 
@@ -275,6 +276,24 @@ verify graph
         else   False
 
 
+-- | Slurp out a map of how many nodes had a certain number of conflict neighbours
+
+slurpNodeConflictCount
+       :: Uniquable k
+       => Graph k cls color
+       -> UniqFM (Int, Int)    -- ^ (conflict neighbours, num nodes with that many conflicts)
+
+slurpNodeConflictCount graph
+       = addListToUFM_C
+               (\(c1, n1) (c2, n2) -> (c1, n1 + n2))
+               emptyUFM
+       $ map   (\node
+                 -> let count  = sizeUniqSet $ nodeConflicts node
+                    in  (count, (count, 1)))
+       $ eltsUFM
+       $ graphMap graph
+
+
 -- | Set the color of a certain node
 setColor 
        :: Uniquable k