ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.StgToCmm.CgUtils

Contents

- Streaming for CG

Synopsis

- fixStgRegisters :: Platform -> GenCmmDecl d h (GenCmmGraph CmmNode) -> GenCmmDecl d h (GenCmmGraph CmmNode)
- baseRegOffset :: Platform -> GlobalReg -> Int
- get_Regtable_addr_from_offset :: Platform -> Int -> CmmExpr
- regTableOffset :: Platform -> Int -> CmmExpr
- get_GlobalReg_addr :: Platform -> GlobalReg -> CmmExpr
- type CgStream = Stream (UniqDSMT IO)

# Documentation

fixStgRegisters :: Platform -> GenCmmDecl d h (GenCmmGraph CmmNode) -> GenCmmDecl d h (GenCmmGraph CmmNode) #

Fixup global registers so that they assign to locations within the RegTable if they aren't pinned for the current target.

baseRegOffset :: Platform -> GlobalReg -> Int #

get_Regtable_addr_from_offset :: Platform -> Int -> CmmExpr #

regTableOffset :: Platform -> Int -> CmmExpr #

get_GlobalReg_addr :: Platform -> GlobalReg -> CmmExpr #

We map STG registers onto appropriate CmmExprs. Either they map to real machine registers or stored as offsets from BaseReg. Given a GlobalReg, get_GlobalReg_addr always produces the register table address for it.

# Streaming for CG

type CgStream = Stream (UniqDSMT IO) #

The Stream instantiation used for code generation. Note the underlying monad is `UniqDSMT IO`, where `UniqDSMT` is a transformer that propagates a deterministic unique supply (essentially an incrementing counter) from which new uniques are deterministically created during the code generation stages following StgToCmm. See Note [Object determinism].