ghc-7.10.2: 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 Source

Instances

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

initC :: IO CgState Source

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

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

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

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

returnFC :: a -> FCode a Source

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

newUnique :: FCode Unique Source

newUniqSupply :: FCode UniqSupply Source

newLabelC :: FCode BlockId Source

emitLabel :: BlockId -> FCode () Source

emit :: CmmAGraph -> FCode () Source

emitDecl :: CmmDecl -> FCode () Source

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

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

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

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

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

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

emitComment :: FastString -> FCode () Source

emitTick :: CmmTickish -> FCode () Source

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

getCmm :: FCode () -> FCode CmmGroup Source

aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph Source

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

getCode :: FCode a -> FCode CmmAGraph Source

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

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

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

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

mkCmmIfThen :: CmmExpr -> CmmAGraph -> FCode CmmAGraph Source

mkCmmIfGoto :: CmmExpr -> BlockId -> FCode CmmAGraph Source

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

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

forkClosureBody :: FCode () -> FCode () Source

forkLneBody :: FCode a -> FCode a Source

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

codeOnly :: FCode () -> FCode () Source

type ConTagZ = Int Source

data Sequel Source

Constructors

Return Bool |
AssignTo [LocalReg] Bool |

data ReturnKind Source

Constructors

AssignedDirectly |
ReturnedTo BlockId ByteOff |

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

getSequel :: FCode Sequel Source

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

getTickyCtrLabel :: FCode CLabel Source

tickScope :: FCode a -> FCode a Source

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 Source

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

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

getUpdFrameOff :: FCode UpdFrameOffset Source

initUpdFrameOff :: DynFlags -> UpdFrameOffset Source

data HeapUsage Source

Constructors

HeapUsage |
Fields virtHp :: VirtualHpOffset realHp :: VirtualHpOffset

type VirtualHpOffset = WordOff Source

initHpUsage :: HeapUsage Source

getHpUsage :: FCode HeapUsage Source

setHpUsage :: HeapUsage -> FCode () Source

heapHWM :: HeapUsage -> VirtualHpOffset Source

setVirtHp :: VirtualHpOffset -> FCode () Source

getVirtHp :: FCode VirtualHpOffset Source

setRealHp :: VirtualHpOffset -> FCode () Source

getModuleName :: FCode Module Source

getState :: FCode CgState Source

setState :: CgState -> FCode () Source

getSelfLoop :: FCode (Maybe SelfLoopInfo) Source

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

getInfoDown :: FCode CgInfoDownwards Source

getDynFlags :: HasDynFlags m => m DynFlags Source

getThisPackage :: FCode PackageKey Source

data CgIdInfo Source

Constructors

CgIdInfo |
Fields cg_id :: Id cg_lf :: LambdaFormInfo cg_loc :: CgLoc

Instances

Outputable CgIdInfo |

getBinds :: FCode CgBindings Source

setBinds :: CgBindings -> FCode () Source

data CgInfoDownwards Source

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 Source

Constructors

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