X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=ghc%2Fcompiler%2FstgSyn%2FStgUtils.lhs;fp=ghc%2Fcompiler%2FstgSyn%2FStgFuns.lhs;h=830a75233d5ea02b1feb7f1d0e38fafd15b20d21;hp=8dd3f877c23d2486665f7df7ab7a62af685ae25b;hb=6c381e873e222417d9a67aeec77b9555eca7b7a8;hpb=8147a9f0bcc48ef0db1e91f8b985a4f5c3fed560 diff --git a/ghc/compiler/stgSyn/StgFuns.lhs b/ghc/compiler/stgSyn/StgUtils.lhs similarity index 69% rename from ghc/compiler/stgSyn/StgFuns.lhs rename to ghc/compiler/stgSyn/StgUtils.lhs index 8dd3f87..830a752 100644 --- a/ghc/compiler/stgSyn/StgFuns.lhs +++ b/ghc/compiler/stgSyn/StgUtils.lhs @@ -1,19 +1,16 @@ x% % (c) The GRASP/AQUA Project, Glasgow University, 1993-1995 % -\section[StgFuns]{Utility functions for @STG@ programs} +\section[StgUtils]{Utility functions for @STG@ programs} \begin{code} #include "HsVersions.h" -module StgFuns ( - mapStgBindeesRhs - ) where +module StgUtils ( mapStgBindeesRhs ) where import StgSyn import UniqSet -import Unique import Util \end{code} @@ -22,38 +19,38 @@ This utility function simply applies the given function to every bindee in the program. \begin{code} -mapStgBindeesBind :: (Id -> Id) -> PlainStgBinding -> PlainStgBinding +mapStgBindeesBind :: (Id -> Id) -> StgBinding -> StgBinding mapStgBindeesBind fn (StgNonRec b rhs) = StgNonRec b (mapStgBindeesRhs fn rhs) mapStgBindeesBind fn (StgRec pairs) = StgRec [ (b, mapStgBindeesRhs fn r) | (b, r) <- pairs ] ------------------ -mapStgBindeesRhs :: (Id -> Id) -> PlainStgRhs -> PlainStgRhs +mapStgBindeesRhs :: (Id -> Id) -> StgRhs -> StgRhs mapStgBindeesRhs fn (StgRhsClosure cc bi fvs u args expr) - = StgRhsClosure - cc bi - (map fn fvs) - u - (map fn args) + = StgRhsClosure + cc bi + (map fn fvs) + u + (map fn args) (mapStgBindeesExpr fn expr) mapStgBindeesRhs fn (StgRhsCon cc con atoms) = StgRhsCon cc con (map (mapStgBindeesAtom fn) atoms) ------------------ -mapStgBindeesExpr :: (Id -> Id) -> PlainStgExpr -> PlainStgExpr +mapStgBindeesExpr :: (Id -> Id) -> StgExpr -> StgExpr mapStgBindeesExpr fn (StgApp f args lvs) - = StgApp (mapStgBindeesAtom fn f) - (map (mapStgBindeesAtom fn) args) + = StgApp (mapStgBindeesAtom fn f) + (map (mapStgBindeesAtom fn) args) (mapUniqSet fn lvs) -mapStgBindeesExpr fn (StgConApp con atoms lvs) - = StgConApp con (map (mapStgBindeesAtom fn) atoms) (mapUniqSet fn lvs) +mapStgBindeesExpr fn (StgCon con atoms lvs) + = StgCon con (map (mapStgBindeesAtom fn) atoms) (mapUniqSet fn lvs) -mapStgBindeesExpr fn (StgPrimApp op atoms lvs) - = StgPrimApp op (map (mapStgBindeesAtom fn) atoms) (mapUniqSet fn lvs) +mapStgBindeesExpr fn (StgPrim op atoms lvs) + = StgPrim op (map (mapStgBindeesAtom fn) atoms) (mapUniqSet fn lvs) mapStgBindeesExpr fn (StgLet bind expr) = StgLet (mapStgBindeesBind fn bind) (mapStgBindeesExpr fn expr) @@ -86,8 +83,8 @@ mapStgBindeesExpr fn (StgCase expr lvs1 lvs2 uniq alts) mapStgBindeesDeflt (StgBindDefault b used expr) = StgBindDefault b used (mapStgBindeesExpr fn expr) ------------------ -mapStgBindeesAtom :: (Id -> Id) -> PlainStgAtom -> PlainStgAtom +mapStgBindeesAtom :: (Id -> Id) -> StgArg -> StgArg -mapStgBindeesAtom fn a@(StgLitAtom _) = a -mapStgBindeesAtom fn a@(StgVarAtom id) = StgVarAtom (fn id) +mapStgBindeesAtom fn a@(StgLitArg _) = a +mapStgBindeesAtom fn a@(StgVarArg id) = StgVarArg (fn id) \end{code}