IdLoop.lhi 2.96 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
Breaks the IdInfo/<everything> loops.

\begin{code}
interface IdLoop where

import PreludePS	( _PackedString )
import PreludeStdIO	( Maybe )

import BinderInfo	( BinderInfo )
import CoreSyn		( CoreExpr(..), GenCoreExpr, GenCoreArg )
import CoreUnfold 	( FormSummary(..), UnfoldingDetails(..), UnfoldingGuidance(..) )
import CoreUtils	( unTagBinders )
import Id		( externallyVisibleId, isDataCon, isWorkerId, isWrapperId,
14
			  unfoldingUnfriendlyId, getIdInfo, nmbrId,
15 16 17 18 19
			  nullIdEnv, lookupIdEnv, IdEnv(..),
			  Id(..), GenId
			)
import IdInfo		( IdInfo )
import Literal		( Literal )
20
import MagicUFs		( mkMagicUnfoldingFun, MagicUnfoldingFun )
21
import Outputable	( Outputable(..) )
22
import PprEnv		( NmbrEnv )
23
import PprStyle		( PprStyle )
24
import PprType		( pprParendGenType )
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
import Pretty		( PrettyRep )
import Type		( GenType )
import TyVar		( GenTyVar )
import UniqFM		( UniqFM )
import Unique		( Unique )
import Usage		( GenUsage )
import Util		( Ord3(..) )
import WwLib		( mAX_WORKER_ARGS )

externallyVisibleId	:: Id	    -> Bool
isDataCon		:: GenId ty -> Bool
isWorkerId		:: GenId ty -> Bool
isWrapperId		:: Id	    -> Bool
unfoldingUnfriendlyId	:: Id	    -> Bool
getIdInfo		:: Id	    -> IdInfo
nullIdEnv		:: UniqFM a
lookupIdEnv		:: UniqFM b -> GenId a -> Maybe b
mAX_WORKER_ARGS		:: Int
43
nmbrId			:: Id -> NmbrEnv -> (NmbrEnv, Id)
44
pprParendGenType		:: (Eq a, Outputable a, Eq b, Outputable b) => PprStyle -> GenType a b -> Int -> Bool -> PrettyRep
45 46
unTagBinders :: GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique), a) b c d -> GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) b c d

47 48
mkMagicUnfoldingFun	:: Unique -> MagicUnfoldingFun

49 50 51 52 53 54 55 56 57 58 59 60 61 62
type IdEnv a = UniqFM a
type CoreExpr = GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique))
			    (GenId (GenType (GenTyVar (GenUsage Unique)) Unique))
			    (GenTyVar (GenUsage Unique)) Unique

instance Outputable UnfoldingGuidance
instance Eq	    Unique
instance Outputable Unique
instance Eq	    (GenTyVar a)
instance Ord3	    (GenTyVar a)
instance Outputable (GenTyVar a)
instance (Outputable a) => Outputable (GenId a)
instance (Eq a, Outputable a, Eq b, Outputable b) => Outputable (GenType a b)

63
data NmbrEnv
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
data MagicUnfoldingFun
data FormSummary   = WhnfForm | BottomForm | OtherForm
data UnfoldingDetails
  = NoUnfoldingDetails
  | LitForm Literal
  | OtherLitForm [Literal]
  | ConForm (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) [GenCoreArg (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) (GenTyVar (GenUsage Unique)) Unique]
  | OtherConForm [GenId (GenType (GenTyVar (GenUsage Unique)) Unique)]
  | GenForm Bool FormSummary (GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique), BinderInfo) (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) (GenTyVar (GenUsage Unique)) Unique) UnfoldingGuidance
  | MagicForm _PackedString MagicUnfoldingFun

data UnfoldingGuidance
  = UnfoldNever
  | UnfoldAlways
  | EssentialUnfolding
  | UnfoldIfGoodArgs Int Int [Bool] Int
  | BadUnfolding
\end{code}