Copyright | (c) 2006-2015 Martin Grabmueller and Dirk Kleeblatt |
---|---|
License | BSD3 |
Maintainer | martin@grabmueller.de |
Stability | quite experimental |
Portability | portable (but generated code non-portable) |
Safe Haskell | None |
Language | Haskell98 |
This module exports several combinators for writing loops, conditionals and function prolog/epilog code.
Note: this module is under heavy development and the exported API is definitely not yet stable.
- data UserState = UserState {
- data UserEnv = UserEnv {}
- emptyUserEnv :: UserEnv
- emptyUserState :: UserState
- data CtrlDest
- data DataDest
- ifThenElse :: CodeGen UserEnv s r -> CodeGen UserEnv s a -> CodeGen UserEnv s a1 -> CodeGen UserEnv s ()
- doWhile :: CodeGen UserEnv s r -> CodeGen UserEnv s a -> CodeGen UserEnv s ()
- continue :: CodeGen UserEnv s ()
- continueBranch :: Int -> Bool -> CodeGen UserEnv s ()
- saveRegs :: [Reg32] -> CodeGen UserEnv s r -> CodeGen UserEnv s ()
- function :: CodeGen UserEnv s r -> CodeGen UserEnv s r
- withDataDest :: DataDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r
- withCtrlDest :: CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r
- withDest :: DataDest -> CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r
Types
User environment stores code generators for accessing specific variables as well as the current data and control destinations
Destination for control transfers
Destination for a calculated value.
Combinators
ifThenElse :: CodeGen UserEnv s r -> CodeGen UserEnv s a -> CodeGen UserEnv s a1 -> CodeGen UserEnv s () Source
saveRegs :: [Reg32] -> CodeGen UserEnv s r -> CodeGen UserEnv s () Source
Save a number of registers on the stack, perform the given code generation, and restore the registers.
function :: CodeGen UserEnv s r -> CodeGen UserEnv s r Source
Emit the necessary function prolog and epilog code and invoke the given code generator for the code inbetween.
withDataDest :: DataDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r Source
Set the data destinations to the given values while running the code generator.