pub(crate) struct CoverageGraph {
bcbs: IndexVec<BasicCoverageBlock, BasicCoverageBlockData>,
bb_to_bcb: IndexVec<BasicBlock, Option<BasicCoverageBlock>>,
pub(crate) successors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>,
pub(crate) predecessors: IndexVec<BasicCoverageBlock, Vec<BasicCoverageBlock>>,
dominators: Option<Dominators<BasicCoverageBlock>>,
dominator_order_rank: IndexVec<BasicCoverageBlock, u32>,
is_loop_header: BitSet<BasicCoverageBlock>,
enclosing_loop_header: IndexVec<BasicCoverageBlock, Option<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.
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>>
§dominator_order_rank: IndexVec<BasicCoverageBlock, u32>
Allows nodes to be compared in some total order such that if
a
dominates b
, then a < b
. If neither node dominates the other,
their relative order is consistent but arbitrary.
is_loop_header: BitSet<BasicCoverageBlock>
A loop header is a node that dominates one or more of its predecessors.
enclosing_loop_header: IndexVec<BasicCoverageBlock, Option<BasicCoverageBlock>>
For each node, the loop header node of its nearest enclosing loop. This forms a linked list that can be traversed to find all enclosing loops.
Implementations§
Source§impl CoverageGraph
impl CoverageGraph
pub(crate) fn from_mir(mir_body: &Body<'_>) -> Self
fn compute_basic_coverage_blocks( mir_body: &Body<'_>, ) -> (IndexVec<BasicCoverageBlock, BasicCoverageBlockData>, IndexVec<BasicBlock, Option<BasicCoverageBlock>>)
pub(crate) fn iter_enumerated( &self, ) -> impl Iterator<Item = (BasicCoverageBlock, &BasicCoverageBlockData)>
pub(crate) fn bcb_from_bb(&self, bb: BasicBlock) -> Option<BasicCoverageBlock>
fn dominators(&self) -> &Dominators<BasicCoverageBlock>
pub(crate) fn dominates( &self, dom: BasicCoverageBlock, node: BasicCoverageBlock, ) -> bool
pub(crate) fn cmp_in_dominator_order( &self, a: BasicCoverageBlock, b: BasicCoverageBlock, ) -> Ordering
Sourcepub(crate) fn sole_predecessor(
&self,
to_bcb: BasicCoverageBlock,
) -> Option<BasicCoverageBlock>
pub(crate) fn sole_predecessor( &self, to_bcb: BasicCoverageBlock, ) -> Option<BasicCoverageBlock>
Returns the source of this node’s sole in-edge, if it has exactly one. That edge can be assumed to have the same execution count as the node itself (in the absence of panics).
Sourcepub(crate) fn simple_successor(
&self,
from_bcb: BasicCoverageBlock,
) -> Option<BasicCoverageBlock>
pub(crate) fn simple_successor( &self, from_bcb: BasicCoverageBlock, ) -> Option<BasicCoverageBlock>
Returns the target of this node’s sole out-edge, if it has exactly one, but only if that edge can be assumed to have the same execution count as the node itself (in the absence of panics).
Sourcepub(crate) fn loop_headers_containing(
&self,
bcb: BasicCoverageBlock,
) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_>
pub(crate) fn loop_headers_containing( &self, bcb: BasicCoverageBlock, ) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_>
For each loop that contains the given node, yields the “loop header” node representing that loop, from innermost to outermost. If the given node is itself a loop header, it is yielded first.
Sourcepub(crate) fn reloop_predecessors(
&self,
to_bcb: BasicCoverageBlock,
) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_>
pub(crate) fn reloop_predecessors( &self, to_bcb: BasicCoverageBlock, ) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_>
For the given node, yields the subset of its predecessor nodes that it dominates. If that subset is non-empty, the node is a “loop header”, and each of those predecessors represents an in-edge that jumps back to the top of its loop.
Trait Implementations§
Source§impl Debug for CoverageGraph
impl Debug for CoverageGraph
Source§impl DirectedGraph for CoverageGraph
impl DirectedGraph for CoverageGraph
Source§impl Index<BasicCoverageBlock> for CoverageGraph
impl Index<BasicCoverageBlock> for CoverageGraph
Source§type Output = BasicCoverageBlockData
type Output = BasicCoverageBlockData
Source§fn index(&self, index: BasicCoverageBlock) -> &BasicCoverageBlockData
fn index(&self, index: BasicCoverageBlock) -> &BasicCoverageBlockData
container[index]
) operation. Read moreSource§impl IndexMut<BasicCoverageBlock> for CoverageGraph
impl IndexMut<BasicCoverageBlock> for CoverageGraph
Source§fn index_mut(
&mut self,
index: BasicCoverageBlock,
) -> &mut BasicCoverageBlockData
fn index_mut( &mut self, index: BasicCoverageBlock, ) -> &mut BasicCoverageBlockData
container[index]
) operation. Read moreSource§impl Predecessors for CoverageGraph
impl Predecessors for CoverageGraph
Source§impl StartNode for CoverageGraph
impl StartNode for CoverageGraph
fn start_node(&self) -> Self::Node
Source§impl Successors for CoverageGraph
impl Successors for CoverageGraph
Auto Trait Implementations§
impl DynSend for CoverageGraph
impl DynSync for CoverageGraph
impl Freeze for CoverageGraph
impl RefUnwindSafe for CoverageGraph
impl Send for CoverageGraph
impl Sync for CoverageGraph
impl Unpin for CoverageGraph
impl UnwindSafe for CoverageGraph
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ControlFlowGraph for T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 224 bytes