summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
diff options
context:
space:
mode:
authorsimonm <unknown>1999-04-26 16:06:37 +0000
committersimonm <unknown>1999-04-26 16:06:37 +0000
commitaae367819798b0883de61ea4d91ea2c47452884e (patch)
tree0c3d4a88ea258bc061e5a4b7f60c6ddf250a795e /ghc/compiler/codeGen
parent0755a7d9a4ba807d3a5d47ac84224bd146882a08 (diff)
downloadhaskell-aae367819798b0883de61ea4d91ea2c47452884e.tar.gz
[project @ 1999-04-26 16:06:27 by simonm]
- New Wired-in Id: getTag# :: a -> Int# for a data type, returns the tag of the constructor. for a function, returns a spurious number probably. dataToTag# is the name of the underlying primitive which pulls out the tag (its argument is assumed to be evaluated). - Generate constructor tables for enumerated types, so we can do tagToEnum#. - Remove hacks in CoreToStg for dataToTag#.
Diffstat (limited to 'ghc/compiler/codeGen')
-rw-r--r--ghc/compiler/codeGen/CgConTbls.lhs12
1 files changed, 9 insertions, 3 deletions
diff --git a/ghc/compiler/codeGen/CgConTbls.lhs b/ghc/compiler/codeGen/CgConTbls.lhs
index 12c50649ff..99d286ea7c 100644
--- a/ghc/compiler/codeGen/CgConTbls.lhs
+++ b/ghc/compiler/codeGen/CgConTbls.lhs
@@ -12,7 +12,7 @@ import AbsCSyn
import CgMonad
import StgSyn ( SRT(..) )
-import AbsCUtils ( mkAbstractCs )
+import AbsCUtils ( mkAbstractCs, mkAbsCStmts )
import CgTailCall ( performReturn, mkStaticAlgReturnCode )
import CLabel ( mkConEntryLabel, mkStaticClosureLabel )
import ClosureInfo ( layOutStaticClosure, layOutDynCon,
@@ -24,7 +24,7 @@ import DataCon ( DataCon, dataConName, dataConRawArgTys )
import Const ( Con(..) )
import Name ( getOccString )
import PrimRep ( getPrimRepSize, PrimRep(..) )
-import TyCon ( tyConDataCons, TyCon )
+import TyCon ( tyConDataCons, isEnumerationTyCon, TyCon )
import Type ( typePrimRep, Type )
import BasicTypes ( TopLevelFlag(..) )
import Outputable
@@ -96,7 +96,13 @@ genStaticConBits comp_info gen_tycons tycon_specs
where
gen_for_tycon :: TyCon -> AbstractC
gen_for_tycon tycon
- = mkAbstractCs (map (genConInfo comp_info tycon) (tyConDataCons tycon))
+ = mkAbstractCs (map (genConInfo comp_info tycon) (tyConDataCons tycon))
+ `mkAbsCStmts` (
+ -- after the con decls, so we don't need to declare the constructor labels
+ if (isEnumerationTyCon tycon)
+ then CClosureTbl tycon
+ else AbsCNop
+ )
\end{code}
%************************************************************************