]>
Commit | Line | Data |
---|---|---|
3157f602 XL |
1 | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | use super::indexed_vec::Idx; | |
12 | pub use std::slice::Iter; | |
13 | ||
14 | pub mod dominators; | |
15 | pub mod iterate; | |
16 | pub mod reachable; | |
17 | mod reference; | |
18 | pub mod transpose; | |
19 | ||
20 | #[cfg(test)] | |
21 | mod test; | |
22 | ||
23 | pub trait ControlFlowGraph | |
24 | where Self: for<'graph> GraphPredecessors<'graph, Item=<Self as ControlFlowGraph>::Node>, | |
25 | Self: for<'graph> GraphSuccessors<'graph, Item=<Self as ControlFlowGraph>::Node> | |
26 | { | |
27 | type Node: Idx; | |
28 | ||
29 | fn num_nodes(&self) -> usize; | |
30 | fn start_node(&self) -> Self::Node; | |
31 | fn predecessors<'graph>(&'graph self, node: Self::Node) | |
32 | -> <Self as GraphPredecessors<'graph>>::Iter; | |
33 | fn successors<'graph>(&'graph self, node: Self::Node) | |
34 | -> <Self as GraphSuccessors<'graph>>::Iter; | |
35 | } | |
36 | ||
37 | pub trait GraphPredecessors<'graph> { | |
38 | type Item; | |
c30ab7b3 | 39 | type Iter: Iterator<Item = Self::Item>; |
3157f602 XL |
40 | } |
41 | ||
42 | pub trait GraphSuccessors<'graph> { | |
43 | type Item; | |
c30ab7b3 SL |
44 | type Iter: Iterator<Item = Self::Item>; |
45 | } |