projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treat the (~) type constructor a bit specially
[ghc-hetmet.git]
/
compiler
/
simplStg
/
StgStats.lhs
diff --git
a/compiler/simplStg/StgStats.lhs
b/compiler/simplStg/StgStats.lhs
index
bca2bbb
..
74a4fc3
100644
(file)
--- a/
compiler/simplStg/StgStats.lhs
+++ b/
compiler/simplStg/StgStats.lhs
@@
-30,14
+30,14
@@
The program gather statistics about
module StgStats ( showStgStats ) where
module StgStats ( showStgStats ) where
--- XXX This define is a bit of a hack, and should be done more nicely
-#define FAST_STRING_NOT_NEEDED 1
#include "HsVersions.h"
import StgSyn
#include "HsVersions.h"
import StgSyn
-import FiniteMap ( emptyFM, plusFM_C, unitFM, fmToList, FiniteMap )
import Id (Id)
import Id (Id)
+
+import Data.Map (Map)
+import qualified Data.Map as Map
\end{code}
\begin{code}
\end{code}
\begin{code}
@@
-56,24
+56,24
@@
data CounterType
deriving (Eq, Ord)
type Count = Int
deriving (Eq, Ord)
type Count = Int
-type StatEnv = FiniteMap CounterType Count
+type StatEnv = Map CounterType Count
\end{code}
\begin{code}
emptySE :: StatEnv
\end{code}
\begin{code}
emptySE :: StatEnv
-emptySE = emptyFM
+emptySE = Map.empty
combineSE :: StatEnv -> StatEnv -> StatEnv
combineSE :: StatEnv -> StatEnv -> StatEnv
-combineSE = plusFM_C (+)
+combineSE = Map.unionWith (+)
combineSEs :: [StatEnv] -> StatEnv
combineSEs = foldr combineSE emptySE
countOne :: CounterType -> StatEnv
combineSEs :: [StatEnv] -> StatEnv
combineSEs = foldr combineSE emptySE
countOne :: CounterType -> StatEnv
-countOne c = unitFM c 1
+countOne c = Map.singleton c 1
countN :: CounterType -> Int -> StatEnv
countN :: CounterType -> Int -> StatEnv
-countN = unitFM
+countN = Map.singleton
\end{code}
%************************************************************************
\end{code}
%************************************************************************
@@
-87,7
+87,7
@@
showStgStats :: [StgBinding] -> String
showStgStats prog
= "STG Statistics:\n\n"
showStgStats prog
= "STG Statistics:\n\n"
- ++ concat (map showc (fmToList (gatherStgStats prog)))
+ ++ concat (map showc (Map.toList (gatherStgStats prog)))
where
showc (x,n) = (showString (s x) . shows n) "\n"
where
showc (x,n) = (showString (s x) . shows n) "\n"