ghc-9.10.3: The GHC API

Copyright | (c) Matt Morrow 2009
License | BSD3
Maintainer | <klebinger.andreas@gmx.at>
Stability | stable
Portability | portable
Safe Haskell | None
Language | GHC2021

GHC.CmmToAsm.CFG.Dominators

Description

The Lengauer-Tarjan graph dominators algorithm.

\[1\] Lengauer, Tarjan, A Fast Algorithm for Finding Dominators in a Flowgraph, 1979.

\[2\] Muchnick, Advanced Compiler Design and Implementation, 1997.

\[3\] Brisk, Sarrafzadeh, Interference CGraphs for Procedures in Static Single Information Form are Interval CGraphs, 2007.

- Strictness

Unless stated otherwise all exposed functions might fully evaluate their input but are not guaranteed to do so.

Synopsis

- type Node = Word64
- type Path = [Node]
- type Edge = (Node, Node)
- type Graph = Word64Map Word64Set
- type Rooted = (Node, Graph)
- idom :: Rooted -> [(Node, Node)]
- ipdom :: Rooted -> [(Node, Node)]
- domTree :: Rooted -> Tree Node
- pdomTree :: Rooted -> Tree Node
- dom :: Rooted -> [(Node, Path)]
- pdom :: Rooted -> [(Node, Path)]
- pddfs :: Rooted -> [Node]
- rpddfs :: Rooted -> [Node]
- fromAdj :: [(Node, [Node])] -> Graph
- fromEdges :: [Edge] -> Graph
- toAdj :: Graph -> [(Node, [Node])]
- toEdges :: Graph -> [Edge]
- asTree :: Rooted -> Tree Node
- asCGraph :: Tree Node -> Rooted
- parents :: Tree a -> [(a, a)]
- ancestors :: Tree a -> [(a, [a])]

# Documentation

type Node = Word64 Source #

type Path = [Node] Source #

type Edge = (Node, Node) Source #

type Graph = Word64Map Word64Set Source #

type Rooted = (Node, Graph) Source #

idom :: Rooted -> [(Node, Node)] Source #

Immediate dominators. O(|E|*alpha(|E|,|V|)), where alpha(m,n) is "a functional inverse of Ackermann's function".

This Complexity bound assumes O(1) indexing. Since we're using `IntMap`, it has an additional lg |V| factor somewhere in there. I'm not sure where.

ipdom :: Rooted -> [(Node, Node)] Source #

Immediate post-dominators. Complexity as for `idom`.

domTree :: Rooted -> Tree Node Source #

Dominator tree. Complexity as for `idom`.

pdomTree :: Rooted -> Tree Node Source #

Post-dominator tree. Complexity as for `idom`.

dom :: Rooted -> [(Node, Path)] Source #

Dominators. Complexity as for `idom`

pdom :: Rooted -> [(Node, Path)] Source #

Post-dominators. Complexity as for `idom`.

pddfs :: Rooted -> [Node] Source #

Post-dominated depth-first search.

rpddfs :: Rooted -> [Node] Source #

Reverse post-dominated depth-first search.

fromAdj :: [(Node, [Node])] -> Graph Source #

fromEdges :: [Edge] -> Graph Source #

toAdj :: Graph -> [(Node, [Node])] Source #

toEdges :: Graph -> [Edge] Source #

asTree :: Rooted -> Tree Node Source #

asCGraph :: Tree Node -> Rooted Source #

parents :: Tree a -> [(a, a)] Source #

ancestors :: Tree a -> [(a, [a])] Source #