ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToJS.Monad

Contents

- Group

Description

JS codegen state monad

Synopsis

- runG :: StgToJSConfig -> Module -> UniqFM Id CgStgExpr -> G a -> IO a
- emitGlobal :: JStat -> G ()
- addDependency :: OtherSymb -> G ()
- emitToplevel :: JStat -> G ()
- emitStatic :: FastString -> StaticVal -> Maybe Ident -> G ()
- emitClosureInfo :: ClosureInfo -> G ()
- emitForeign :: Maybe RealSrcSpan -> FastString -> Safety -> CCallConv -> [FastString] -> FastString -> G ()
- assertRtsStat :: G JStat -> G JStat
- getSettings :: G StgToJSConfig
- globalOccs :: JStat -> G [GlobalOcc]
- setGlobalIdCache :: GlobalIdCache -> G ()
- getGlobalIdCache :: G GlobalIdCache
- data GlobalOcc = GlobalOcc {
  - global_ident :: !Ident
  - global_id :: !Id
  - global_count :: !Word
  }
- modifyGroup :: (GenGroupState -> GenGroupState) -> G ()
- resetGroup :: G ()

# Documentation

runG :: StgToJSConfig -> Module -> UniqFM Id CgStgExpr -> G a -> IO a Source #

emitGlobal :: JStat -> G () Source #

emit a global (for the current module) toplevel statement

addDependency :: OtherSymb -> G () Source #

add a dependency on a particular symbol to the current group

emitToplevel :: JStat -> G () Source #

emit a top-level statement for the current binding group

emitStatic :: FastString -> StaticVal -> Maybe Ident -> G () Source #

emit static data for the binding group

emitClosureInfo :: ClosureInfo -> G () Source #

add closure info in our binding group. all heap objects must have closure info

emitForeign :: Maybe RealSrcSpan -> FastString -> Safety -> CCallConv -> [FastString] -> FastString -> G () Source #

assertRtsStat :: G JStat -> G JStat Source #

getSettings :: G StgToJSConfig Source #

globalOccs :: JStat -> G [GlobalOcc] Source #

Return number of occurrences of every global id used in the given JStat. Sort by increasing occurrence count.

setGlobalIdCache :: GlobalIdCache -> G () Source #

getGlobalIdCache :: G GlobalIdCache Source #

data GlobalOcc Source #

Constructors

GlobalOcc |

Fields

- global_ident :: !Ident
- global_id :: !Id
- global_count :: !Word

# Group

modifyGroup :: (GenGroupState -> GenGroupState) -> G () Source #

resetGroup :: G () Source #

start with a new binding group