StgSyn

ghc-8.10.5: The GHC API

Safe Haskell | None
Language | Haskell2010

StgSyn

Synopsis

- data StgArg
  - = StgVarArg Id
  - | StgLitArg Literal
- data GenStgTopBinding pass
  - = StgTopLifted (GenStgBinding pass)
  - | StgTopStringLit Id ByteString
- data GenStgBinding pass
  - = StgNonRec (BinderP pass) (GenStgRhs pass)
  - | StgRec [(BinderP pass, GenStgRhs pass)]
- data GenStgExpr pass
  - = StgApp Id [StgArg]
  - | StgLit Literal
  - | StgConApp DataCon [StgArg] [Type]
  - | StgOpApp StgOp [StgArg] Type
  - | StgLam (NonEmpty (BinderP pass)) StgExpr
  - | StgCase (GenStgExpr pass) (BinderP pass) AltType [GenStgAlt pass]
  - | StgLet (XLet pass) (GenStgBinding pass) (GenStgExpr pass)
  - | StgLetNoEscape (XLetNoEscape pass) (GenStgBinding pass) (GenStgExpr pass)
  - | StgTick (Tickish Id) (GenStgExpr pass)
- data GenStgRhs pass
  - = StgRhsClosure (XRhsClosure pass) CostCentreStack !UpdateFlag [BinderP pass] (GenStgExpr pass)
  - | StgRhsCon CostCentreStack DataCon [StgArg]
- type GenStgAlt pass = (AltCon, [BinderP pass], GenStgExpr pass)
- data AltType
  - = PolyAlt
  - | MultiValAlt Int
  - | AlgAlt TyCon
  - | PrimAlt PrimRep
- data StgPass
  - = Vanilla
  - | LiftLams
  - | CodeGen
- type family BinderP (pass :: StgPass)
- type family XRhsClosure (pass :: StgPass)
- type family XLet (pass :: StgPass)
- type family XLetNoEscape (pass :: StgPass)
- data NoExtFieldSilent
- noExtFieldSilent :: NoExtFieldSilent
- type OutputablePass pass = (Outputable (XLet pass), Outputable (XLetNoEscape pass), Outputable (XRhsClosure pass), OutputableBndr (BinderP pass))
- data UpdateFlag
  - = ReEntrant
  - | Updatable
  - | SingleEntry
- isUpdatable :: UpdateFlag -> Bool
- type StgTopBinding = GenStgTopBinding 'Vanilla
- type StgBinding = GenStgBinding 'Vanilla
- type StgExpr = GenStgExpr 'Vanilla
- type StgRhs = GenStgRhs 'Vanilla
- type StgAlt = GenStgAlt 'Vanilla
- type CgStgTopBinding = GenStgTopBinding 'CodeGen
- type CgStgBinding = GenStgBinding 'CodeGen
- type CgStgExpr = GenStgExpr 'CodeGen
- type CgStgRhs = GenStgRhs 'CodeGen
- type CgStgAlt = GenStgAlt 'CodeGen
- type LlStgTopBinding = GenStgTopBinding 'LiftLams
- type LlStgBinding = GenStgBinding 'LiftLams
- type LlStgExpr = GenStgExpr 'LiftLams
- type LlStgRhs = GenStgRhs 'LiftLams
- type LlStgAlt = GenStgAlt 'LiftLams
- type InStgArg = StgArg
- type InStgTopBinding = StgTopBinding
- type InStgBinding = StgBinding
- type InStgExpr = StgExpr
- type InStgRhs = StgRhs
- type InStgAlt = StgAlt
- type OutStgArg = StgArg
- type OutStgTopBinding = StgTopBinding
- type OutStgBinding = StgBinding
- type OutStgExpr = StgExpr
- type OutStgRhs = StgRhs
- type OutStgAlt = StgAlt
- data StgOp
  - = StgPrimOp PrimOp
  - | StgPrimCallOp PrimCall
  - | StgFCallOp ForeignCall Type
