ghc-9.8.2: The GHC API
Safe HaskellNone
LanguageHaskell2010

GHC.StgToJS.Utils

Synopsis

Documentation

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

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

Core Utils

isUnboxableCon :: DataCon -> Bool Source #

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

isUnboxable :: VarType -> Bool Source #

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

data SlotCount Source #

Number of slots occupied by a PrimRep

Constructors

NoSlot 
OneSlot 
TwoSlots 

Instances

Instances details
Show SlotCount Source # 
Instance details

Defined in GHC.StgToJS.Utils

Outputable SlotCount Source # 
Instance details

Defined in GHC.StgToJS.Utils

Methods

ppr :: SlotCount -> SDoc Source #

Eq SlotCount Source # 
Instance details

Defined in GHC.StgToJS.Utils

Ord SlotCount Source # 
Instance details

Defined in GHC.StgToJS.Utils

slotCount :: SlotCount -> Int Source #

Return SlotCount as an Int

varSize :: VarType -> Int Source #

Number of slots occupied by a value with the given VarType

isMatchable :: [VarType] -> Bool Source #

can we pattern match on these values in a case?

tyConPrimRep' :: HasDebugCallStack => TyCon -> [PrimRep] Source #

Find the primitive representation of a TyCon. Defined here to avoid module loops. Call this only on unlifted tycons.

kindPrimRep' :: HasDebugCallStack => SDoc -> Kind -> [PrimRep] Source #

Take a kind (of shape TYPE rr) and produce the PrimReps of values of types of this kind.

assocPrimReps :: [PrimRep] -> [JExpr] -> [(PrimRep, [JExpr])] Source #

Associate the given values to each RrimRep in the given order, taking into account the number of slots per PrimRep

assocIdPrimReps :: Id -> [JExpr] -> [(PrimRep, [JExpr])] Source #

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

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

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

Stg Utils

bindingRefs :: UniqFM Id CgStgExpr -> CgStgBinding -> Set Id Source #

collect Ids that this binding refers to (does not include the bindees themselves) first argument is Id -> StgExpr map for unfloated arguments

isInlineExpr :: UniqSet Id -> CgStgExpr -> (UniqSet Id, Bool) Source #

returns True if the expression is definitely inline