| harpy-0.2: Runtime code generation for x86 machine code | Contents | Index |
|
Harpy.X86CGCombinators | Portability | portable (but generated code non-portable) | Stability | quite experimental | Maintainer | {magr,klee}@cs.tu-berlin.de |
|
|
|
|
|
Description |
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.
|
|
Synopsis |
|
|
|
|
Types
|
|
data UserState |
User state is used to maintain bitmask of registers currently in use.
| Constructors | |
|
|
data UserEnv |
User environment stores code generators for accessing specific
variables as well as the current data and control destinations
| Constructors | |
|
|
data CtrlDest |
Destination for control transfers
| Constructors | FallThrough | Go to next instruction
| Return | Return from current functio
| Goto Label | Go to specific label
| Branch CtrlDest CtrlDest | Go to one of the given labels
depending on outcome of test
|
|
|
|
data DataDest |
Destination for a calculated value.
| Constructors | RegDest Word8 | Store into specific register
| StackDest | Push onto stack
| MemBaseDest Word8 Word32 | Store at memory address
| Ignore | Throw result away.
|
|
|
|
Combinators
|
|
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 () |
|
withDataDest :: DataDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r |
Set the data destinations to the given values while
running the code generator.
|
|
withCtrlDest :: CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r |
Set the control destinations to the given values while
running the code generator.
|
|
withDest :: DataDest -> CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s r |
Set the data and control destinations to the given values while
running the code generator.
|
|
function :: CodeGen UserEnv s r -> CodeGen UserEnv s r |
Emit the necessary function prolog and epilog code and invoke the
given code generator for the code inbetween.
|
|
withRegister :: (Word8 -> CodeGen e UserState t) -> CodeGen e UserState () |
Apply the given cg to a register, which is reserved while the
generator is running.
|
|
Produced by Haddock version 0.8 |