1 {-# GHC_PRAGMA INTERFACE VERSION 5 #-}
2 interface SimplEnv where
3 import BasicLit(BasicLit)
4 import BinderInfo(BinderInfo(..), DuplicationDanger, FunOrArg, InsideSCC)
5 import CmdLineOpts(GlobalSwitch, SimplifierSwitch, SwitchResult)
6 import CoreSyn(CoreArg, CoreAtom, CoreBinding, CoreCaseAlternatives, CoreCaseDefault, CoreExpr)
7 import CostCentre(CostCentre)
8 import FiniteMap(FiniteMap)
10 import IdEnv(IdEnv(..))
11 import IdInfo(StrictnessInfo)
12 import MagicUFs(MagicUnfoldingFun)
14 import Outputable(Outputable)
15 import PreludePS(_PackedString)
16 import PreludeRatio(Ratio(..))
17 import Pretty(PrettyRep)
18 import PrimKind(PrimKind)
19 import PrimOps(PrimOp)
21 import TyVarEnv(TyVarEnv(..), nullTyVarEnv)
22 import UniType(UniType)
26 data BinderInfo = DeadCode | ManyOcc Int | OneOcc FunOrArg DuplicationDanger InsideSCC Int Int
27 data DuplicationDanger
33 data CoreCaseAlternatives a b
35 data EnclosingCcDetails = NoEnclosingCcDetails | EnclosingCC CostCentre
36 data FormSummary = WhnfForm | BottomForm | OtherForm
38 type IdEnv a = UniqFM a
39 data IdVal = InlineIt (UniqFM IdVal) (UniqFM UniType) (CoreExpr (Id, BinderInfo) Id) | ItsAnAtom (CoreAtom Id)
40 type InAlts = CoreCaseAlternatives (Id, BinderInfo) Id
41 type InArg = CoreArg Id
42 type InAtom = CoreAtom Id
43 type InBinder = (Id, BinderInfo)
44 type InBinding = CoreBinding (Id, BinderInfo) Id
45 type InDefault = CoreCaseDefault (Id, BinderInfo) Id
46 type InExpr = CoreExpr (Id, BinderInfo) Id
48 type InIdEnv = UniqFM IdVal
50 type InTypeEnv = UniqFM UniType
51 type InUniType = UniType
52 data MagicUnfoldingFun
54 type OutAlts = CoreCaseAlternatives Id Id
55 type OutArg = CoreArg Id
56 type OutAtom = CoreAtom Id
58 type OutBinding = CoreBinding Id Id
59 type OutDefault = CoreCaseDefault Id Id
60 type OutExpr = CoreExpr Id Id
62 type OutType = UniType
63 type OutUniType = UniType
65 type SwitchChecker a = a -> SwitchResult
68 type TyVarEnv a = UniqFM a
72 data UnfoldingDetails = NoUnfoldingDetails | LiteralForm BasicLit | OtherLiteralForm [BasicLit] | ConstructorForm Id [UniType] [CoreAtom Id] | OtherConstructorForm [Id] | GeneralForm Bool FormSummary (CoreExpr (Id, BinderInfo) Id) UnfoldingGuidance | MagicForm _PackedString MagicUnfoldingFun | IWantToBeINLINEd UnfoldingGuidance
73 data UnfoldingGuidance = UnfoldNever | UnfoldAlways | EssentialUnfolding | UnfoldIfGoodArgs Int Int [Bool] Int | BadUnfolding
77 extendIdEnvWithAtom :: SimplEnv -> (Id, BinderInfo) -> CoreAtom Id -> SimplEnv
78 extendIdEnvWithAtomList :: SimplEnv -> [((Id, BinderInfo), CoreAtom Id)] -> SimplEnv
79 extendIdEnvWithClone :: SimplEnv -> (Id, BinderInfo) -> Id -> SimplEnv
80 extendIdEnvWithClones :: SimplEnv -> [(Id, BinderInfo)] -> [Id] -> SimplEnv
81 extendIdEnvWithInlining :: SimplEnv -> SimplEnv -> (Id, BinderInfo) -> CoreExpr (Id, BinderInfo) Id -> SimplEnv
82 extendTyEnv :: SimplEnv -> TyVar -> UniType -> SimplEnv
83 extendTyEnvList :: SimplEnv -> [(TyVar, UniType)] -> SimplEnv
84 extendUnfoldEnvGivenConstructor :: SimplEnv -> Id -> Id -> [Id] -> SimplEnv
85 extendUnfoldEnvGivenFormDetails :: SimplEnv -> Id -> UnfoldingDetails -> SimplEnv
86 extendUnfoldEnvGivenRhs :: SimplEnv -> (Id, BinderInfo) -> Id -> CoreExpr Id Id -> SimplEnv
87 filterUnfoldEnvForInlines :: SimplEnv -> SimplEnv
88 getSwitchChecker :: SimplEnv -> SimplifierSwitch -> SwitchResult
89 lookForConstructor :: SimplEnv -> Id -> [UniType] -> [CoreAtom Id] -> Labda Id
90 lookupId :: SimplEnv -> Id -> Labda IdVal
91 lookupUnfolding :: SimplEnv -> Id -> UnfoldingDetails
92 mkFormSummary :: StrictnessInfo -> CoreExpr a Id -> FormSummary
93 nullInEnvs :: (UniqFM UniType, UniqFM IdVal)
94 nullSimplEnv :: (SimplifierSwitch -> SwitchResult) -> SimplEnv
95 nullTyVarEnv :: UniqFM a
96 pprSimplEnv :: SimplEnv -> Int -> Bool -> PrettyRep
97 replaceInEnvs :: SimplEnv -> (UniqFM UniType, UniqFM IdVal) -> SimplEnv
98 setEnclosingCC :: SimplEnv -> EnclosingCcDetails -> SimplEnv
99 simplTy :: SimplEnv -> UniType -> UniType
100 simplTyInId :: SimplEnv -> Id -> Id
101 switchIsSet :: SimplEnv -> SimplifierSwitch -> Bool
102 instance Eq UnfoldConApp
103 instance Ord UnfoldConApp
104 instance Outputable FormSummary
105 instance Outputable UnfoldingGuidance