module DDC.Llvm.Analysis.Children
( Children (..)
, annotChildrenOfGraph
, annotChildrenOfNode
, childrenOfNode)
where
import DDC.Llvm.Syntax
import DDC.Llvm.Graph
import Data.Set (Set)
import qualified Data.Map as Map
data Children
= Children (Set Label)
annotChildrenOfGraph
:: Graph a -> Graph (a, Children)
annotChildrenOfGraph (Graph entry nodes)
= Graph entry
$ Map.map annotChildrenOfNode nodes
annotChildrenOfNode
:: Node a -> Node (a, Children)
annotChildrenOfNode node@(Node label instrs annot)
= Node label instrs
$ (annot, Children $ childrenOfNode node)