Struct rustc_mir_transform::coverage::graph::CoverageGraph
source · 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>>,
}
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>>
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>
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 bcb_has_multiple_in_edges(&self, bcb: BasicCoverageBlock) -> bool
pub(crate) fn bcb_has_multiple_in_edges(&self, bcb: BasicCoverageBlock) -> bool
Returns true if the given node has 2 or more in-edges, i.e. 2 or more predecessors.
This property is interesting to code that assigns counters to nodes and edges, because if a node doesn’t have multiple in-edges, then there’s no benefit in having a separate counter for its in-edge, because it would have the same value as the node’s own counter.
FIXME: That assumption might not be true for TerminatorKind::Yield
?
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
§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: 168 bytes