Commit 44d91e4c authored by simonpj's avatar simonpj

[project @ 2001-05-14 12:55:11 by simonpj]

Add DEBUG code for CgInfo field of IdInfo
parent ea8abf4c
......@@ -97,6 +97,7 @@ import PrimRep ( PrimRep )
import TysPrim ( statePrimTyCon )
import FieldLabel ( FieldLabel )
import SrcLoc ( SrcLoc )
import Outputable
import Unique ( Unique, mkBuiltinUnique, getBuiltinUniques,
getNumBuiltinUniques )
......@@ -358,7 +359,13 @@ setIdSpecialisation id spec_info = modifyIdInfo (`setSpecInfo` spec_info) id
---------------------------------
-- CG INFO
idCgInfo :: Id -> CgInfo
#ifdef DEBUG
idCgInfo id = case cgInfo (idInfo id) of
NoCgInfo -> pprPanic "idCgInfo" (ppr id)
info -> info
#else
idCgInfo id = cgInfo (idInfo id)
#endif
setIdCgInfo :: Id -> CgInfo -> Id
setIdCgInfo id cg_info = modifyIdInfo (`setCgInfo` cg_info) id
......
......@@ -511,6 +511,15 @@ downstream, by the code generator.
data CgInfo = CgInfo
!Arity -- Exact arity for calling purposes
!CafInfo
#ifdef DEBUG
| NoCgInfo -- In debug mode we don't want a black hole here
-- See Id.idCgInfo
-- noCgInfo is used for local Ids, which shouldn't need any CgInfo
noCgInfo = NoCgInfo
#else
noCgInfo = panic "NoCgInfo!"
#endif
cgArity (CgInfo arity _) = arity
cgCafInfo (CgInfo _ caf_info) = caf_info
......@@ -523,9 +532,6 @@ setCgArity info arity =
case cgInfo info of { CgInfo _ caf_info ->
info `setCgInfo` CgInfo arity caf_info }
-- Used for local Ids, which shouldn't need any CgInfo
noCgInfo = panic "noCgInfo!"
cgMayHaveCafRefs (CgInfo _ caf_info) = mayHaveCafRefs caf_info
seqCg c = c `seq` () -- fields are strict anyhow
......
......@@ -220,6 +220,7 @@ mkDataConWrapId data_con
-- The Cpr info can be important inside INLINE rhss, where the
-- wrapper constructor isn't inlined
`setCgArity` arity
-- The NoCaf-ness is set by noCafNoTyGenIdInfo
`setArityInfo` exactArity arity
-- It's important to specify the arity, so that partial
-- applications are treated as values
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment