pub trait CfgNodeMap<T> {
// Required methods
fn entry_node(&self) -> T;
fn exit_node(&self) -> T;
fn successors(&self, node: T) -> impl Iterator<Item = T>;
fn predecessors(&self, node: T) -> impl Iterator<Item = T>;
}
Expand description
A “view” of a CFG in a Hugr which allows basic blocks in the underlying CFG to be split into multiple blocks in the view (or merged together).
T
is the type of basic block; this can just be a BasicBlock
(e.g. hugr_core::Node
) in the Hugr,
or an IdentityCfgMap
if the extra level of indirection is not required. However, since
SESE regions are bounded by edges between pairs of such T
, such splitting may allow the
algorithm to identify more regions than existed in the underlying CFG, without mutating the
underlying CFG just for the analysis - the splitting (and/or merging) can then be performed by
CfgNester::nest_sese_region
only as necessary for regions actually nested.
Required Methods§
Sourcefn entry_node(&self) -> T
fn entry_node(&self) -> T
The unique entry node of the CFG. It may any n>=0 of incoming edges; we assume control arrives here from “outside”.
Sourcefn successors(&self, node: T) -> impl Iterator<Item = T>
fn successors(&self, node: T) -> impl Iterator<Item = T>
Returns an iterator over the successors of the specified basic block.
Sourcefn predecessors(&self, node: T) -> impl Iterator<Item = T>
fn predecessors(&self, node: T) -> impl Iterator<Item = T>
Returns an iterator over the predecessors of the specified basic block.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.