SimplEnv

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

SimplEnv

Contents

- The simplifier mode
- Environments
- Substitution results
- Simplifying `Id` binders
- Floats
- LetFloats
- JoinFloats

Synopsis

- setMode :: SimplMode -> SimplEnv -> SimplEnv
- getMode :: SimplEnv -> SimplMode
- updMode :: (SimplMode -> SimplMode) -> SimplEnv -> SimplEnv
- seDynFlags :: SimplEnv -> DynFlags
- data SimplEnv = SimplEnv {
  - seMode :: SimplMode
  - seTvSubst :: TvSubstEnv
  - seCvSubst :: CvSubstEnv
  - seIdSubst :: SimplIdSubst
  - seInScope :: InScopeSet
  }
- pprSimplEnv :: SimplEnv -> SDoc
- mkSimplEnv :: SimplMode -> SimplEnv
- extendIdSubst :: SimplEnv -> Id -> SimplSR -> SimplEnv
- extendTvSubst :: SimplEnv -> TyVar -> Type -> SimplEnv
- extendCvSubst :: SimplEnv -> CoVar -> Coercion -> SimplEnv
- zapSubstEnv :: SimplEnv -> SimplEnv
- setSubstEnv :: SimplEnv -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> SimplEnv
- getInScope :: SimplEnv -> InScopeSet
- setInScopeFromE :: SimplEnv -> SimplEnv -> SimplEnv
- setInScopeFromF :: SimplEnv -> SimplFloats -> SimplEnv
- setInScopeSet :: SimplEnv -> InScopeSet -> SimplEnv
- modifyInScope :: SimplEnv -> CoreBndr -> SimplEnv
- addNewInScopeIds :: SimplEnv -> [CoreBndr] -> SimplEnv
- getSimplRules :: SimplM RuleEnv
- data SimplSR
  - = DoneEx OutExpr (Maybe JoinArity)
  - | DoneId OutId
  - | ContEx TvSubstEnv CvSubstEnv SimplIdSubst InExpr
- mkContEx :: SimplEnv -> InExpr -> SimplSR
- substId :: SimplEnv -> InId -> SimplSR
- lookupRecBndr :: SimplEnv -> InId -> OutId
- refineFromInScope :: InScopeSet -> Var -> Var
- simplNonRecBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
- simplNonRecJoinBndr :: SimplEnv -> OutType -> InBndr -> SimplM (SimplEnv, OutBndr)
- simplRecBndrs :: SimplEnv -> [InBndr] -> SimplM SimplEnv
- simplRecJoinBndrs :: SimplEnv -> OutType -> [InBndr] -> SimplM SimplEnv
- simplBinder :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
- simplBinders :: SimplEnv -> [InBndr] -> SimplM (SimplEnv, [OutBndr])
- substTy :: SimplEnv -> Type -> Type
- substTyVar :: SimplEnv -> TyVar -> Type
- getTCvSubst :: SimplEnv -> TCvSubst
- substCo :: SimplEnv -> Coercion -> Coercion
- substCoVar :: SimplEnv -> CoVar -> Coercion
- data SimplFloats = SimplFloats {
  - sfLetFloats :: LetFloats
  - sfJoinFloats :: JoinFloats
  - sfInScope :: InScopeSet
  }
- emptyFloats :: SimplEnv -> SimplFloats
- mkRecFloats :: SimplFloats -> SimplFloats
- mkFloatBind :: SimplEnv -> OutBind -> (SimplFloats, SimplEnv)
- addLetFloats :: SimplFloats -> LetFloats -> SimplFloats
- addJoinFloats :: SimplFloats -> JoinFloats -> SimplFloats
- addFloats :: SimplFloats -> SimplFloats -> SimplFloats
- extendFloats :: SimplFloats -> OutBind -> SimplFloats
- wrapFloats :: SimplFloats -> OutExpr -> OutExpr
- doFloatFromRhs :: TopLevelFlag -> RecFlag -> Bool -> SimplFloats -> OutExpr -> Bool
- getTopFloatBinds :: SimplFloats -> [CoreBind]
- data LetFloats
- letFloatBinds :: LetFloats -> [CoreBind]
- emptyLetFloats :: LetFloats
- unitLetFloat :: OutBind -> LetFloats
- addLetFlts :: LetFloats -> LetFloats -> LetFloats
- mapLetFloats :: LetFloats -> ((Id, CoreExpr) -> (Id, CoreExpr)) -> LetFloats
- type JoinFloat = OutBind
- type JoinFloats = OrdList JoinFloat
- emptyJoinFloats :: JoinFloats
- wrapJoinFloats :: JoinFloats -> OutExpr -> OutExpr
- wrapJoinFloatsX :: SimplFloats -> OutExpr -> (SimplFloats, OutExpr)
- unitJoinFloat :: OutBind -> JoinFloats
- addJoinFlts :: JoinFloats -> JoinFloats -> JoinFloats

# The simplifier mode

setMode :: SimplMode -> SimplEnv -> SimplEnv #

getMode :: SimplEnv -> SimplMode #

updMode :: (SimplMode -> SimplMode) -> SimplEnv -> SimplEnv #

