ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToCmm.Closure

Contents

- LambdaFormInfo
- Used by other modules
- ClosureInfo
  - Inspection
  - Labels
  - Predicates
- InfoTables

Synopsis

- type DynTag = Int
- tagForCon :: Platform -> DataCon -> DynTag
- isSmallFamily :: Platform -> Int -> Bool
- idPrimRep :: Id -> PrimRep
- isVoidRep :: PrimRep -> Bool
- isGcPtrRep :: PrimRep -> Bool
- addIdReps :: [NonVoid Id] -> [NonVoid (PrimRep, Id)]
- addArgReps :: [NonVoid StgArg] -> [NonVoid (PrimRep, StgArg)]
- argPrimRep :: StgArg -> PrimRep
- newtype NonVoid a = NonVoid a
- fromNonVoid :: NonVoid a -> a
- nonVoidIds :: [Id] -> [NonVoid Id]
- nonVoidStgArgs :: [StgArg] -> [NonVoid StgArg]
- assertNonVoidIds :: [Id] -> [NonVoid Id]
- assertNonVoidStgArgs :: [StgArg] -> [NonVoid StgArg]
- data LambdaFormInfo
- data StandardFormInfo
- mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo
- mkLFReEntrant :: TopLevelFlag -> [Id] -> [Id] -> ArgDescr -> LambdaFormInfo
- mkConLFInfo :: DataCon -> LambdaFormInfo
- mkSelectorLFInfo :: Id -> Int -> Bool -> LambdaFormInfo
- mkApLFInfo :: Id -> UpdateFlag -> Arity -> LambdaFormInfo
- mkLFImported :: Id -> LambdaFormInfo
- mkLFArgument :: Id -> LambdaFormInfo
- mkLFLetNoEscape :: LambdaFormInfo
- mkLFStringLit :: LambdaFormInfo
- lfDynTag :: Platform -> LambdaFormInfo -> DynTag
- isLFThunk :: LambdaFormInfo -> Bool
- isLFReEntrant :: LambdaFormInfo -> Bool
- lfUpdatable :: LambdaFormInfo -> Bool
- data CgLoc
  - = CmmLoc CmmExpr
  - | LneLoc BlockId [LocalReg]
- data CallMethod
  - = EnterIt
  - | JumpToIt BlockId [LocalReg]
  - | ReturnIt
  - | InferedReturnIt
  - | SlowCall
  - | DirectEntry CLabel RepArity
- nodeMustPointToIt :: Profile -> LambdaFormInfo -> Bool
- isKnownFun :: LambdaFormInfo -> Bool
- funTag :: Platform -> ClosureInfo -> DynTag
- tagForArity :: Platform -> RepArity -> DynTag
- getCallMethod :: StgToCmmConfig -> Name -> Id -> LambdaFormInfo -> RepArity -> RepArity -> CgLoc -> Maybe SelfLoopInfo -> CallMethod
- data ClosureInfo
- mkClosureInfo :: Profile -> Bool -> Id -> LambdaFormInfo -> Int -> Int -> String -> ClosureInfo
- mkCmmInfo :: ClosureInfo -> Id -> CostCentreStack -> CmmInfoTable
- closureLFInfo :: ClosureInfo -> LambdaFormInfo
- closureName :: ClosureInfo -> Id
- closureInfoLabel :: ClosureInfo -> CLabel
- staticClosureLabel :: Platform -> ClosureInfo -> CLabel
- closureSlowEntryLabel :: Platform -> ClosureInfo -> CLabel
- closureLocalEntryLabel :: Platform -> ClosureInfo -> CLabel
- closureUpdReqd :: ClosureInfo -> Bool
- closureReEntrant :: ClosureInfo -> Bool
- closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr)
- isToplevClosure :: ClosureInfo -> Bool
- blackHoleOnEntry :: ClosureInfo -> Bool
- isStaticClosure :: ClosureInfo -> Bool
- mkDataConInfoTable :: Profile -> DataCon -> ConInfoTableLocation -> Bool -> Int -> Int -> CmmInfoTable
- cafBlackHoleInfoTable :: CmmInfoTable
- indStaticInfoTable :: CmmInfoTable
- staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool
- mkClosureInfoTableLabel :: Platform -> Id -> LambdaFormInfo -> CLabel

