| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| Description | |||||||||||||||||||||||||||||||||||||
Converts the jump and label linear instruction list into a flow graph, this aids later optimisation and memory phases. It also includes the code for the graph monad which is used extensively in later analysis processes. | |||||||||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| Bytecode graph conversion | |||||||||||||||||||||||||||||||||||||
| bcGraph :: BCModule -> BCModule | |||||||||||||||||||||||||||||||||||||
| Turn linear bytecode into a graph representation. | |||||||||||||||||||||||||||||||||||||
| Graph state monad | |||||||||||||||||||||||||||||||||||||
| data GState x | |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||
| type GraphMonad x a = State (GState x) a | |||||||||||||||||||||||||||||||||||||
| A graph monad with a given extra state, returning a given value | |||||||||||||||||||||||||||||||||||||
| gGetStart :: GraphMonad x GLabel | |||||||||||||||||||||||||||||||||||||
| gSetStart :: GLabel -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| gGetLabels :: GraphMonad x [GLabel] | |||||||||||||||||||||||||||||||||||||
| gGetNode :: GLabel -> GraphMonad x GraphNode | |||||||||||||||||||||||||||||||||||||
| gSetNode :: GLabel -> GraphNode -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| gGetJumpers :: GLabel -> GraphMonad x (Set GLabel) | |||||||||||||||||||||||||||||||||||||
| gSetJumpers :: GLabel -> Set GLabel -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| gAddJumpers :: GLabel -> Set GLabel -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| gRemoveJumpers :: GLabel -> Set GLabel -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| gAlwaysReturns :: GLabel -> GraphMonad x Bool | |||||||||||||||||||||||||||||||||||||
| Given a node, chase down it to see if it invariably ends up at a return without doing anything substantial on the way | |||||||||||||||||||||||||||||||||||||
| gReadX :: (x -> a) -> GraphMonad x a | |||||||||||||||||||||||||||||||||||||
| gWriteX :: (x -> (x, a)) -> GraphMonad x a | |||||||||||||||||||||||||||||||||||||
| gWriteX_ :: (x -> x) -> GraphMonad x () | |||||||||||||||||||||||||||||||||||||
| module StateMonad | |||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 | |||||||||||||||||||||||||||||||||||||