pub struct DominanceFrontierResult {
pub frontiers: AHashMap<i64, AHashSet<i64>>,
}Expand description
Dominance frontier result for a CFG.
Contains the dominance frontier sets for all nodes. The dominance frontier
of a node n is the set of nodes m where control flow from paths dominated
by n merges with paths from outside n’s dominance.
§Example
let result = dominance_frontiers(&graph, &dom_result)?;
// Check dominance frontier of node 0
if let Some(frontier) = result.frontier(0) {
for &node in frontier {
println!("Node 0 is in DF of {}", node);
}
}
// Check if node 3 is in DF of node 0
assert!(result.in_frontier(0, 3));Fields§
§frontiers: AHashMap<i64, AHashSet<i64>>Dominance frontier sets: node -> set of nodes in its dominance frontier.
For each node n, frontiers[n] contains all nodes m such that:
ndominates a predecessor ofmndoes NOT strictly dominatem
Empty set means n has no convergence points in its dominance.
Implementations§
Source§impl DominanceFrontierResult
impl DominanceFrontierResult
Sourcepub fn frontier(&self, node: i64) -> Option<&AHashSet<i64>>
pub fn frontier(&self, node: i64) -> Option<&AHashSet<i64>>
Gets the dominance frontier of a node.
Returns None if the node has no dominance frontier (empty set).
§Arguments
node- Node ID to get dominance frontier for
§Returns
Some(set) if node has a non-empty dominance frontier, None if empty.
§Example
let result = dominance_frontiers(&graph, &dom_result)?;
if let Some(frontier) = result.frontier(0) {
println!("Node 0 DF: {:?}", frontier);
}Sourcepub fn in_frontier(&self, n: i64, m: i64) -> bool
pub fn in_frontier(&self, n: i64, m: i64) -> bool
Checks if one node is in the dominance frontier of another.
Returns true if m is in DF(n) (node n’s dominance frontier).
§Arguments
n- Node whose dominance frontier to checkm- Node to check membership inDF(n)
§Returns
true if m is in the dominance frontier of n, false otherwise.
§Example
let result = dominance_frontiers(&graph, &dom_result)?;
assert!(result.in_frontier(0, 3)); // Node 3 is in DF(0)Trait Implementations§
Source§impl Clone for DominanceFrontierResult
impl Clone for DominanceFrontierResult
Source§fn clone(&self) -> DominanceFrontierResult
fn clone(&self) -> DominanceFrontierResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DominanceFrontierResult
impl RefUnwindSafe for DominanceFrontierResult
impl Send for DominanceFrontierResult
impl Sync for DominanceFrontierResult
impl Unpin for DominanceFrontierResult
impl UnwindSafe for DominanceFrontierResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more