[project @ 1996-02-06 14:32:22 by dnt]
[ghc-hetmet.git] / ghc / compiler / simplCore / SimplEnv.hi
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)
9 import Id(Id)
10 import IdEnv(IdEnv(..))
11 import IdInfo(StrictnessInfo)
12 import MagicUFs(MagicUnfoldingFun)
13 import Maybes(Labda)
14 import Outputable(Outputable)
15 import PreludePS(_PackedString)
16 import PreludeRatio(Ratio(..))
17 import Pretty(PrettyRep)
18 import PrimKind(PrimKind)
19 import PrimOps(PrimOp)
20 import TyVar(TyVar)
21 import TyVarEnv(TyVarEnv(..), nullTyVarEnv)
22 import UniType(UniType)
23 import UniqFM(UniqFM)
24 import Unique(Unique)
25 data BasicLit 
26 data BinderInfo   = DeadCode | ManyOcc Int | OneOcc FunOrArg DuplicationDanger InsideSCC Int Int
27 data DuplicationDanger 
28 data FunOrArg 
29 data InsideSCC 
30 data GlobalSwitch 
31 data SimplifierSwitch 
32 data CoreAtom a 
33 data CoreCaseAlternatives a b 
34 data CoreExpr a b 
35 data EnclosingCcDetails   = NoEnclosingCcDetails | EnclosingCC CostCentre
36 data FormSummary   = WhnfForm | BottomForm | OtherForm
37 data Id 
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
47 type InId = Id
48 type InIdEnv = UniqFM IdVal
49 type InType = UniType
50 type InTypeEnv = UniqFM UniType
51 type InUniType = UniType
52 data MagicUnfoldingFun 
53 data Labda a 
54 type OutAlts = CoreCaseAlternatives Id Id
55 type OutArg = CoreArg Id
56 type OutAtom = CoreAtom Id
57 type OutBinder = Id
58 type OutBinding = CoreBinding Id Id
59 type OutDefault = CoreCaseDefault Id Id
60 type OutExpr = CoreExpr Id Id
61 type OutId = Id
62 type OutType = UniType
63 type OutUniType = UniType
64 data SimplEnv 
65 type SwitchChecker a = a -> SwitchResult
66 data SwitchResult 
67 data TyVar 
68 type TyVarEnv a = UniqFM a
69 data UnfoldConApp 
70 data UnfoldEnv 
71 data UnfoldItem 
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
74 data UniType 
75 data UniqFM a 
76 data Unique 
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
106