Safe Haskell | None |
---|---|
Language | Haskell98 |
Our extended FCode monad.
- data CmmParse a
- unEC :: CmmParse a -> Env -> Decls -> FCode (Decls, a)
- data Named
- type Env = UniqFM Named
- loopDecls :: CmmParse a -> CmmParse a
- getEnv :: CmmParse Env
- newLocal :: CmmType -> FastString -> CmmParse LocalReg
- newLabel :: FastString -> CmmParse BlockId
- newBlockId :: CmmParse BlockId
- newFunctionName :: FastString -> PackageId -> ExtCode
- newImport :: (FastString, CLabel) -> CmmParse ()
- lookupLabel :: FastString -> CmmParse BlockId
- lookupName :: FastString -> CmmParse CmmExpr
- code :: FCode a -> CmmParse a
- emit :: CmmAGraph -> CmmParse ()
- emitLabel :: BlockId -> CmmParse ()
- emitAssign :: CmmReg -> CmmExpr -> CmmParse ()
- emitStore :: CmmExpr -> CmmExpr -> CmmParse ()
- getCode :: CmmParse a -> CmmParse CmmAGraph
- getCodeR :: CmmParse a -> CmmParse (a, CmmAGraph)
- emitOutOfLine :: BlockId -> CmmAGraph -> CmmParse ()
- withUpdFrameOff :: UpdFrameOffset -> CmmParse () -> CmmParse ()
- getUpdFrameOff :: CmmParse UpdFrameOffset
Documentation
Does a computation in the FCode monad, with a current environment and a list of local declarations. Returns the resulting list of declarations.
The environment contains variable definitions or blockids.
loopDecls :: CmmParse a -> CmmParse aSource
Takes the variable decarations 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'
:: CmmType | data type |
-> FastString | name of variable |
-> CmmParse LocalReg | register holding the value |
Create a fresh local variable of a given type.
newLabel :: FastString -> CmmParse BlockIdSource
Allocate a fresh label.
:: FastString | name of the function |
-> PackageId | package of the current module |
-> ExtCode |
Add add a local function to the environment.
newImport :: (FastString, CLabel) -> CmmParse ()Source
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.
lookupLabel :: FastString -> CmmParse BlockIdSource
Lookup the BlockId bound to the label with this name. If one hasn't been bound yet, create a fresh one based on the Unique of the name.
lookupName :: FastString -> CmmParse CmmExprSource
Lookup the location of a named variable. Unknown names are treated as if they had been 'import'ed 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.
emitAssign :: CmmReg -> CmmExpr -> CmmParse ()Source
emitOutOfLine :: BlockId -> CmmAGraph -> CmmParse ()Source
withUpdFrameOff :: UpdFrameOffset -> CmmParse () -> CmmParse ()Source