- topStgBindHasCafRefs :: GenStgTopBinding pass -> Bool
- stgArgHasCafRefs :: StgArg -> Bool
- stgRhsArity :: StgRhs -> Int
- isDllConApp :: DynFlags -> Module -> DataCon -> [StgArg] -> Bool
- stgArgType :: StgArg -> Type
- stripStgTicksTop :: (Tickish Id -> Bool) -> GenStgExpr p -> ([Tickish Id], GenStgExpr p)
- stripStgTicksTopE :: (Tickish Id -> Bool) -> GenStgExpr p -> GenStgExpr p
- stgCaseBndrInScope :: AltType -> Bool -> Bool
- pprStgBinding :: StgBinding -> SDoc
- pprGenStgTopBindings :: OutputablePass pass => [GenStgTopBinding pass] -> SDoc
- pprStgTopBindings :: [StgTopBinding] -> SDoc

# Documentation

data StgArg Source #

Constructors

StgVarArg Id |
StgLitArg Literal |

#### Instances

Instances details

Outputable StgArg # |
Instance details Defined in StgSyn Methods ppr :: StgArg -> SDoc Source # pprPrec :: Rational -> StgArg -> SDoc Source #

data GenStgTopBinding pass Source #

A top-level binding.

Constructors

StgTopLifted (GenStgBinding pass) |
StgTopStringLit Id ByteString |

#### Instances

Instances details

OutputablePass pass => Outputable (GenStgTopBinding pass) # |
Instance details Defined in StgSyn Methods ppr :: GenStgTopBinding pass -> SDoc Source # pprPrec :: Rational -> GenStgTopBinding pass -> SDoc Source #

data GenStgBinding pass Source #

Constructors

StgNonRec (BinderP pass) (GenStgRhs pass) |
StgRec [(BinderP pass, GenStgRhs pass)] |

#### Instances

Instances details

OutputablePass pass => Outputable (GenStgBinding pass) # |
Instance details Defined in StgSyn Methods ppr :: GenStgBinding pass -> SDoc Source # pprPrec :: Rational -> GenStgBinding pass -> SDoc Source #

data GenStgExpr pass Source #

Constructors

StgApp Id [StgArg] |
StgLit Literal |
StgConApp DataCon [StgArg] [Type] |
StgOpApp StgOp [StgArg] Type |
StgLam (NonEmpty (BinderP pass)) StgExpr |
StgCase (GenStgExpr pass) (BinderP pass) AltType [GenStgAlt pass] |
StgLet (XLet pass) (GenStgBinding pass) (GenStgExpr pass) |
StgLetNoEscape (XLetNoEscape pass) (GenStgBinding pass) (GenStgExpr pass) |
StgTick (Tickish Id) (GenStgExpr pass) |

#### Instances

Instances details

OutputablePass pass => Outputable (GenStgExpr pass) # |
Instance details Defined in StgSyn Methods ppr :: GenStgExpr pass -> SDoc Source # pprPrec :: Rational -> GenStgExpr pass -> SDoc Source #

data GenStgRhs pass Source #

Constructors

StgRhsClosure |
Fields (XRhsClosure pass) Extension point for non-global free var list just before `CodeGen`. CostCentreStack CCS to be attached (default is CurrentCCS) !UpdateFlag `ReEntrant` | `Updatable` | `SingleEntry` [BinderP pass] arguments; if empty, then not a function; as above, order is important. (GenStgExpr pass) body
StgRhsCon CostCentreStack DataCon [StgArg] |

#### Instances

Instances details

OutputablePass pass => Outputable (GenStgRhs pass) # |
Instance details Defined in StgSyn Methods ppr :: GenStgRhs pass -> SDoc Source # pprPrec :: Rational -> GenStgRhs pass -> SDoc Source #

type GenStgAlt pass = (AltCon, [BinderP pass], GenStgExpr pass) Source #

data AltType Source #

Constructors

PolyAlt |
MultiValAlt Int |
AlgAlt TyCon |
PrimAlt PrimRep |

#### Instances

Instances details

