IdLoop.lhi 3.15 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 OccurAnal	( occurAnalyseGlobalExpr )
22
import Outputable	( Outputable(..) )
23
import PprEnv		( NmbrEnv )
24
import PprStyle		( PprStyle )
25
import PprType		( pprParendGenType )
26
27
28
29
30
31
32
33
34
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 )

35
occurAnalyseGlobalExpr  :: GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) (GenTyVar (GenUsage Unique)) Unique -> GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique), BinderInfo) (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) (GenTyVar (GenUsage Unique)) Unique
36
37
38
39
40
41
42
43
44
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
45
nmbrId			:: Id -> NmbrEnv -> (NmbrEnv, Id)
46
pprParendGenType		:: (Eq a, Outputable a, Eq b, Outputable b) => PprStyle -> GenType a b -> Int -> Bool -> PrettyRep
47
48
unTagBinders :: GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique), a) b c d -> GenCoreExpr (GenId (GenType (GenTyVar (GenUsage Unique)) Unique)) b c d

49
50
mkMagicUnfoldingFun	:: Unique -> MagicUnfoldingFun

51
52
53
54
55
56
57
58
59
60
61
62
63
64
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)

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

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