Struct rustc_mir_transform::coverage::graph::CoverageGraph
source · pub(super) struct CoverageGraph {
bcbs: IndexVec<BasicCoverageBlock, BasicCoverageBlockData>,
bb_to_bcb: IndexVec<BasicBlock, Option<BasicCoverageBlock>>,
pub successors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>,
pub predecessors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>,
dominators: Option<Dominators<BasicCoverageBlock>>,
}
Expand description
A coverage-specific simplification of the MIR control flow graph (CFG). The CoverageGraph
s
nodes are BasicCoverageBlock
s, which encompass one or more MIR BasicBlock
s, plus a
CoverageKind
counter (to be added by CoverageCounters::make_bcb_counters
), and an optional
set of additional counters–if needed–to count incoming edges, if there are more than one.
(These “edge counters” are eventually converted into new MIR BasicBlock
s.)
Fields
bcbs: IndexVec<BasicCoverageBlock, BasicCoverageBlockData>
bb_to_bcb: IndexVec<BasicBlock, Option<BasicCoverageBlock>>
successors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>
predecessors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>
dominators: Option<Dominators<BasicCoverageBlock>>
Implementations
sourceimpl CoverageGraph
impl CoverageGraph
pub fn from_mir(mir_body: &Body<'_>) -> Self
fn compute_basic_coverage_blocks(
mir_body: &Body<'_>
) -> (IndexVec<BasicCoverageBlock, BasicCoverageBlockData>, IndexVec<BasicBlock, Option<BasicCoverageBlock>>)
fn add_basic_coverage_block(
bcbs: &mut IndexVec<BasicCoverageBlock, BasicCoverageBlockData>,
bb_to_bcb: &mut IndexVec<BasicBlock, Option<BasicCoverageBlock>>,
basic_blocks: Vec<BasicBlock>
)
pub fn iter_enumerated(
&self
) -> impl Iterator<Item = (BasicCoverageBlock, &BasicCoverageBlockData)>
pub fn iter_enumerated_mut(
&mut self
) -> impl Iterator<Item = (BasicCoverageBlock, &mut BasicCoverageBlockData)>
pub fn bcb_from_bb(&self, bb: BasicBlock) -> Option<BasicCoverageBlock>
pub fn is_dominated_by(
&self,
node: BasicCoverageBlock,
dom: BasicCoverageBlock
) -> bool
pub fn dominators(&self) -> &Dominators<BasicCoverageBlock>
Trait Implementations
sourceimpl Debug for CoverageGraph
impl Debug for CoverageGraph
sourceimpl DirectedGraph for CoverageGraph
impl DirectedGraph for CoverageGraph
type Node = BasicCoverageBlock
sourceimpl<'graph> GraphPredecessors<'graph> for CoverageGraph
impl<'graph> GraphPredecessors<'graph> for CoverageGraph
type Item = BasicCoverageBlock
type Iter = Copied<Iter<'graph, BasicCoverageBlock>>
sourceimpl<'graph> GraphSuccessors<'graph> for CoverageGraph
impl<'graph> GraphSuccessors<'graph> for CoverageGraph
type Item = BasicCoverageBlock
type Iter = Cloned<Iter<'graph, BasicCoverageBlock>>
sourceimpl Index<BasicCoverageBlock> for CoverageGraph
impl Index<BasicCoverageBlock> for CoverageGraph
type Output = BasicCoverageBlockData
type Output = BasicCoverageBlockData
The returned type after indexing.
sourcefn index(&self, index: BasicCoverageBlock) -> &BasicCoverageBlockData
fn index(&self, index: BasicCoverageBlock) -> &BasicCoverageBlockData
Performs the indexing (
container[index]
) operation. Read moresourceimpl IndexMut<BasicCoverageBlock> for CoverageGraph
impl IndexMut<BasicCoverageBlock> for CoverageGraph
sourcefn index_mut(&mut self, index: BasicCoverageBlock) -> &mut BasicCoverageBlockData
fn index_mut(&mut self, index: BasicCoverageBlock) -> &mut BasicCoverageBlockData
Performs the mutable indexing (
container[index]
) operation. Read moresourceimpl WithNumNodes for CoverageGraph
impl WithNumNodes for CoverageGraph
sourceimpl WithPredecessors for CoverageGraph
impl WithPredecessors for CoverageGraph
fn predecessors(&self, node: Self::Node) -> Copied<Iter<'_, BasicCoverageBlock>>
sourceimpl WithStartNode for CoverageGraph
impl WithStartNode for CoverageGraph
fn start_node(&self) -> Self::Node
sourceimpl WithSuccessors for CoverageGraph
impl WithSuccessors for CoverageGraph
fn successors(&self, node: Self::Node) -> Cloned<Iter<'_, BasicCoverageBlock>>
fn depth_first_search(&self, from: Self::Node) -> DepthFirstSearch<'_, Self>where
Self: WithNumNodes,
Auto Trait Implementations
impl RefUnwindSafe for CoverageGraph
impl Send for CoverageGraph
impl Sync for CoverageGraph
impl Unpin for CoverageGraph
impl UnwindSafe for CoverageGraph
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 144 bytes