Outputable AltType # |
Instance details Defined in StgSyn Methods ppr :: AltType -> SDoc Source # pprPrec :: Rational -> AltType -> SDoc Source #

data StgPass Source #

Used as a data type index for the stgSyn AST

Constructors

Vanilla |
LiftLams |
CodeGen |

type family BinderP (pass :: StgPass) Source #

#### Instances

Instances details

type BinderP 'Vanilla # |
Instance details Defined in StgSyn type BinderP 'Vanilla = Id
type BinderP 'LiftLams # |
Instance details Defined in StgLiftLams.Analysis type BinderP 'LiftLams = BinderInfo
type BinderP 'CodeGen # |
Instance details Defined in StgSyn type BinderP 'CodeGen = Id

type family XRhsClosure (pass :: StgPass) Source #

#### Instances

Instances details

type XRhsClosure 'Vanilla # |
Instance details Defined in StgSyn type XRhsClosure 'Vanilla = NoExtFieldSilent
type XRhsClosure 'LiftLams # |
Instance details Defined in StgLiftLams.Analysis type XRhsClosure 'LiftLams = DIdSet
type XRhsClosure 'CodeGen # | Code gen needs to track non-global free vars
Instance details Defined in StgSyn type XRhsClosure 'CodeGen = DIdSet

type family XLet (pass :: StgPass) Source #

#### Instances

Instances details

type XLet 'Vanilla # |
Instance details Defined in StgSyn type XLet 'Vanilla = NoExtFieldSilent
type XLet 'LiftLams # |
Instance details Defined in StgLiftLams.Analysis type XLet 'LiftLams = Skeleton
type XLet 'CodeGen # |
Instance details Defined in StgSyn type XLet 'CodeGen = NoExtFieldSilent

type family XLetNoEscape (pass :: StgPass) Source #

#### Instances

Instances details

type XLetNoEscape 'Vanilla # |
Instance details Defined in StgSyn type XLetNoEscape 'Vanilla = NoExtFieldSilent
type XLetNoEscape 'LiftLams # |
Instance details Defined in StgLiftLams.Analysis type XLetNoEscape 'LiftLams = Skeleton
type XLetNoEscape 'CodeGen # |
Instance details Defined in StgSyn type XLetNoEscape 'CodeGen = NoExtFieldSilent

data NoExtFieldSilent Source #

Like `NoExtField`, but with an `Outputable` instance that returns `empty`.

#### Instances

Instances details

Eq NoExtFieldSilent # |
Instance details Defined in StgSyn Methods (==) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool # (/=) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool #
Data NoExtFieldSilent # |
Instance details Defined in StgSyn Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NoExtFieldSilent -> c NoExtFieldSilent Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NoExtFieldSilent Source # toConstr :: NoExtFieldSilent -> Constr Source # dataTypeOf :: NoExtFieldSilent -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NoExtFieldSilent) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NoExtFieldSilent) Source # gmapT :: (forall b. Data b => b -> b) -> NoExtFieldSilent -> NoExtFieldSilent Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NoExtFieldSilent -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NoExtFieldSilent -> r Source # gmapQ :: (forall d. Data d => d -> u) -> NoExtFieldSilent -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> NoExtFieldSilent -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NoExtFieldSilent -> m NoExtFieldSilent Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NoExtFieldSilent -> m NoExtFieldSilent Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NoExtFieldSilent -> m NoExtFieldSilent Source #
Ord NoExtFieldSilent # |
Instance details Defined in StgSyn Methods compare :: NoExtFieldSilent -> NoExtFieldSilent -> Ordering # (<) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool # (<=) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool # (>) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool # (>=) :: NoExtFieldSilent -> NoExtFieldSilent -> Bool # max :: NoExtFieldSilent -> NoExtFieldSilent -> NoExtFieldSilent # min :: NoExtFieldSilent -> NoExtFieldSilent -> NoExtFieldSilent #
Outputable NoExtFieldSilent # |
Instance details Defined in StgSyn Methods ppr :: NoExtFieldSilent -> SDoc Source # pprPrec :: Rational -> NoExtFieldSilent -> SDoc Source #

