[commit: ghc] master: compiler: de-lhs simplStg/ (bafba11)
git at git.haskell.org
git at git.haskell.org
Wed Dec 3 20:06:41 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/bafba119387cdba1a84a45b6a4fe616792c94271/ghc
>---------------------------------------------------------------
commit bafba119387cdba1a84a45b6a4fe616792c94271
Author: Austin Seipp <austin at well-typed.com>
Date: Wed Dec 3 12:45:58 2014 -0600
compiler: de-lhs simplStg/
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
bafba119387cdba1a84a45b6a4fe616792c94271
compiler/simplStg/{SimplStg.lhs => SimplStg.hs} | 11 ++---
compiler/simplStg/{StgStats.lhs => StgStats.hs} | 50 ++++++++++------------
.../simplStg/{UnariseStg.lhs => UnariseStg.hs} | 9 ++--
3 files changed, 30 insertions(+), 40 deletions(-)
diff --git a/compiler/simplStg/SimplStg.lhs b/compiler/simplStg/SimplStg.hs
similarity index 96%
rename from compiler/simplStg/SimplStg.lhs
rename to compiler/simplStg/SimplStg.hs
index 4d33e33..b8804a4 100644
--- a/compiler/simplStg/SimplStg.lhs
+++ b/compiler/simplStg/SimplStg.hs
@@ -1,9 +1,9 @@
-%
-% (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
-%
+{-
+(c) The GRASP/AQUA Project, Glasgow University, 1993-1998
+
\section[SimplStg]{Driver for simplifying @STG@ programs}
+-}
-\begin{code}
{-# LANGUAGE CPP #-}
module SimplStg ( stg2stg ) where
@@ -25,9 +25,7 @@ import SrcLoc
import UniqSupply ( mkSplitUniqSupply, splitUniqSupply )
import Outputable
import Control.Monad
-\end{code}
-\begin{code}
stg2stg :: DynFlags -- includes spec of what stg-to-stg passes to do
-> Module -- module name (profiling only)
-> [StgBinding] -- input...
@@ -89,4 +87,3 @@ stg2stg dflags module_name binds
-- UniqueSupply for the next guy to use
-- cost-centres to be declared/registered (specialised)
-- add to description of what's happened (reverse order)
-\end{code}
diff --git a/compiler/simplStg/StgStats.lhs b/compiler/simplStg/StgStats.hs
similarity index 79%
rename from compiler/simplStg/StgStats.lhs
rename to compiler/simplStg/StgStats.hs
index 2a77675..4823bae 100644
--- a/compiler/simplStg/StgStats.lhs
+++ b/compiler/simplStg/StgStats.hs
@@ -1,6 +1,6 @@
-%
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-%
+{-
+(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
+
\section[StgStats]{Gathers statistical information about programs}
@@ -19,8 +19,8 @@ The program gather statistics about
%\item number of top-level CAFs
\item number of constructors
\end{enumerate}
+-}
-\begin{code}
{-# LANGUAGE CPP #-}
module StgStats ( showStgStats ) where
@@ -34,9 +34,7 @@ import Panic
import Data.Map (Map)
import qualified Data.Map as Map
-\end{code}
-\begin{code}
data CounterType
= Literals
| Applications
@@ -53,9 +51,7 @@ data CounterType
type Count = Int
type StatEnv = Map CounterType Count
-\end{code}
-\begin{code}
emptySE :: StatEnv
emptySE = Map.empty
@@ -70,15 +66,15 @@ countOne c = Map.singleton c 1
countN :: CounterType -> Int -> StatEnv
countN = Map.singleton
-\end{code}
-%************************************************************************
-%* *
+{-
+************************************************************************
+* *
\subsection{Top-level list of bindings (a ``program'')}
-%* *
-%************************************************************************
+* *
+************************************************************************
+-}
-\begin{code}
showStgStats :: [StgBinding] -> String
showStgStats prog
@@ -107,15 +103,15 @@ gatherStgStats :: [StgBinding] -> StatEnv
gatherStgStats binds
= combineSEs (map (statBinding True{-top-level-}) binds)
-\end{code}
-%************************************************************************
-%* *
+{-
+************************************************************************
+* *
\subsection{Bindings}
-%* *
-%************************************************************************
+* *
+************************************************************************
+-}
-\begin{code}
statBinding :: Bool -- True <=> top-level; False <=> nested
-> StgBinding
-> StatEnv
@@ -140,15 +136,15 @@ statRhs top (_, StgRhsClosure _ _ fv u _ _ body)
Updatable -> UpdatableBinds top
SingleEntry -> SingleEntryBinds top
)
-\end{code}
-%************************************************************************
-%* *
+{-
+************************************************************************
+* *
\subsection{Expressions}
-%* *
-%************************************************************************
+* *
+************************************************************************
+-}
-\begin{code}
statExpr :: StgExpr -> StatEnv
statExpr (StgApp _ _) = countOne Applications
@@ -176,5 +172,3 @@ statExpr (StgCase expr _ _ _ _ _ alts)
= combineSEs (map statExpr [ e | (_,_,_,e) <- alts ])
statExpr (StgLam {}) = panic "statExpr StgLam"
-\end{code}
-
diff --git a/compiler/simplStg/UnariseStg.lhs b/compiler/simplStg/UnariseStg.hs
similarity index 93%
rename from compiler/simplStg/UnariseStg.lhs
rename to compiler/simplStg/UnariseStg.hs
index 1f121f7..303bfa7 100644
--- a/compiler/simplStg/UnariseStg.lhs
+++ b/compiler/simplStg/UnariseStg.hs
@@ -1,6 +1,6 @@
-%
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-2012
-%
+{-
+(c) The GRASP/AQUA Project, Glasgow University, 1992-2012
+
Note [Unarisation]
~~~~~~~~~~~~~~~~~~
@@ -25,8 +25,8 @@ Because of unarisation, the arity that will be recorded in the generated info ta
for an Id may be larger than the idArity. Instead we record what we call the RepArity,
which is the Arity taking into account any expanded arguments, and corresponds to
the number of (possibly-void) *registers* arguments will arrive in.
+-}
-\begin{code}
{-# LANGUAGE CPP #-}
module UnariseStg (unarise) where
@@ -220,4 +220,3 @@ unboxedTupleBindersFrom us x tys = zipWith (mkSysLocal fs) (uniqsFromSupply us)
concatMapVarSet :: (Var -> [Var]) -> VarSet -> VarSet
concatMapVarSet f xs = mkVarSet [x' | x <- varSetElems xs, x' <- f x]
-\end{code}
\ No newline at end of file
More information about the ghc-commits
mailing list