X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FIdInfo.lhs;h=a3124f359489c50c166d092602a503aa3847304c;hb=6758ba711a3f9f3100a9dba1818b131c32e62106;hp=38e2a2efb0d67bb7dd729fc13e714e623f23b51a;hpb=7e84448c9ed32f4fdc3de3155913bafd416898af;p=ghc-hetmet.git diff --git a/compiler/basicTypes/IdInfo.lhs b/compiler/basicTypes/IdInfo.lhs index 38e2a2e..a3124f3 100644 --- a/compiler/basicTypes/IdInfo.lhs +++ b/compiler/basicTypes/IdInfo.lhs @@ -71,7 +71,10 @@ module IdInfo ( CafInfo(..), cafInfo, ppCafInfo, setCafInfo, mayHaveCafRefs, -- Lambda-bound variable info - LBVarInfo(..), lbvarInfo, setLBVarInfo, noLBVarInfo, hasNoLBVarInfo + LBVarInfo(..), lbvarInfo, setLBVarInfo, noLBVarInfo, hasNoLBVarInfo, + + -- Tick-box info + TickBoxOp(..), TickBoxId, ) where #include "HsVersions.h" @@ -87,6 +90,7 @@ import TyCon import ForeignCall import NewDemand import Outputable +import Module import Data.Maybe @@ -215,7 +219,7 @@ seqNewDemandInfo (Just dmd) = seqDemand dmd %************************************************************************ %* * -\subsection{GlobalIdDetails +\subsection{GlobalIdDetails} %* * %************************************************************************ @@ -228,7 +232,8 @@ data GlobalIdDetails = VanillaGlobal -- Imported from elsewhere, a default method Id. | RecordSelId -- The Id for a record selector - { sel_tycon :: TyCon + { sel_tycon :: TyCon -- For a data type family, this is the *instance* TyCon + -- not the family TyCon , sel_label :: FieldLabel , sel_naughty :: Bool -- True <=> naughty } -- See Note [Naughty record selectors] @@ -246,6 +251,8 @@ data GlobalIdDetails | PrimOpId PrimOp -- The Id for a primitive operator | FCallId ForeignCall -- The Id for a foreign call + | TickBoxOpId TickBoxOp -- The Id for a tick box (both traditional and binary) + | NotGlobalId -- Used as a convenient extra return value from globalIdDetails notGlobalId = NotGlobalId @@ -258,6 +265,7 @@ instance Outputable GlobalIdDetails where ppr (ClassOpId _) = ptext SLIT("[ClassOp]") ppr (PrimOpId _) = ptext SLIT("[PrimOp]") ppr (FCallId _) = ptext SLIT("[ForeignCall]") + ppr (TickBoxOpId _) = ptext SLIT("[TickBoxOp]") ppr (RecordSelId {}) = ptext SLIT("[RecSel]") \end{code} @@ -456,9 +464,11 @@ type InlinePragInfo = Activation %************************************************************************ \begin{code} --- CoreRules is used only in an idSpecialisation (move to IdInfo?) data SpecInfo - = SpecInfo [CoreRule] VarSet -- Locally-defined free vars of RHSs + = SpecInfo + [CoreRule] + VarSet -- Locally-defined free vars of *both* LHS and RHS of rules + -- Note [Rule dependency info] emptySpecInfo :: SpecInfo emptySpecInfo = SpecInfo [] emptyVarSet @@ -475,6 +485,17 @@ specInfoRules (SpecInfo rules _) = rules seqSpecInfo (SpecInfo rules fvs) = seqRules rules `seq` seqVarSet fvs \end{code} +Note [Rule dependency info] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +THe VarSet in a SpecInfo is used for dependency analysis in the +occurrence analyser. We must track free vars in *both* lhs and rhs. Why both? +Consider + x = y + RULE f x = 4 +Then if we substitute y for x, we'd better do so in the + rule's LHS too, so we'd better ensure the dependency is respsected + + %************************************************************************ %* * @@ -695,6 +716,25 @@ zapDemandInfo info@(IdInfo {newDemandInfo = dmd}) \begin{code} zapFragileInfo :: IdInfo -> Maybe IdInfo +-- Zap info that depends on free variables zapFragileInfo info = Just (info `setSpecInfo` emptySpecInfo + `setWorkerInfo` NoWorker `setUnfoldingInfo` NoUnfolding) \end{code} + +%************************************************************************ +%* * +\subsection{TickBoxOp} +%* * +%************************************************************************ + +\begin{code} +type TickBoxId = Int + +data TickBoxOp + = TickBox Module {-# UNPACK #-} !TickBoxId + -- ^Tick box for Hpc-style coverage + +instance Outputable TickBoxOp where + ppr (TickBox mod n) = ptext SLIT("tick") <+> ppr (mod,n) +\end{code}