# Documentation

type DynTag = Int Source #

tagForCon :: Platform -> DataCon -> DynTag Source #

isSmallFamily :: Platform -> Int -> Bool Source #

idPrimRep :: Id -> PrimRep Source #

Assumes that there is precisely one `PrimRep` of the type. This assumption holds after unarise. See Note [Post-unarisation invariants]

isVoidRep :: PrimRep -> Bool Source #

isGcPtrRep :: PrimRep -> Bool Source #

addIdReps :: [NonVoid Id] -> [NonVoid (PrimRep, Id)] Source #

Assumes that Ids have one PrimRep, which holds after unarisation. See Note [Post-unarisation invariants]

addArgReps :: [NonVoid StgArg] -> [NonVoid (PrimRep, StgArg)] Source #

Assumes that arguments have one PrimRep, which holds after unarisation. See Note [Post-unarisation invariants]

argPrimRep :: StgArg -> PrimRep Source #

Assumes that the argument has one PrimRep, which holds after unarisation. See Note [Post-unarisation invariants]

newtype NonVoid a Source #

Constructors

NonVoid a |

#### Instances

Instances details

Show a => Show (NonVoid a) Source # |
Instance details Defined in GHC.StgToCmm.Closure Methods showsPrec :: Int -> NonVoid a -> ShowS Source # show :: NonVoid a -> String Source # showList :: [NonVoid a] -> ShowS Source #
Outputable a => Outputable (NonVoid a) Source # |
Instance details Defined in GHC.StgToCmm.Closure Methods ppr :: NonVoid a -> SDoc Source #
Eq a => Eq (NonVoid a) Source # |
Instance details Defined in GHC.StgToCmm.Closure Methods (==) :: NonVoid a -> NonVoid a -> Bool # (/=) :: NonVoid a -> NonVoid a -> Bool #

fromNonVoid :: NonVoid a -> a Source #

nonVoidIds :: [Id] -> [NonVoid Id] Source #

nonVoidStgArgs :: [StgArg] -> [NonVoid StgArg] Source #

assertNonVoidIds :: [Id] -> [NonVoid Id] Source #

Used in places where some invariant ensures that all these Ids are non-void; e.g. constructor field binders in case expressions. See Note [Post-unarisation invariants] in GHC.Stg.Unarise.

assertNonVoidStgArgs :: [StgArg] -> [NonVoid StgArg] Source #

Used in places where some invariant ensures that all these arguments are non-void; e.g. constructor arguments. See Note [Post-unarisation invariants] in GHC.Stg.Unarise.

# LambdaFormInfo

data LambdaFormInfo Source #

Information about an identifier, from the code generator's point of view. Every identifier is bound to a LambdaFormInfo in the environment, which gives the code generator enough info to be able to tail call or return that identifier.

#### Instances

Instances details

Outputable LambdaFormInfo Source # |
Instance details Defined in GHC.StgToCmm.Types Methods ppr :: LambdaFormInfo -> SDoc Source #

data StandardFormInfo Source #

StandardFormInfo tells whether this thunk has one of a small number of standard forms

#### Instances

Instances details

Outputable StandardFormInfo Source # |
Instance details Defined in GHC.StgToCmm.Types Methods ppr :: StandardFormInfo -> SDoc Source #
Eq StandardFormInfo Source # |
Instance details Defined in GHC.StgToCmm.Types Methods (==) :: StandardFormInfo -> StandardFormInfo -> Bool # (/=) :: StandardFormInfo -> StandardFormInfo -> Bool #

mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo Source #

