Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- type Body n = LabelMap (Block n C C)
- type Graph = Graph' Block
- data Graph' block (n :: * -> * -> *) e x where
- class NonLocal thing where
- addBlock :: NonLocal thing => thing C C -> LabelMap (thing C C) -> LabelMap (thing C C)
- bodyList :: Body' block n -> [(Label, block n C C)]
- emptyBody :: Body' block n
- labelsDefined :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
- mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x
- mapGraphBlocks :: forall block n block' n' e x. (forall e x. block n e x -> block' n' e x) -> Graph' block n e x -> Graph' block' n' e x
- postorder_dfs_from :: (NonLocal block, LabelsPtr b) => LabelMap (block C C) -> b -> [block C C]

# Documentation

type Graph = Graph' Block Source #

A control-flow graph, which may take any of four shapes (O/O,
O*C, C*O, C/C). A graph open at the entry has a single,
distinguished, anonymous entry point; if a graph is closed at the
entry, its entry point(s) are supplied by a context.

data Graph' block (n :: * -> * -> *) e x where Source #

`Graph'`

is abstracted over the block type, so that we can build
graphs of annotated blocks for example (Compiler.Hoopl.Dataflow
needs this).

class NonLocal thing where Source #

Gives access to the anchor points for nonlocal edges as well as the edges themselves

mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x Source #

Maps over all nodes in a graph.

mapGraphBlocks :: forall block n block' n' e x. (forall e x. block n e x -> block' n' e x) -> Graph' block n e x -> Graph' block' n' e x Source #

Function `mapGraphBlocks`

enables a change of representation of blocks,
nodes, or both. It lifts a polymorphic block transform into a polymorphic
graph transform. When the block representation stabilizes, a similar
function should be provided for blocks.