ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

StgCmmMonad

Synopsis

- data FCode a
- initC :: IO CgState
- runC :: DynFlags -> Module -> CgState -> FCode a -> (a, CgState)
- thenC :: FCode () -> FCode a -> FCode a
- thenFC :: FCode a -> (a -> FCode c) -> FCode c
- listCs :: [FCode ()] -> FCode ()
- returnFC :: a -> FCode a
- fixC :: (a -> FCode a) -> FCode a
- newUnique :: FCode Unique
- newUniqSupply :: FCode UniqSupply
- newLabelC :: FCode BlockId
- emitLabel :: BlockId -> FCode ()
- emit :: CmmAGraph -> FCode ()
- emitDecl :: CmmDecl -> FCode ()
- emitProc :: Maybe CmmInfoTable -> CLabel -> [GlobalReg] -> CmmAGraphScoped -> Int -> FCode ()
- emitProcWithConvention :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> CmmAGraphScoped -> FCode ()
- emitProcWithStackFrame :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> [CmmFormal] -> CmmAGraphScoped -> Bool -> FCode ()
- emitOutOfLine :: BlockId -> CmmAGraphScoped -> FCode ()
- emitAssign :: CmmReg -> CmmExpr -> FCode ()
- emitStore :: CmmExpr -> CmmExpr -> FCode ()
- emitComment :: FastString -> FCode ()
- emitTick :: CmmTickish -> FCode ()
- emitUnwind :: GlobalReg -> CmmExpr -> FCode ()
- getCmm :: FCode () -> FCode CmmGroup
- aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph
- getCodeR :: FCode a -> FCode (a, CmmAGraph)
- getCode :: FCode a -> FCode CmmAGraph
- getCodeScoped :: FCode a -> FCode (a, CmmAGraphScoped)
- getHeapUsage :: (VirtualHpOffset -> FCode a) -> FCode a
- mkCmmIfThenElse :: CmmExpr -> CmmAGraph -> CmmAGraph -> FCode CmmAGraph
- mkCmmIfThen :: CmmExpr -> CmmAGraph -> FCode CmmAGraph
- mkCmmIfGoto :: CmmExpr -> BlockId -> FCode CmmAGraph
- mkCall :: CmmExpr -> (Convention, Convention) -> [CmmFormal] -> [CmmActual] -> UpdFrameOffset -> [CmmActual] -> FCode CmmAGraph
- mkCmmCall :: CmmExpr -> [CmmFormal] -> [CmmActual] -> UpdFrameOffset -> FCode CmmAGraph
- forkClosureBody :: FCode () -> FCode ()
- forkLneBody :: FCode a -> FCode a
- forkAlts :: [FCode a] -> FCode [a]
- codeOnly :: FCode () -> FCode ()
- type ConTagZ = Int
- data Sequel
  - = Return Bool
  - | AssignTo [LocalReg] Bool
- data ReturnKind
  - = AssignedDirectly
  - | ReturnedTo BlockId ByteOff
- withSequel :: Sequel -> FCode a -> FCode a
- getSequel :: FCode Sequel
- setTickyCtrLabel :: CLabel -> FCode a -> FCode a
- getTickyCtrLabel :: FCode CLabel
- tickScope :: FCode a -> FCode a
- getTickScope :: FCode CmmTickScope
- withUpdFrameOff :: UpdFrameOffset -> FCode a -> FCode a
- getUpdFrameOff :: FCode UpdFrameOffset
- initUpdFrameOff :: DynFlags -> UpdFrameOffset
- data HeapUsage = HeapUsage {
  - virtHp :: VirtualHpOffset
  - realHp :: VirtualHpOffset
  }
- type VirtualHpOffset = WordOff
- initHpUsage :: HeapUsage
- getHpUsage :: FCode HeapUsage
- setHpUsage :: HeapUsage -> FCode ()
- heapHWM :: HeapUsage -> VirtualHpOffset
- setVirtHp :: VirtualHpOffset -> FCode ()
- getVirtHp :: FCode VirtualHpOffset
- setRealHp :: VirtualHpOffset -> FCode ()
- getModuleName :: FCode Module
- getState :: FCode CgState
- setState :: CgState -> FCode ()
- getSelfLoop :: FCode (Maybe SelfLoopInfo)
- withSelfLoop :: SelfLoopInfo -> FCode a -> FCode a
- getInfoDown :: FCode CgInfoDownwards
- getDynFlags :: HasDynFlags m => m DynFlags
- getThisPackage :: FCode PackageKey
- data CgIdInfo = CgIdInfo {
  - cg_id :: Id
  - cg_lf :: LambdaFormInfo
  - cg_loc :: CgLoc
  }
- getBinds :: FCode CgBindings
- setBinds :: CgBindings -> FCode ()
- data CgInfoDownwards = MkCgInfoDown {
  - cgd_dflags :: DynFlags
  - cgd_mod :: Module
  - cgd_updfr_off :: UpdFrameOffset
  - cgd_ticky :: CLabel
  - cgd_sequel :: Sequel
  - cgd_self_loop :: Maybe SelfLoopInfo
  - cgd_tick_scope :: CmmTickScope
  }
- data CgState = MkCgState {
  - cgs_stmts :: CmmAGraph
  - cgs_tops :: OrdList CmmDecl
  - cgs_binds :: CgBindings
  - cgs_hp_usg :: HeapUsage
  - cgs_uniqs :: UniqSupply
  }

# Documentation

data FCode a

Instances

Monad FCode |
Functor FCode |
Applicative FCode |
HasDynFlags FCode |

