Struct rustc_mir_transform::coverage::counters::CoverageCounters
source · pub(super) struct CoverageCounters {
next_counter_id: CounterId,
next_expression_id: ExpressionId,
bcb_counters: IndexVec<BasicCoverageBlock, Option<BcbCounter>>,
bcb_edge_counters: FxHashMap<(BasicCoverageBlock, BasicCoverageBlock), BcbCounter>,
bcb_has_incoming_edge_counters: BitSet<BasicCoverageBlock>,
pub(super) intermediate_expressions: Vec<BcbCounter>,
}
Expand description
Generates and stores coverage counter and coverage expression information associated with nodes/edges in the BCB graph.
Fields§
§next_counter_id: CounterId
§next_expression_id: ExpressionId
§bcb_counters: IndexVec<BasicCoverageBlock, Option<BcbCounter>>
Coverage counters/expressions that are associated with individual BCBs.
bcb_edge_counters: FxHashMap<(BasicCoverageBlock, BasicCoverageBlock), BcbCounter>
Coverage counters/expressions that are associated with the control-flow edge between two BCBs.
bcb_has_incoming_edge_counters: BitSet<BasicCoverageBlock>
Tracks which BCBs have a counter associated with some incoming edge. Only used by debug assertions, to verify that BCBs with incoming edge counters do not have their own physical counters (expressions are allowed).
intermediate_expressions: Vec<BcbCounter>
Expression nodes that are not directly associated with any particular
BCB/edge, but are needed as operands to more complex expressions.
These are always BcbCounter::Expression
.
Implementations§
source§impl CoverageCounters
impl CoverageCounters
pub(super) fn new(basic_coverage_blocks: &CoverageGraph) -> Self
sourcepub fn make_bcb_counters(
&mut self,
basic_coverage_blocks: &CoverageGraph,
bcb_has_coverage_spans: impl Fn(BasicCoverageBlock) -> bool
) -> Result<(), Error>
pub fn make_bcb_counters( &mut self, basic_coverage_blocks: &CoverageGraph, bcb_has_coverage_spans: impl Fn(BasicCoverageBlock) -> bool ) -> Result<(), Error>
Makes BcbCounter
Counter
s and Expressions
for the BasicCoverageBlock
s directly or
indirectly associated with coverage spans, and accumulates additional Expression
s
representing intermediate values.
fn make_counter(&mut self) -> BcbCounter
fn make_expression(&mut self, lhs: Operand, op: Op, rhs: Operand) -> BcbCounter
sourcefn next_counter(&mut self) -> CounterId
fn next_counter(&mut self) -> CounterId
Counter IDs start from one and go up.
sourcefn next_expression(&mut self) -> ExpressionId
fn next_expression(&mut self) -> ExpressionId
Expression IDs start from 0 and go up.
(Counter IDs and Expression IDs are distinguished by the Operand
enum.)
fn set_bcb_counter( &mut self, bcb: BasicCoverageBlock, counter_kind: BcbCounter ) -> Result<Operand, Error>
fn set_bcb_edge_counter( &mut self, from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock, counter_kind: BcbCounter ) -> Result<Operand, Error>
pub(super) fn bcb_counter(&self, bcb: BasicCoverageBlock) -> Option<&BcbCounter>
pub(super) fn take_bcb_counter( &mut self, bcb: BasicCoverageBlock ) -> Option<BcbCounter>
pub(super) fn drain_bcb_counters( &mut self ) -> impl Iterator<Item = (BasicCoverageBlock, BcbCounter)> + '_
pub(super) fn drain_bcb_edge_counters( &mut self ) -> impl Iterator<Item = ((BasicCoverageBlock, BasicCoverageBlock), BcbCounter)> + '_
Auto Trait Implementations§
impl RefUnwindSafe for CoverageCounters
impl Send for CoverageCounters
impl Sync for CoverageCounters
impl Unpin for CoverageCounters
impl UnwindSafe for CoverageCounters
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
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: 120 bytes