noExtFieldSilent :: NoExtFieldSilent Source #

Used when constructing a term with an unused extension point that should not appear in pretty-printed output at all.

type OutputablePass pass = (Outputable (XLet pass), Outputable (XLetNoEscape pass), Outputable (XRhsClosure pass), OutputableBndr (BinderP pass)) Source #

data UpdateFlag Source #

Constructors

ReEntrant |
Updatable |
SingleEntry |

#### Instances

Instances details

Outputable UpdateFlag # |
Instance details Defined in StgSyn Methods ppr :: UpdateFlag -> SDoc Source # pprPrec :: Rational -> UpdateFlag -> SDoc Source #

isUpdatable :: UpdateFlag -> Bool Source #

type StgTopBinding = GenStgTopBinding 'Vanilla Source #

type StgBinding = GenStgBinding 'Vanilla Source #

type StgExpr = GenStgExpr 'Vanilla Source #

type StgRhs = GenStgRhs 'Vanilla Source #

type StgAlt = GenStgAlt 'Vanilla Source #

type CgStgTopBinding = GenStgTopBinding 'CodeGen Source #

type CgStgBinding = GenStgBinding 'CodeGen Source #

type CgStgExpr = GenStgExpr 'CodeGen Source #

type CgStgRhs = GenStgRhs 'CodeGen Source #

type CgStgAlt = GenStgAlt 'CodeGen Source #

type LlStgTopBinding = GenStgTopBinding 'LiftLams Source #

type LlStgBinding = GenStgBinding 'LiftLams Source #

type LlStgExpr = GenStgExpr 'LiftLams Source #

type LlStgRhs = GenStgRhs 'LiftLams Source #

type LlStgAlt = GenStgAlt 'LiftLams Source #

type InStgArg = StgArg Source #

type InStgTopBinding = StgTopBinding Source #

type InStgBinding = StgBinding Source #

type InStgExpr = StgExpr Source #

type InStgRhs = StgRhs Source #

type InStgAlt = StgAlt Source #

type OutStgArg = StgArg Source #

type OutStgTopBinding = StgTopBinding Source #

type OutStgBinding = StgBinding Source #

type OutStgExpr = StgExpr Source #

type OutStgRhs = StgRhs Source #

type OutStgAlt = StgAlt Source #

data StgOp Source #

Constructors

StgPrimOp PrimOp |
StgPrimCallOp PrimCall |
StgFCallOp ForeignCall Type |

topStgBindHasCafRefs :: GenStgTopBinding pass -> Bool Source #

stgArgHasCafRefs :: StgArg -> Bool Source #

stgRhsArity :: StgRhs -> Int Source #

isDllConApp :: DynFlags -> Module -> DataCon -> [StgArg] -> Bool Source #

Does this constructor application refer to anything in a different *Windows* DLL? If so, we can't allocate it statically

stgArgType :: StgArg -> Type Source #

Type of an `StgArg`

Very half baked because we have lost the type arguments.

stripStgTicksTop :: (Tickish Id -> Bool) -> GenStgExpr p -> ([Tickish Id], GenStgExpr p) Source #

Strip ticks of a given type from an STG expression.

stripStgTicksTopE :: (Tickish Id -> Bool) -> GenStgExpr p -> GenStgExpr p Source #

Strip ticks of a given type from an STG expression returning only the expression.

stgCaseBndrInScope Source #

Arguments

:: AltType |
-> Bool | unarised?
-> Bool |

Given an alt type and whether the program is unarised, return whether the case binder is in scope.

Case binders of unboxed tuple or unboxed sum type always dead after the unariser has run. See Note [Post-unarisation invariants].

pprStgBinding :: StgBinding -> SDoc Source #

pprGenStgTopBindings :: OutputablePass pass => [GenStgTopBinding pass] -> SDoc Source #

pprStgTopBindings :: [StgTopBinding] -> SDoc Source #