mkLFReEntrant :: TopLevelFlag -> [Id] -> [Id] -> ArgDescr -> LambdaFormInfo Source #

mkConLFInfo :: DataCon -> LambdaFormInfo Source #

mkSelectorLFInfo :: Id -> Int -> Bool -> LambdaFormInfo Source #

mkApLFInfo :: Id -> UpdateFlag -> Arity -> LambdaFormInfo Source #

mkLFImported :: Id -> LambdaFormInfo Source #

mkLFArgument :: Id -> LambdaFormInfo Source #

mkLFLetNoEscape :: LambdaFormInfo Source #

mkLFStringLit :: LambdaFormInfo Source #

lfDynTag :: Platform -> LambdaFormInfo -> DynTag Source #

Return the tag in the low order bits of a variable bound to this LambdaForm

isLFThunk :: LambdaFormInfo -> Bool Source #

isLFReEntrant :: LambdaFormInfo -> Bool Source #

lfUpdatable :: LambdaFormInfo -> Bool Source #

# Used by other modules

data CgLoc Source #

Constructors

CmmLoc CmmExpr |
LneLoc BlockId [LocalReg] |

#### Instances

Instances details

OutputableP Platform CgLoc Source # |
Instance details Defined in GHC.StgToCmm.Closure Methods pdoc :: Platform -> CgLoc -> SDoc Source #

data CallMethod Source #

Constructors

EnterIt | No args, not a function
JumpToIt BlockId [LocalReg] |
ReturnIt |
InferedReturnIt |
SlowCall |
DirectEntry CLabel RepArity |

#### Instances

Instances details

Outputable CallMethod Source # |
Instance details Defined in GHC.StgToCmm.Closure Methods ppr :: CallMethod -> SDoc Source #

nodeMustPointToIt :: Profile -> LambdaFormInfo -> Bool Source #

isKnownFun :: LambdaFormInfo -> Bool Source #

funTag :: Platform -> ClosureInfo -> DynTag Source #

tagForArity :: Platform -> RepArity -> DynTag Source #

getCallMethod :: StgToCmmConfig -> Name -> Id -> LambdaFormInfo -> RepArity -> RepArity -> CgLoc -> Maybe SelfLoopInfo -> CallMethod Source #

# ClosureInfo

data ClosureInfo Source #

mkClosureInfo :: Profile -> Bool -> Id -> LambdaFormInfo -> Int -> Int -> String -> ClosureInfo Source #

mkCmmInfo :: ClosureInfo -> Id -> CostCentreStack -> CmmInfoTable Source #

Convert from `ClosureInfo` to `CmmInfoTable`.

## Inspection

closureLFInfo :: ClosureInfo -> LambdaFormInfo Source #

closureName :: ClosureInfo -> Id Source #

## Labels

closureInfoLabel :: ClosureInfo -> CLabel Source #

staticClosureLabel :: Platform -> ClosureInfo -> CLabel Source #

closureSlowEntryLabel :: Platform -> ClosureInfo -> CLabel Source #

closureLocalEntryLabel :: Platform -> ClosureInfo -> CLabel Source #

## Predicates

closureUpdReqd :: ClosureInfo -> Bool Source #

closureReEntrant :: ClosureInfo -> Bool Source #

closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr) Source #

isToplevClosure :: ClosureInfo -> Bool Source #

blackHoleOnEntry :: ClosureInfo -> Bool Source #

isStaticClosure :: ClosureInfo -> Bool Source #

# InfoTables

mkDataConInfoTable :: Profile -> DataCon -> ConInfoTableLocation -> Bool -> Int -> Int -> CmmInfoTable Source #

cafBlackHoleInfoTable :: CmmInfoTable Source #

indStaticInfoTable :: CmmInfoTable Source #

staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool Source #

mkClosureInfoTableLabel :: Platform -> Id -> LambdaFormInfo -> CLabel Source #

Get the info table label for a *thunk*.