[project @ 2000-07-11 16:24:57 by simonmar]
[ghc-hetmet.git] / ghc / compiler / stgSyn / StgSyn.lhs
index 759c174..2f0fc0b 100644 (file)
@@ -33,7 +33,7 @@ module StgSyn (
 
        pprStgBinding, pprStgBindings, pprStgBindingsWithSRTs,
        getArgPrimRep,
-       isLitLitArg, isDynArg, isStgTypeArg,
+       isLitLitArg, isDllConApp, isStgTypeArg,
        stgArity, stgArgType,
        collectFinalStgBinders
 
@@ -46,11 +46,10 @@ module StgSyn (
 
 import CostCentre      ( CostCentreStack, CostCentre )
 import Id              ( Id, idName, idPrimRep, idType )
-import Name            ( isDynName )
+import Name            ( isDllName )
 import Literal         ( Literal, literalType, isLitLitLit, literalPrimRep )
-import DataCon         ( DataCon, isDynDataCon, isNullaryDataCon )
+import DataCon         ( DataCon, dataConName )
 import PrimOp          ( PrimOp )
-import PrimRep         ( PrimRep(..) )
 import Outputable
 import Type             ( Type )
 import UniqSet         ( isEmptyUniqSet, uniqSetToList, UniqSet )
@@ -96,10 +95,16 @@ isLitLitArg _                   = False
 isStgTypeArg (StgTypeArg _) = True
 isStgTypeArg other         = False
 
-isDynArg :: StgArg -> Bool
-       -- Does this argument refer to something in a DLL?
-isDynArg (StgVarArg v)   = isDynName (idName v)
-isDynArg (StgLitArg lit) = isLitLitLit lit
+isDllArg :: StgArg -> Bool
+       -- Does this argument refer to something in a different DLL?
+isDllArg (StgVarArg v)   = isDllName (idName v)
+isDllArg (StgLitArg lit) = isLitLitLit lit
+
+isDllConApp :: DataCon -> [StgArg] -> Bool
+       -- Does this constructor application refer to 
+       -- anything in a different DLL?
+       -- If so, we can't allocate it statically
+isDllConApp con args = isDllName (dataConName con) || any isDllArg args
 
 stgArgType :: StgArg -> Type
        -- Very half baked becase we have lost the type arguments
@@ -600,7 +605,7 @@ pprStgArg :: (Outputable bdee) => GenStgArg bdee -> SDoc
 
 pprStgArg (StgVarArg var) = ppr var
 pprStgArg (StgLitArg con) = ppr con
-pprStgARg (StgTypeArg ty) = char '@' <+> ppr ty
+pprStgArg (StgTypeArg ty) = char '@' <+> ppr ty
 \end{code}
 
 \begin{code}