coverage: Store BCB node IDs in mappings, and resolve them in codegen

Even though the coverage graph itself is no longer available during codegen,
its nodes can still be used as opaque IDs.
This commit is contained in:
Zalathar
2025-01-20 22:43:59 +11:00
parent 59588250ad
commit ee7dc06cf1
12 changed files with 91 additions and 103 deletions

View File

@@ -133,7 +133,7 @@ pub(super) struct CoverageCounters {
next_counter_id: CounterId,
/// Coverage counters/expressions that are associated with individual BCBs.
node_counters: IndexVec<BasicCoverageBlock, Option<CovTerm>>,
pub(crate) node_counters: IndexVec<BasicCoverageBlock, Option<CovTerm>>,
/// Table of expression data, associating each expression ID with its
/// corresponding operator (+ or -) and its LHS/RHS operands.
@@ -203,10 +203,6 @@ impl CoverageCounters {
counter
}
pub(super) fn term_for_bcb(&self, bcb: BasicCoverageBlock) -> Option<CovTerm> {
self.node_counters[bcb]
}
/// Returns an iterator over all the nodes in the coverage graph that
/// should have a counter-increment statement injected into MIR, along with
/// each site's corresponding counter ID.