X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FstgSyn%2FStgSyn.lhs;h=6cd7df78a5f32b1c606b0a2954fdfd309ecf777e;hb=235edf36cc202bb21c00d0e5e05ebf076fb0542e;hp=f1c50cc8fd017d2a8e67dc56e4fafdaa99b36af1;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/stgSyn/StgSyn.lhs b/compiler/stgSyn/StgSyn.lhs index f1c50cc..6cd7df7 100644 --- a/compiler/stgSyn/StgSyn.lhs +++ b/compiler/stgSyn/StgSyn.lhs @@ -9,6 +9,13 @@ form of @CoreSyntax@, the style being one that happens to be ideally suited to spineless tagless code generation. \begin{code} +{-# 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 + module StgSyn ( GenStgArg(..), GenStgLiveVars, @@ -65,9 +72,8 @@ import TyCon ( TyCon ) import UniqSet ( isEmptyUniqSet, uniqSetToList, UniqSet ) import Unique ( Unique ) import Bitmap -import DynFlags ( DynFlags ) -import Packages ( HomeModules ) import StaticFlags ( opt_SccProfilingOn ) +import Module \end{code} %************************************************************************ @@ -106,18 +112,18 @@ data GenStgArg occ isStgTypeArg (StgTypeArg _) = True isStgTypeArg other = False -isDllArg :: HomeModules -> StgArg -> Bool +isDllArg :: PackageId -> StgArg -> Bool -- Does this argument refer to something in a different DLL? -isDllArg hmods (StgTypeArg v) = False -isDllArg hmods (StgVarArg v) = isDllName hmods (idName v) -isDllArg hmods (StgLitArg lit) = False +isDllArg this_pkg (StgTypeArg v) = False +isDllArg this_pkg (StgVarArg v) = isDllName this_pkg (idName v) +isDllArg this_pkg (StgLitArg lit) = False -isDllConApp :: HomeModules -> DataCon -> [StgArg] -> Bool +isDllConApp :: PackageId -> DataCon -> [StgArg] -> Bool -- Does this constructor application refer to -- anything in a different DLL? -- If so, we can't allocate it statically -isDllConApp hmods con args - = isDllName hmods (dataConName con) || any (isDllArg hmods) args +isDllConApp this_pkg con args + = isDllName this_pkg (dataConName con) || any (isDllArg this_pkg) args stgArgType :: StgArg -> Type -- Very half baked becase we have lost the type arguments @@ -168,13 +174,16 @@ constructors, primitives, and literals. \begin{code} | StgLit Literal + -- StgConApp is vital for returning unboxed tuples + -- which can't be let-bound first | StgConApp DataCon [GenStgArg occ] -- Saturated | StgOpApp StgOp -- Primitive op or foreign call [GenStgArg occ] -- Saturated - Type -- Result type; we need to know the result type - -- so that we can assign result registers. + Type -- Result type + -- We need to know this so that we can + -- assign result registers \end{code} %************************************************************************ @@ -350,6 +359,21 @@ Finally for @scc@ expressions we introduce a new STG construct. | StgSCC CostCentre -- label of SCC expression (GenStgExpr bndr occ) -- scc expression +\end{code} + +%************************************************************************ +%* * +\subsubsection{@GenStgExpr@: @hpc@ expressions} +%* * +%************************************************************************ + +Finally for @scc@ expressions we introduce a new STG construct. + +\begin{code} + | StgTick + Module -- the module of the source of this tick + Int -- tick number + (GenStgExpr bndr occ) -- sub expression -- end of GenStgExpr \end{code} @@ -720,6 +744,10 @@ pprStgExpr (StgSCC cc expr) = sep [ hsep [ptext SLIT("_scc_"), ppr cc], pprStgExpr expr ] +pprStgExpr (StgTick m n expr) + = sep [ hsep [ptext SLIT("_tick_"), pprModule m,text (show n)], + pprStgExpr expr ] + pprStgExpr (StgCase expr lvs_whole lvs_rhss bndr srt alt_type alts) = sep [sep [ptext SLIT("case"), nest 4 (hsep [pprStgExpr expr,