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.
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 fn from_mir(mir_body: &Body<'_>) -> Self
fn compute_basic_coverage_blocks( mir_body: &Body<'_> ) -> (IndexVec<BasicCoverageBlock, BasicCoverageBlockData>, IndexVec<BasicBlock, Option<BasicCoverageBlock>>)
pub fn iter_enumerated( &self ) -> impl Iterator<Item = (BasicCoverageBlock, &BasicCoverageBlockData)>
pub fn bcb_from_bb(&self, bb: BasicBlock) -> Option<BasicCoverageBlock>
pub fn dominates( &self, dom: BasicCoverageBlock, node: BasicCoverageBlock ) -> bool
pub fn cmp_in_dominator_order( &self, a: BasicCoverageBlock, b: BasicCoverageBlock ) -> Ordering
sourcepub(super) fn bcb_has_multiple_in_edges(&self, bcb: BasicCoverageBlock) -> bool
pub(super) 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
type Node = BasicCoverageBlock
source§impl<'graph> GraphPredecessors<'graph> for CoverageGraph
impl<'graph> GraphPredecessors<'graph> for CoverageGraph
type Item = BasicCoverageBlock
type Iter = Copied<Iter<'graph, BasicCoverageBlock>>
source§impl<'graph> GraphSuccessors<'graph> for CoverageGraph
impl<'graph> GraphSuccessors<'graph> for CoverageGraph
type Item = BasicCoverageBlock
type Iter = Cloned<Iter<'graph, BasicCoverageBlock>>
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 WithNumNodes for CoverageGraph
impl WithNumNodes for CoverageGraph
source§impl WithPredecessors for CoverageGraph
impl WithPredecessors for CoverageGraph
fn predecessors( &self, node: Self::Node ) -> <Self as GraphPredecessors<'_>>::Iter
source§impl WithStartNode for CoverageGraph
impl WithStartNode for CoverageGraph
fn start_node(&self) -> Self::Node
source§impl WithSuccessors for CoverageGraph
impl WithSuccessors for CoverageGraph
fn successors(&self, node: Self::Node) -> <Self as GraphSuccessors<'_>>::Iter
fn depth_first_search(&self, from: Self::Node) -> DepthFirstSearch<'_, Self>where
Self: WithNumNodes,
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
§impl<T> Filterable for T
impl<T> Filterable for T
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<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
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> 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