GHC.StgToJS.Sinker

ghc-9.10.0.20240328: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.StgToJS.Sinker

Synopsis

- sinkPgm :: Module -> [CgStgTopBinding] -> (UniqFM Id CgStgExpr, [CgStgTopBinding])

# Documentation

sinkPgm :: Module -> [CgStgTopBinding] -> (UniqFM Id CgStgExpr, [CgStgTopBinding]) Source #

Unfloat some top-level unexported things

GHC floats constants to the top level. This is fine in native code, but with JS they occupy some global variable name. We can unfloat some unexported things:

- global constructors, as long as they're referenced only once by another global constructor and are not in a recursive binding group
- literals (small literals may also be sunk if they are used more than once)