ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToJS.CoreUtils

Description

Core utils

Synopsis

- isUnboxableCon :: DataCon -> Bool
- isUnboxable :: VarType -> Bool
- data SlotCount
  - = NoSlot
  - | OneSlot
  - | TwoSlots
- slotCount :: SlotCount -> Int
- varSize :: VarType -> Int
- varSlotCount :: VarType -> SlotCount
- typeSize :: Type -> Int
- isVoid :: VarType -> Bool
- isPtr :: VarType -> Bool
- isSingleVar :: VarType -> Bool
- isMultiVar :: VarType -> Bool
- isMatchable :: [VarType] -> Bool
- tyConVt :: HasDebugCallStack => TyCon -> [VarType]
- idVt :: HasDebugCallStack => Id -> [VarType]
- typeVt :: HasDebugCallStack => Type -> [VarType]
- uTypeVt :: HasDebugCallStack => UnaryType -> VarType
- primRepVt :: HasDebugCallStack => PrimRep -> VarType
- typePrimRep' :: HasDebugCallStack => UnaryType -> [PrimRep]
- tyConPrimRep' :: HasDebugCallStack => TyCon -> [PrimRep]
- kindPrimRep' :: HasDebugCallStack => SDoc -> Kind -> [PrimRep]
- primTypeVt :: HasDebugCallStack => Type -> VarType
- argVt :: StgArg -> VarType
- dataConType :: DataCon -> Type
- isBoolDataCon :: DataCon -> Bool
- fixedLayout :: [VarType] -> CILayout
- stackSlotType :: Id -> VarType
- idPrimReps :: Id -> [PrimRep]
- typePrimReps :: Type -> [PrimRep]
- primRepSize :: PrimRep -> SlotCount
- assocPrimReps :: Outputable a => [PrimRep] -> [a] -> [(PrimRep, [a])]
- assocIdPrimReps :: Outputable a => Id -> [a] -> [(PrimRep, [a])]
- assocIdExprs :: Id -> [JExpr] -> [TypedExpr]
- might_be_a_function :: HasDebugCallStack => Type -> Bool
- mkArityTag :: Int -> Int -> Int
- toTypeList :: [VarType] -> [Int]

# Documentation

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.CoreUtils Methods showsPrec :: Int -> SlotCount -> ShowS Source # show :: SlotCount -> String Source # showList :: [SlotCount] -> ShowS Source #
Outputable SlotCount Source # |
Instance details Defined in GHC.StgToJS.CoreUtils Methods ppr :: SlotCount -> SDoc Source #
Eq SlotCount Source # |
Instance details Defined in GHC.StgToJS.CoreUtils Methods (==) :: SlotCount -> SlotCount -> Bool # (/=) :: SlotCount -> SlotCount -> Bool #
Ord SlotCount Source # |
Instance details Defined in GHC.StgToJS.CoreUtils Methods compare :: SlotCount -> SlotCount -> Ordering # (<) :: SlotCount -> SlotCount -> Bool # (<=) :: SlotCount -> SlotCount -> Bool # (>) :: SlotCount -> SlotCount -> Bool # (>=) :: SlotCount -> SlotCount -> Bool # max :: SlotCount -> SlotCount -> SlotCount # min :: SlotCount -> SlotCount -> SlotCount #

slotCount :: SlotCount -> Int Source #

Return SlotCount as an Int

varSize :: VarType -> Int Source #

Number of slots occupied by a value with the given VarType

varSlotCount :: VarType -> SlotCount Source #

typeSize :: Type -> Int Source #

isVoid :: VarType -> Bool Source #

isPtr :: VarType -> Bool Source #

isSingleVar :: VarType -> Bool Source #

isMultiVar :: VarType -> Bool Source #

isMatchable :: [VarType] -> Bool Source #

can we pattern match on these values in a case?

tyConVt :: HasDebugCallStack => TyCon -> [VarType] Source #

idVt :: HasDebugCallStack => Id -> [VarType] Source #

typeVt :: HasDebugCallStack => Type -> [VarType] Source #

uTypeVt :: HasDebugCallStack => UnaryType -> VarType Source #

primRepVt :: HasDebugCallStack => PrimRep -> VarType Source #

typePrimRep' :: HasDebugCallStack => UnaryType -> [PrimRep] Source #

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 `PrimRep`s of values of types of this kind.

primTypeVt :: HasDebugCallStack => Type -> VarType Source #

argVt :: StgArg -> VarType Source #

dataConType :: DataCon -> Type Source #

isBoolDataCon :: DataCon -> Bool Source #

fixedLayout :: [VarType] -> CILayout Source #

stackSlotType :: Id -> VarType Source #

idPrimReps :: Id -> [PrimRep] Source #

typePrimReps :: Type -> [PrimRep] Source #

primRepSize :: PrimRep -> SlotCount Source #

assocPrimReps :: Outputable a => [PrimRep] -> [a] -> [(PrimRep, [a])] Source #

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

assocIdPrimReps :: Outputable a => Id -> [a] -> [(PrimRep, [a])] 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

might_be_a_function :: HasDebugCallStack => Type -> Bool Source #

Return False only if we are *sure* it's a data type Look through newtypes etc as much as possible

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

toTypeList :: [VarType] -> [Int] Source #