GHC.StgToJS.Utils

ghc-9.10.0.20240426: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.StgToJS.Utils

Contents

- Unboxable datacon
- JSRep
- References and Ids
- Live variables

Synopsis

- assignCoerce1 :: [TypedExpr] -> [TypedExpr] -> JStgStat
- assignToExprCtx :: ExprCtx -> [JStgExpr] -> JStgStat
- fixedLayout :: [JSRep] -> CILayout
- assocIdExprs :: Id -> [JStgExpr] -> [TypedExpr]
- isUnboxableCon :: DataCon -> Bool
- isUnboxable :: JSRep -> Bool
- isBoolDataCon :: DataCon -> Bool
- slotCount :: SlotCount -> Int
- varSize :: JSRep -> Int
- typeSize :: Type -> Int
- isVoid :: JSRep -> Bool
- isMultiVar :: JSRep -> Bool
- idJSRep :: HasDebugCallStack => Id -> [JSRep]
- typeJSRep :: HasDebugCallStack => Type -> [JSRep]
- unaryTypeJSRep :: HasDebugCallStack => UnaryType -> JSRep
- primRepToJSRep :: HasDebugCallStack => PrimRep -> JSRep
- primOrVoidRepToJSRep :: HasDebugCallStack => PrimOrVoidRep -> JSRep
- stackSlotType :: Id -> JSRep
- primRepSize :: PrimRep -> SlotCount
- mkArityTag :: Int -> Int -> Int
- exprRefs :: UniqFM Id CgStgExpr -> CgStgExpr -> Set Id
- hasExport :: CgStgBinding -> Bool
- collectTopIds :: CgStgBinding -> [Id]
- collectIds :: UniqFM Id CgStgExpr -> CgStgBinding -> [Id]
- type LiveVars = DVarSet
- liveStatic :: LiveVars -> LiveVars
- liveVars :: LiveVars -> LiveVars
- stgRhsLive :: CgStgRhs -> LiveVars
- stgExprLive :: Bool -> CgStgExpr -> LiveVars
- isUpdatableRhs :: CgStgRhs -> Bool
- stgLneLive' :: CgStgBinding -> [Id]
- stgLneLiveExpr :: CgStgRhs -> [Id]
- isInlineExpr :: CgStgExpr -> Bool

# Documentation

assignCoerce1 :: [TypedExpr] -> [TypedExpr] -> JStgStat Source #

Assign first expr only (if it exists), performing coercions between some PrimReps (e.g. StablePtr# and Addr#).

assignToExprCtx :: ExprCtx -> [JStgExpr] -> JStgStat Source #

fixedLayout :: [JSRep] -> CILayout Source #

assocIdExprs :: Id -> [JStgExpr] -> [TypedExpr] Source #

Associate the given JExpr to the Id's PrimReps, taking into account the number of slots per PrimRep

# Unboxable datacon

isUnboxableCon :: DataCon -> Bool Source #

can we unbox C x to x, only if x is represented as a Number

isUnboxable :: JSRep -> Bool Source #

one-constructor types with one primitive field represented as a JS Number can be unboxed

isBoolDataCon :: DataCon -> Bool Source #

# JSRep

slotCount :: SlotCount -> Int Source #

Return SlotCount as an Int

varSize :: JSRep -> Int Source #

Number of slots occupied by a value with the given JSRep

typeSize :: Type -> Int Source #

isVoid :: JSRep -> Bool Source #

isMultiVar :: JSRep -> Bool Source #

idJSRep :: HasDebugCallStack => Id -> [JSRep] Source #

typeJSRep :: HasDebugCallStack => Type -> [JSRep] Source #

unaryTypeJSRep :: HasDebugCallStack => UnaryType -> JSRep Source #

primRepToJSRep :: HasDebugCallStack => PrimRep -> JSRep Source #

primOrVoidRepToJSRep :: HasDebugCallStack => PrimOrVoidRep -> JSRep Source #

stackSlotType :: Id -> JSRep Source #

primRepSize :: PrimRep -> SlotCount Source #

mkArityTag :: Int -> Int -> Int Source #

# References and Ids

exprRefs :: UniqFM Id CgStgExpr -> CgStgExpr -> Set Id Source #

hasExport :: CgStgBinding -> Bool Source #

collectTopIds :: CgStgBinding -> [Id] Source #

collectIds :: UniqFM Id CgStgExpr -> CgStgBinding -> [Id] Source #

# Live variables

type LiveVars = DVarSet Source #

liveStatic :: LiveVars -> LiveVars Source #

liveVars :: LiveVars -> LiveVars Source #

stgRhsLive :: CgStgRhs -> LiveVars Source #

stgExprLive :: Bool -> CgStgExpr -> LiveVars Source #

isUpdatableRhs :: CgStgRhs -> Bool Source #

stgLneLive' :: CgStgBinding -> [Id] Source #

stgLneLiveExpr :: CgStgRhs -> [Id] Source #

isInlineExpr :: CgStgExpr -> Bool Source #

returns True if the expression is definitely inline