coverage: Give the instrumentor its own counter type, separate from MIR

This splits off `BcbCounter` from MIR's `CoverageKind`, allowing the two types
to evolve in different directions as necessary.
This commit is contained in:
Zalathar 2023-07-08 13:43:29 +10:00
parent 629437eec7
commit fbab055e77
5 changed files with 129 additions and 85 deletions

View file

@ -96,21 +96,6 @@ pub enum CoverageKind {
Unreachable,
}
impl CoverageKind {
pub fn as_operand(&self) -> Operand {
use CoverageKind::*;
match *self {
Counter { id, .. } => Operand::Counter(id),
Expression { id, .. } => Operand::Expression(id),
Unreachable => bug!("Unreachable coverage cannot be part of an expression"),
}
}
pub fn is_expression(&self) -> bool {
matches!(self, Self::Expression { .. })
}
}
impl Debug for CoverageKind {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use CoverageKind::*;