ddc-core-llvm- Disciplined Disciple Compiler LLVM code generator.

Safe HaskellNone




Block Graphs

data Graph a Source

Llvm block graph. We use this form for transformations, as it makes it easy to find blocks and attach annotations to them.




graphEntry :: Label

The entry node for the block graph.

graphNodes :: Map Label (Node a)

Internal nodes.


Show a => Show (Graph a) Source 

data Node a Source

A block of instructions, and an optional annotation.




nodeLabel :: Label

Block label for the node.

nodeInstrs :: Seq AnnotInstr

Statements in this node, with meta-data annotations.

nodeAnnot :: a

Optional annotation on the node.


Show a => Show (Node a) Source 

Graph Utils

graphOfBlocks :: a -> [Block] -> Maybe (Graph a) Source

Convert a list of blocks to a block graph.

blocksOfGraph :: Graph a -> [Block] Source

Flatten a graph back into a list of blocks.

labelsOfGraph :: Graph a -> [Label] Source

Get the set of all block labels in a graph.

lookupNodeOfGraph :: Graph a -> Label -> Maybe (Node a) Source

Lookup a node from the graph, or Nothing if it can't be found.

modifyNodeOfGraph Source


:: Label

Label of node to modify.

-> (Node a -> Node a)

Function to apply to the node.

-> Graph a 
-> Graph a 

Apply a function to a single node in the graoh.

mapNodesOfGraph :: (Node a -> Node b) -> Graph a -> Graph b Source

Apply a function to every node in the graph.

mapAnnotsOfGraph :: (a -> b) -> Graph a -> Graph b Source

Apply a function to every node annotation in the graph.

Node Utils

blockOfNode :: Node a -> Block Source

Convert a Node to Block form, dropping any annotation.

childrenOfNode :: Node a -> Set Label Source

Get the children of a node.