@@ -21,18 +21,18 @@ use std::fmt::{self, Debug};
2121#[ derive( Clone ) ]
2222pub ( super ) enum BcbCounter {
2323 Counter { id : CounterId } ,
24- Expression { id : ExpressionId , lhs : Operand , op : Op , rhs : Operand } ,
24+ Expression { id : ExpressionId , lhs : CovTerm , op : Op , rhs : CovTerm } ,
2525}
2626
2727impl BcbCounter {
2828 fn is_expression ( & self ) -> bool {
2929 matches ! ( self , Self :: Expression { .. } )
3030 }
3131
32- pub ( super ) fn as_operand ( & self ) -> Operand {
32+ pub ( super ) fn as_term ( & self ) -> CovTerm {
3333 match * self {
34- BcbCounter :: Counter { id, .. } => Operand :: Counter ( id) ,
35- BcbCounter :: Expression { id, .. } => Operand :: Expression ( id) ,
34+ BcbCounter :: Counter { id, .. } => CovTerm :: Counter ( id) ,
35+ BcbCounter :: Expression { id, .. } => CovTerm :: Expression ( id) ,
3636 }
3737 }
3838}
@@ -126,9 +126,9 @@ impl CoverageCounters {
126126
127127 fn make_expression < F > (
128128 & mut self ,
129- lhs : Operand ,
129+ lhs : CovTerm ,
130130 op : Op ,
131- rhs : Operand ,
131+ rhs : CovTerm ,
132132 debug_block_label_fn : F ,
133133 ) -> BcbCounter
134134 where
@@ -161,22 +161,22 @@ impl CoverageCounters {
161161 & mut self ,
162162 bcb : BasicCoverageBlock ,
163163 counter_kind : BcbCounter ,
164- ) -> Result < Operand , Error > {
164+ ) -> Result < CovTerm , Error > {
165165 debug_assert ! (
166166 // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
167167 // have an expression (to be injected into an existing `BasicBlock` represented by this
168168 // `BasicCoverageBlock`).
169169 counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
170170 "attempt to add a `Counter` to a BCB target with existing incoming edge counters"
171171 ) ;
172- let operand = counter_kind. as_operand ( ) ;
172+ let term = counter_kind. as_term ( ) ;
173173 if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
174174 Error :: from_string ( format ! (
175175 "attempt to set a BasicCoverageBlock coverage counter more than once; \
176176 {bcb:?} already had counter {replaced:?}",
177177 ) )
178178 } else {
179- Ok ( operand )
179+ Ok ( term )
180180 }
181181 }
182182
@@ -185,7 +185,7 @@ impl CoverageCounters {
185185 from_bcb : BasicCoverageBlock ,
186186 to_bcb : BasicCoverageBlock ,
187187 counter_kind : BcbCounter ,
188- ) -> Result < Operand , Error > {
188+ ) -> Result < CovTerm , Error > {
189189 if level_enabled ! ( tracing:: Level :: DEBUG ) {
190190 // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
191191 // have an expression (to be injected into an existing `BasicBlock` represented by this
@@ -198,14 +198,14 @@ impl CoverageCounters {
198198 }
199199 }
200200 self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
201- let operand = counter_kind. as_operand ( ) ;
201+ let term = counter_kind. as_term ( ) ;
202202 if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
203203 Error :: from_string ( format ! (
204204 "attempt to set an edge counter more than once; from_bcb: \
205205 {from_bcb:?} already had counter {replaced:?}",
206206 ) )
207207 } else {
208- Ok ( operand )
208+ Ok ( term )
209209 }
210210 }
211211
@@ -310,7 +310,7 @@ impl<'a> MakeBcbCounters<'a> {
310310 & mut self ,
311311 traversal : & mut TraverseCoverageGraphWithLoops ,
312312 branching_bcb : BasicCoverageBlock ,
313- branching_counter_operand : Operand ,
313+ branching_counter_operand : CovTerm ,
314314 ) -> Result < ( ) , Error > {
315315 let branches = self . bcb_branches ( branching_bcb) ;
316316 debug ! (
@@ -362,7 +362,7 @@ impl<'a> MakeBcbCounters<'a> {
362362 " [new intermediate expression: {}]" ,
363363 self . format_counter( & intermediate_expression)
364364 ) ;
365- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
365+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
366366 self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
367367 some_sumup_counter_operand. replace ( intermediate_expression_operand) ;
368368 }
@@ -395,15 +395,15 @@ impl<'a> MakeBcbCounters<'a> {
395395 Ok ( ( ) )
396396 }
397397
398- fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < Operand , Error > {
398+ fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < CovTerm , Error > {
399399 self . recursive_get_or_make_counter_operand ( bcb, 1 )
400400 }
401401
402402 fn recursive_get_or_make_counter_operand (
403403 & mut self ,
404404 bcb : BasicCoverageBlock ,
405405 debug_indent_level : usize ,
406- ) -> Result < Operand , Error > {
406+ ) -> Result < CovTerm , Error > {
407407 // If the BCB already has a counter, return it.
408408 if let Some ( counter_kind) = & self . coverage_counters . bcb_counters [ bcb] {
409409 debug ! (
@@ -412,7 +412,7 @@ impl<'a> MakeBcbCounters<'a> {
412412 bcb,
413413 self . format_counter( counter_kind) ,
414414 ) ;
415- return Ok ( counter_kind. as_operand ( ) ) ;
415+ return Ok ( counter_kind. as_term ( ) ) ;
416416 }
417417
418418 // A BCB with only one incoming edge gets a simple `Counter` (via `make_counter()`).
@@ -477,7 +477,7 @@ impl<'a> MakeBcbCounters<'a> {
477477 NESTED_INDENT . repeat( debug_indent_level) ,
478478 self . format_counter( & intermediate_expression)
479479 ) ;
480- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
480+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
481481 self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
482482 some_sumup_edge_counter_operand. replace ( intermediate_expression_operand) ;
483483 }
@@ -501,7 +501,7 @@ impl<'a> MakeBcbCounters<'a> {
501501 & mut self ,
502502 from_bcb : BasicCoverageBlock ,
503503 to_bcb : BasicCoverageBlock ,
504- ) -> Result < Operand , Error > {
504+ ) -> Result < CovTerm , Error > {
505505 self . recursive_get_or_make_edge_counter_operand ( from_bcb, to_bcb, 1 )
506506 }
507507
@@ -510,7 +510,7 @@ impl<'a> MakeBcbCounters<'a> {
510510 from_bcb : BasicCoverageBlock ,
511511 to_bcb : BasicCoverageBlock ,
512512 debug_indent_level : usize ,
513- ) -> Result < Operand , Error > {
513+ ) -> Result < CovTerm , Error > {
514514 // If the source BCB has only one successor (assumed to be the given target), an edge
515515 // counter is unnecessary. Just get or make a counter for the source BCB.
516516 let successors = self . bcb_successors ( from_bcb) . iter ( ) ;
@@ -529,7 +529,7 @@ impl<'a> MakeBcbCounters<'a> {
529529 to_bcb,
530530 self . format_counter( counter_kind)
531531 ) ;
532- return Ok ( counter_kind. as_operand ( ) ) ;
532+ return Ok ( counter_kind. as_term ( ) ) ;
533533 }
534534
535535 // Make a new counter to count this edge.
0 commit comments