initC :: IO CgState

runC :: DynFlags -> Module -> CgState -> FCode a -> (a, CgState)

thenC :: FCode () -> FCode a -> FCode a infixr 9

thenFC :: FCode a -> (a -> FCode c) -> FCode c infixr 9

listCs :: [FCode ()] -> FCode ()

returnFC :: a -> FCode a

fixC :: (a -> FCode a) -> FCode a

newUnique :: FCode Unique

newUniqSupply :: FCode UniqSupply

newLabelC :: FCode BlockId

emitLabel :: BlockId -> FCode ()

emit :: CmmAGraph -> FCode ()

emitDecl :: CmmDecl -> FCode ()

emitProc :: Maybe CmmInfoTable -> CLabel -> [GlobalReg] -> CmmAGraphScoped -> Int -> FCode ()

emitProcWithConvention :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> CmmAGraphScoped -> FCode ()

emitProcWithStackFrame :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> [CmmFormal] -> CmmAGraphScoped -> Bool -> FCode ()

emitOutOfLine :: BlockId -> CmmAGraphScoped -> FCode ()

emitAssign :: CmmReg -> CmmExpr -> FCode ()

emitStore :: CmmExpr -> CmmExpr -> FCode ()

emitComment :: FastString -> FCode ()

emitTick :: CmmTickish -> FCode ()

emitUnwind :: GlobalReg -> CmmExpr -> FCode ()

getCmm :: FCode () -> FCode CmmGroup

aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph

getCodeR :: FCode a -> FCode (a, CmmAGraph)

getCode :: FCode a -> FCode CmmAGraph

getCodeScoped :: FCode a -> FCode (a, CmmAGraphScoped)

Generate code into a fresh tick (sub-)scope and gather generated code

getHeapUsage :: (VirtualHpOffset -> FCode a) -> FCode a

mkCmmIfThenElse :: CmmExpr -> CmmAGraph -> CmmAGraph -> FCode CmmAGraph

mkCmmIfThen :: CmmExpr -> CmmAGraph -> FCode CmmAGraph

mkCmmIfGoto :: CmmExpr -> BlockId -> FCode CmmAGraph

mkCall :: CmmExpr -> (Convention, Convention) -> [CmmFormal] -> [CmmActual] -> UpdFrameOffset -> [CmmActual] -> FCode CmmAGraph

mkCmmCall :: CmmExpr -> [CmmFormal] -> [CmmActual] -> UpdFrameOffset -> FCode CmmAGraph

forkClosureBody :: FCode () -> FCode ()

forkLneBody :: FCode a -> FCode a

forkAlts :: [FCode a] -> FCode [a]

codeOnly :: FCode () -> FCode ()

type ConTagZ = Int

data Sequel

Constructors

Return Bool |
AssignTo [LocalReg] Bool |

data ReturnKind

Constructors

AssignedDirectly |
ReturnedTo BlockId ByteOff |

withSequel :: Sequel -> FCode a -> FCode a

getSequel :: FCode Sequel

setTickyCtrLabel :: CLabel -> FCode a -> FCode a

getTickyCtrLabel :: FCode CLabel

tickScope :: FCode a -> FCode a

Places blocks generated by the given code into a fresh (sub-)scope. This will make sure that Cmm annotations in our scope will apply to the Cmm blocks generated therein - but not the other way around.

getTickScope :: FCode CmmTickScope

The current tick scope. We will assign this to generated blocks.

withUpdFrameOff :: UpdFrameOffset -> FCode a -> FCode a

getUpdFrameOff :: FCode UpdFrameOffset

initUpdFrameOff :: DynFlags -> UpdFrameOffset

data HeapUsage

Constructors

HeapUsage |

Fields

virtHp :: VirtualHpOffset
realHp :: VirtualHpOffset

type VirtualHpOffset = WordOff

initHpUsage :: HeapUsage

getHpUsage :: FCode HeapUsage

setHpUsage :: HeapUsage -> FCode ()

heapHWM :: HeapUsage -> VirtualHpOffset

setVirtHp :: VirtualHpOffset -> FCode ()

getVirtHp :: FCode VirtualHpOffset

setRealHp :: VirtualHpOffset -> FCode ()

getModuleName :: FCode Module

getState :: FCode CgState

setState :: CgState -> FCode ()

getSelfLoop :: FCode (Maybe SelfLoopInfo)

withSelfLoop :: SelfLoopInfo -> FCode a -> FCode a

getInfoDown :: FCode CgInfoDownwards

getDynFlags :: HasDynFlags m => m DynFlags

getThisPackage :: FCode PackageKey

data CgIdInfo

Constructors

CgIdInfo |

Fields

cg_id :: Id
cg_lf :: LambdaFormInfo
cg_loc :: CgLoc

Instances

Outputable CgIdInfo |

getBinds :: FCode CgBindings

setBinds :: CgBindings -> FCode ()

data CgInfoDownwards

Constructors

MkCgInfoDown |

Fields

cgd_dflags :: DynFlags
cgd_mod :: Module
cgd_updfr_off :: UpdFrameOffset
cgd_ticky :: CLabel
cgd_sequel :: Sequel
cgd_self_loop :: Maybe SelfLoopInfo
cgd_tick_scope :: CmmTickScope

data CgState

Constructors

MkCgState |

Fields

cgs_stmts :: CmmAGraph
cgs_tops :: OrdList CmmDecl
cgs_binds :: CgBindings
cgs_hp_usg :: HeapUsage
cgs_uniqs :: UniqSupply