harpy-0.4: Runtime code generation for x86 machine codeSource codeContentsIndex
Harpy.X86CGCombinators
Portabilityportable (but generated code non-portable)
Stabilityquite experimental
Maintainer{magr,klee}@cs.tu-berlin.de
Contents
Types
Combinators
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
data UserState = UserState {
}
data UserEnv = UserEnv {
bindings :: [(String, CodeGen UserEnv UserState ())]
dataDest :: DataDest
ctrlDest :: CtrlDest
}
emptyUserEnv :: UserEnv
emptyUserState :: UserState
data CtrlDest
= FallThrough
| Return
| Goto Label
| Branch CtrlDest CtrlDest
data DataDest
= RegDest Reg32
| StackDest
| MemBaseDest Reg32 Word32
| Ignore
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
data UserState Source
User state is used to maintain bitmask of registers currently in use.
Constructors
UserState
data UserEnv Source
User environment stores code generators for accessing specific variables as well as the current data and control destinations
Constructors
UserEnv
bindings :: [(String, CodeGen UserEnv UserState ())]
dataDest :: DataDest
ctrlDest :: CtrlDest
emptyUserEnv :: UserEnvSource
emptyUserState :: UserStateSource
data CtrlDest Source
Destination for control transfers
Constructors
FallThroughGo to next instruction
ReturnReturn from current functio
Goto LabelGo to specific label
Branch CtrlDest CtrlDestGo to one of the given labels depending on outcome of test
data DataDest Source
Destination for a calculated value.
Constructors
RegDest Reg32Store into specific register
StackDestPush onto stack
MemBaseDest Reg32 Word32Store at memory address
IgnoreThrow result away.
Combinators
ifThenElse :: CodeGen UserEnv s r -> CodeGen UserEnv s a -> CodeGen UserEnv s a1 -> CodeGen UserEnv s ()Source
doWhile :: CodeGen UserEnv s r -> CodeGen UserEnv s a -> CodeGen UserEnv s ()Source
continue :: CodeGen UserEnv s ()Source
continueBranch :: Int -> Bool -> 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 rSource
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 rSource
Set the data destinations to the given values while running the code generator.
withCtrlDest :: CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s rSource
Set the control destinations to the given values while running the code generator.
withDest :: DataDest -> CtrlDest -> CodeGen UserEnv s r -> CodeGen UserEnv s rSource
Set the data and control destinations to the given values while running the code generator.
Produced by Haddock version 2.1.0