Trait hugr::algorithms::nest_cfgs::CfgNodeMap
source · pub trait CfgNodeMap<T> {
type Iterator<'c>: Iterator<Item = T>
where Self: 'c;
// Required methods
fn entry_node(&self) -> T;
fn exit_node(&self) -> T;
fn successors(&self, node: T) -> Self::Iterator<'_>;
fn predecessors(&self, node: T) -> Self::Iterator<'_>;
}
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. 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 Associated Types§
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) -> Self::Iterator<'_>
fn successors(&self, node: T) -> Self::Iterator<'_>
Returns an iterator over the successors of the specified basic block.
sourcefn predecessors(&self, node: T) -> Self::Iterator<'_>
fn predecessors(&self, node: T) -> Self::Iterator<'_>
Returns an iterator over the predecessors of the specified basic block.