flocc-pffb

Stabilityexperimental
Maintainerdeveloper@flocc.net
Safe HaskellNone

Compiler.Back.GraphBuilder

Description

For more information please see http://www.flocc.net/

Synopsis

Documentation

nd :: NodeId -> [NodeId] -> [NodeId] -> NodeTy -> Node

type GraphBuilder m = StateT GBuildSt (StateT (NodeEnv Ty) (StateT IdxSet m))

addExpToNodeMapping :: Monad m => Idx -> Idx -> GraphBuilder m ()

addExpToNodeMapping adds a mapping between the expression id and the node id |that supercedes it.

addNode :: Monad m => Node -> GraphBuilder m ()

addNode takes a node id and a list of input node ids, along with node and edge |information, within a state monad containing a map of var ids to node ids, and |the DFG, and adds this node to the DFG.

addVarBinding :: Monad m => Idx -> String -> Idx -> GraphBuilder m ()

addVarBinding takes a var id and an node id, and records a binding between |the two in the state.

makeTupleAccessorNodes :: Monad m => Idx -> IdxTree -> GraphBuilder m ()

makeTupleAccessorNodes takes an idx tree and input node id |and creates tuple accessor nodes for all nodes in the tree.

addVarBindings :: Monad m => IdxTree -> Expr -> GraphBuilder m ()

addVarBindings takes an idx tree and an expression and adds the maps |between var ids and expression ids to the bindings.

addIdxTreeBindingsR :: Monad m => Int -> Idx -> IdxTree -> GraphBuilder m ()

addIdxTreeBindings adds new VarNodes to the current graph |for all of the ids in the IdxTree

addIdxTreeBindingsR tupleOffset nodeId indexTree. Creates tuple accessor nodes |for the sub tree it, using nodeid as an input.

addIdxTreeBindings :: Monad m => IdxTree -> GraphBuilder m Idx

addIdxTreeBindings idxTree. Creates nodes for the idx tree pattern.

addVarNode :: Monad m => Idx -> Node -> GraphBuilder m Idx

addVarNode takes a var id and a node, and adds the node to the graph |and adds its id to the output list of the expression that its bound to.

getGraphInputs :: Graph -> IntSet

getDFG inputs takes a DFG and returns all the node id's that occur as inputs |that are not defined in the graph.

exprToGraph :: Monad m => NodeEnv Ty -> Expr -> GraphBuilder m Idx

exprToDFG takes an expression and creates a DFG in the state transformer, |returning the node id of the expression.

graphFromExpr :: Monad m => NodeEnv Ty -> Expr -> IdxMonad m (Graph, NodeEnv Ty)

graphFromExpr takes an expression and returns the corresponding |data flow graph.

mapNodeM :: Monad m => (Node -> m Node) -> Node -> m Node

mapGraphM :: Monad m => (Node -> m Node) -> Graph -> m Graph

encapFun :: Monad m => Node -> Ty -> StateT (NodeEnv Ty) (IdxMonad m) Node

encapFun node ty. Encapsulates n in a FunNd subgraph, and adds types of new |expressions to the state.

encapFuns :: Monad m => Node -> StateT (NodeEnv Ty) (IdxMonad m) Node

encapFun n. If n is a var with a function type, then encapsulate it: replace it with a |a simple FunNd with a subgraph that calls it.