Skip to content

Commit

Permalink
Kill dead code dominator code.
Browse files Browse the repository at this point in the history
  • Loading branch information
vext01 committed Apr 9, 2019
1 parent 3750348 commit 3262d1e
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions src/librustc_data_structures/graph/dominators/mod.rs
Expand Up @@ -8,8 +8,6 @@ use super::super::indexed_vec::{Idx, IndexVec};
use super::iterate::reverse_post_order;
use super::ControlFlowGraph;

use std::fmt;

#[cfg(test)]
mod test;

Expand Down Expand Up @@ -158,48 +156,3 @@ impl<'dom, Node: Idx> Iterator for Iter<'dom, Node> {
}
}
}

pub struct DominatorTree<N: Idx> {
root: N,
children: IndexVec<N, Vec<N>>,
}

impl<Node: Idx> DominatorTree<Node> {
pub fn children(&self, node: Node) -> &[Node] {
&self.children[node]
}
}

impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(
&DominatorTreeNode {
tree: self,
node: self.root,
},
fmt,
)
}
}

struct DominatorTreeNode<'tree, Node: Idx> {
tree: &'tree DominatorTree<Node>,
node: Node,
}

impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let subtrees: Vec<_> = self.tree
.children(self.node)
.iter()
.map(|&child| DominatorTreeNode {
tree: self.tree,
node: child,
})
.collect();
fmt.debug_tuple("")
.field(&self.node)
.field(&subtrees)
.finish()
}
}

0 comments on commit 3262d1e

Please sign in to comment.