X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FsimplStg%2FStgStats.lhs;h=a91873971c1fe517947095a3a4cfe36b72793344;hb=b8802cd2d774d8e561dc41c205e66f3b290c5f4f;hp=824c112a1ceedc30ca55edef7e9b70832547c0cc;hpb=f16228e47dbaf4c5eb710bf507b3b61bc5ad7122;p=ghc-hetmet.git diff --git a/ghc/compiler/simplStg/StgStats.lhs b/ghc/compiler/simplStg/StgStats.lhs index 824c112..a918739 100644 --- a/ghc/compiler/simplStg/StgStats.lhs +++ b/ghc/compiler/simplStg/StgStats.lhs @@ -38,8 +38,7 @@ data CounterType | ConstructorApps | PrimitiveApps | LetNoEscapes - | AlgCases - | PrimCases + | StgCases | FreeVariables | ConstructorBinds Bool{-True<=>top-level-} | ReEntrantBinds Bool{-ditto-} @@ -88,8 +87,7 @@ showStgStats prog s ConstructorApps = "ConstructorApps " s PrimitiveApps = "PrimitiveApps " s LetNoEscapes = "LetNoEscapes " - s AlgCases = "AlgCases " - s PrimCases = "PrimCases " + s StgCases = "StgCases " s FreeVariables = "FreeVariables " s (ConstructorBinds True) = "ConstructorBinds_Top " s (ReEntrantBinds True) = "ReEntrantBinds_Top " @@ -117,10 +115,10 @@ statBinding :: Bool -- True <=> top-level; False <=> nested -> StgBinding -> StatEnv -statBinding top (StgNonRec _srt b rhs) +statBinding top (StgNonRec b rhs) = statRhs top (b, rhs) -statBinding top (StgRec _srt pairs) +statBinding top (StgRec pairs) = combineSEs (map (statRhs top) pairs) statRhs :: Bool -> (Id, StgRhs) -> StatEnv @@ -128,7 +126,7 @@ statRhs :: Bool -> (Id, StgRhs) -> StatEnv statRhs top (b, StgRhsCon cc con args) = countOne (ConstructorBinds top) -statRhs top (b, StgRhsClosure cc bi fv u args body) +statRhs top (b, StgRhsClosure cc bi fv u _srt args body) = statExpr body `combineSE` countN FreeVariables (length fv) `combineSE` countOne ( @@ -163,24 +161,12 @@ statExpr (StgLet binds body) = statBinding False{-not top-level-} binds `combineSE` statExpr body -statExpr (StgCase expr lve lva bndr srt alts) +statExpr (StgCase expr lve lva bndr srt alt_type alts) = statExpr expr `combineSE` + stat_alts alts `combineSE` + countOne StgCases + where stat_alts alts - where - stat_alts (StgAlgAlts ty alts def) = combineSEs (map statExpr [ e | (_,_,_,e) <- alts ]) - `combineSE` - stat_deflt def `combineSE` - countOne AlgCases - - stat_alts (StgPrimAlts ty alts def) - = combineSEs (map statExpr [ e | (_,e) <- alts ]) - `combineSE` - stat_deflt def `combineSE` - countOne PrimCases - - stat_deflt StgNoDefault = emptySE - - stat_deflt (StgBindDefault expr) = statExpr expr \end{code}