HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleghc-10.0.0.20260917GHC2024

GHC.StgToCmm.ExtCode

Our extended FCode monad.

Synopsis
newtypenewtype CmmParse a

Does a computation in the FCode monad, with a current environment and a list of local declarations. Returns the resulting list of declarations.

Instances5Monad, Functor, Applicative, MonadGetUnique, MonadUnique
datadata Named

The environment contains variable definitions or blockids.

Constructors

  • VarN CmmExpr

    Holds CmmLit(CmmLabel ..) which gives the label type, eg, RtsLabel, ForeignLabel, CmmLabel etc.

  • FunN UnitId

    A function name from this unit

  • LabelN BlockId

    A blockid of some code or data.

valueloopDecls :: CmmParse a -> CmmParse a

Takes the variable declarations and imports from the monad and makes an environment, which is looped back into the computation. In this way, we can have embedded declarations that scope over the whole procedure, and imports that scope over the entire module. Discards the local declaration contained within decl'

Add an imported foreign label to the list of local declarations. If this is done at the start of the module the declaration will scope over the whole module.

Lookup the location of a named variable. Unknown names are treated as if they had been imported from the runtime system. This saves us a lot of bother in the RTS sources, at the expense of deferring some errors to link time.