module StgSyn (
GenStgArg(..),
- GenStgLiveVars(..),
+ SYN_IE(GenStgLiveVars),
GenStgBinding(..), GenStgExpr(..), GenStgRhs(..),
GenStgCaseAlts(..), GenStgCaseDefault(..),
combineStgBinderInfo,
-- a set of synonyms for the most common (only :-) parameterisation
- StgArg(..), StgLiveVars(..),
- StgBinding(..), StgExpr(..), StgRhs(..),
- StgCaseAlts(..), StgCaseDefault(..),
+ SYN_IE(StgArg), SYN_IE(StgLiveVars),
+ SYN_IE(StgBinding), SYN_IE(StgExpr), SYN_IE(StgRhs),
+ SYN_IE(StgCaseAlts), SYN_IE(StgCaseDefault),
pprPlainStgBinding,
getArgPrimRep,
isLitLitArg,
stgArity,
- collectExportedStgBinders
-
- -- and to make the interface self-sufficient...
+ collectFinalStgBinders
) where
-import Ubiq{-uitous-}
+IMP_Ubiq(){-uitous-}
-{-
-import PrelInfo ( getPrimOpResultInfo, PrimOpResultInfo(..),
- PrimOp, PrimRep
- IF_ATTACK_PRAGMAS(COMMA tagOf_PrimOp)
- IF_ATTACK_PRAGMAS(COMMA pprPrimOp)
- )
-import HsSyn ( HsBinds, HsExpr, GRHS, GRHSsAndBinds, InPat )
-import Type
-import Literal ( literalPrimRep, isLitLitLit,
- Literal(..) -- (..) for pragmas
+import CostCentre ( showCostCentre )
+import Id ( externallyVisibleId, idPrimRep, GenId{-instance NamedThing-} )
+import Literal ( literalPrimRep, isLitLitLit, Literal{-instance Outputable-} )
+import Name ( isSymLexeme )
+import Outputable ( ifPprDebug, interppSP, interpp'SP,
+ Outputable(..){-instance * Bool-}
)
-import Id ( idType, getIdPrimRep, toplevelishId,
- isTopLevId, Id, IdInfo
- )
-import Maybes ( Maybe(..), catMaybes )
-import Outputable
-import Pretty
-import CostCentre ( showCostCentre, CostCentre )
-import UniqSet
-import Util
--}
+import PprStyle ( PprStyle(..) )
+import PprType ( GenType{-instance Outputable-} )
+import Pretty -- all of it
+import PrimOp ( PrimOp{-instance Outputable-} )
+import Unique ( pprUnique )
+import UniqSet ( isEmptyUniqSet, uniqSetToList, SYN_IE(UniqSet) )
+import Util ( panic )
\end{code}
%************************************************************************
data GenStgBinding bndr occ
= StgNonRec bndr (GenStgRhs bndr occ)
| StgRec [(bndr, GenStgRhs bndr occ)]
+ | StgCoerceBinding bndr occ
\end{code}
%************************************************************************
\end{code}
\begin{code}
-getArgPrimRep (StgVarArg local) = getIdPrimRep local
-getArgPrimRep (StgLitArg lit) = literalPrimRep lit
+getArgPrimRep (StgVarArg local) = idPrimRep local
+getArgPrimRep (StgLitArg lit) = literalPrimRep lit
isLitLitArg (StgLitArg x) = isLitLitLit x
isLitLitArg _ = False
latest/greatest pragma info.
\begin{code}
-collectExportedStgBinders
+collectFinalStgBinders
:: [StgBinding] -- input program
- -> [Id] -- exported top-level Ids
+ -> [Id] -- final externally-visible top-level Ids
-collectExportedStgBinders binds
+collectFinalStgBinders binds
= ex [] binds
where
ex es [] = es
ex es ((StgNonRec b _) : binds)
- = if not (isExported b) then
+ = if not (externallyVisibleId b) then
ex es binds
else
ex (b:es) binds
= ppHang (ppCat [ppr sty bndr, ppEquals])
4 (ppBeside (ppr sty rhs) ppSemi)
+pprStgBinding sty (StgCoerceBinding bndr occ)
+ = ppHang (ppCat [ppr sty bndr, ppEquals, ppStr "{-Coerce-}"])
+ 4 (ppBeside (ppr sty occ) ppSemi)
+
pprStgBinding sty (StgRec pairs)
= ppAboves ((ifPprDebug sty (ppStr "{- StgRec -}")) :
(map (ppr_bind sty) pairs))
4 (ppBeside (ppr sty expr) ppSemi)
where
ppr_con sty con
- = if isOpLexeme con
+ = if isSymLexeme con
then ppBesides [ppLparen, ppr sty con, ppRparen]
else ppr sty con
pprStgRhs sty (StgRhsCon cc con args)
= ppBesides [ ppStr (showCostCentre sty True{-as String-} cc),
- ppSP, ppr sty con, ppStr " [", interppSP sty args, ppStr "]" ]
+ ppSP, ppr sty con, ppStr "! [", interppSP sty args, ppStr "]" ]
--------------
pp_binder_info PprForUser _ = ppNil