seDynFlags :: SimplEnv -> DynFlags #

# Environments

data SimplEnv #

Constructors

SimplEnv |
Fields seMode :: SimplMode seTvSubst :: TvSubstEnv seCvSubst :: CvSubstEnv seIdSubst :: SimplIdSubst seInScope :: InScopeSet

pprSimplEnv :: SimplEnv -> SDoc #

mkSimplEnv :: SimplMode -> SimplEnv #

extendIdSubst :: SimplEnv -> Id -> SimplSR -> SimplEnv #

extendTvSubst :: SimplEnv -> TyVar -> Type -> SimplEnv #

extendCvSubst :: SimplEnv -> CoVar -> Coercion -> SimplEnv #

zapSubstEnv :: SimplEnv -> SimplEnv #

setSubstEnv :: SimplEnv -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> SimplEnv #

getInScope :: SimplEnv -> InScopeSet #

setInScopeFromE :: SimplEnv -> SimplEnv -> SimplEnv #

setInScopeFromF :: SimplEnv -> SimplFloats -> SimplEnv #

setInScopeSet :: SimplEnv -> InScopeSet -> SimplEnv #

modifyInScope :: SimplEnv -> CoreBndr -> SimplEnv #

addNewInScopeIds :: SimplEnv -> [CoreBndr] -> SimplEnv #

getSimplRules :: SimplM RuleEnv #

# Substitution results

data SimplSR #

A substitution result.

Constructors

DoneEx OutExpr (Maybe JoinArity) |
DoneId OutId |
ContEx TvSubstEnv CvSubstEnv SimplIdSubst InExpr |

Instances

Outputable SimplSR # |
Instance details Defined in SimplEnv Methods ppr :: SimplSR -> SDoc # pprPrec :: Rational -> SimplSR -> SDoc #

mkContEx :: SimplEnv -> InExpr -> SimplSR #

substId :: SimplEnv -> InId -> SimplSR #

lookupRecBndr :: SimplEnv -> InId -> OutId #

refineFromInScope :: InScopeSet -> Var -> Var #

# Simplifying `Id` binders

simplNonRecBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr) #

simplNonRecJoinBndr :: SimplEnv -> OutType -> InBndr -> SimplM (SimplEnv, OutBndr) #

simplRecBndrs :: SimplEnv -> [InBndr] -> SimplM SimplEnv #

simplRecJoinBndrs :: SimplEnv -> OutType -> [InBndr] -> SimplM SimplEnv #

simplBinder :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr) #

simplBinders :: SimplEnv -> [InBndr] -> SimplM (SimplEnv, [OutBndr]) #

substTy :: SimplEnv -> Type -> Type #

substTyVar :: SimplEnv -> TyVar -> Type #

getTCvSubst :: SimplEnv -> TCvSubst #

substCo :: SimplEnv -> Coercion -> Coercion #

substCoVar :: SimplEnv -> CoVar -> Coercion #

# Floats

data SimplFloats #

Constructors

SimplFloats |
Fields sfLetFloats :: LetFloats sfJoinFloats :: JoinFloats sfInScope :: InScopeSet

Instances

Outputable SimplFloats # |
Instance details Defined in SimplEnv Methods ppr :: SimplFloats -> SDoc # pprPrec :: Rational -> SimplFloats -> SDoc #

emptyFloats :: SimplEnv -> SimplFloats #

mkRecFloats :: SimplFloats -> SimplFloats #

mkFloatBind :: SimplEnv -> OutBind -> (SimplFloats, SimplEnv) #

addLetFloats :: SimplFloats -> LetFloats -> SimplFloats #

addJoinFloats :: SimplFloats -> JoinFloats -> SimplFloats #

addFloats :: SimplFloats -> SimplFloats -> SimplFloats #

extendFloats :: SimplFloats -> OutBind -> SimplFloats #

wrapFloats :: SimplFloats -> OutExpr -> OutExpr #

doFloatFromRhs :: TopLevelFlag -> RecFlag -> Bool -> SimplFloats -> OutExpr -> Bool #

getTopFloatBinds :: SimplFloats -> [CoreBind] #

# LetFloats

data LetFloats #

Instances

Outputable LetFloats # |
Instance details Defined in SimplEnv Methods ppr :: LetFloats -> SDoc # pprPrec :: Rational -> LetFloats -> SDoc #

letFloatBinds :: LetFloats -> [CoreBind] #

emptyLetFloats :: LetFloats #

unitLetFloat :: OutBind -> LetFloats #

addLetFlts :: LetFloats -> LetFloats -> LetFloats #

mapLetFloats :: LetFloats -> ((Id, CoreExpr) -> (Id, CoreExpr)) -> LetFloats #

# JoinFloats

type JoinFloat = OutBind #

type JoinFloats = OrdList JoinFloat #

emptyJoinFloats :: JoinFloats #

wrapJoinFloats :: JoinFloats -> OutExpr -> OutExpr #

wrapJoinFloatsX :: SimplFloats -> OutExpr -> (SimplFloats, OutExpr) #

unitJoinFloat :: OutBind -> JoinFloats #

addJoinFlts :: JoinFloats -> JoinFloats -> JoinFloats #