| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
GHC.StgToCmm.Foreign
Synopsis
- cgForeignCall :: ForeignCall -> Type -> [StgArg] -> Type -> FCode ReturnKind
 - emitPrimCall :: [CmmFormal] -> CallishMachOp -> [CmmActual] -> FCode ()
 - emitCCall :: [(CmmFormal, ForeignHint)] -> CmmExpr -> [(CmmActual, ForeignHint)] -> FCode ()
 - emitForeignCall :: Safety -> [CmmFormal] -> ForeignTarget -> [CmmActual] -> FCode ReturnKind
 - emitSaveThreadState :: FCode ()
 - saveThreadState :: MonadUnique m => DynFlags -> m CmmAGraph
 - emitLoadThreadState :: FCode ()
 - emitSaveRegs :: FCode ()
 - emitRestoreRegs :: FCode ()
 - loadThreadState :: MonadUnique m => DynFlags -> m CmmAGraph
 - emitOpenNursery :: FCode ()
 - emitCloseNursery :: FCode ()
 
Documentation
cgForeignCall :: ForeignCall -> Type -> [StgArg] -> Type -> FCode ReturnKind Source #
Emit code for a foreign call, and return the results to the sequel. Precondition: the length of the arguments list is the same as the arity of the foreign function.
emitPrimCall :: [CmmFormal] -> CallishMachOp -> [CmmActual] -> FCode () Source #
emitCCall :: [(CmmFormal, ForeignHint)] -> CmmExpr -> [(CmmActual, ForeignHint)] -> FCode () Source #
emitForeignCall :: Safety -> [CmmFormal] -> ForeignTarget -> [CmmActual] -> FCode ReturnKind Source #
emitSaveThreadState :: FCode () Source #
saveThreadState :: MonadUnique m => DynFlags -> m CmmAGraph Source #
Produce code to save the current thread state to CurrentTSO
emitLoadThreadState :: FCode () Source #
emitSaveRegs :: FCode () Source #
Save STG registers
STG registers must be saved around a C call, just in case the STG register is mapped to a caller-saves machine register. Normally we don't need to worry about this the code generator has already loaded any live STG registers into variables for us, but in hand-written low-level Cmm code where we don't know which registers are live, we might have to save them all.
emitRestoreRegs :: FCode () Source #
Restore STG registers (see emitSaveRegs)
loadThreadState :: MonadUnique m => DynFlags -> m CmmAGraph Source #
Produce code to load the current thread state from CurrentTSO
emitOpenNursery :: FCode () Source #
emitCloseNursery :: FCode () Source #