@@ -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
@@ -169,22 +169,22 @@ impl CoverageCounters {
169169 & mut self ,
170170 bcb : BasicCoverageBlock ,
171171 counter_kind : BcbCounter ,
172- ) -> Result < Operand , Error > {
172+ ) -> Result < CovTerm , Error > {
173173 debug_assert ! (
174174 // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
175175 // have an expression (to be injected into an existing `BasicBlock` represented by this
176176 // `BasicCoverageBlock`).
177177 counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
178178 "attempt to add a `Counter` to a BCB target with existing incoming edge counters"
179179 ) ;
180- let operand = counter_kind. as_operand ( ) ;
180+ let term = counter_kind. as_term ( ) ;
181181 if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
182182 Error :: from_string ( format ! (
183183 "attempt to set a BasicCoverageBlock coverage counter more than once; \
184184 {bcb:?} already had counter {replaced:?}",
185185 ) )
186186 } else {
187- Ok ( operand )
187+ Ok ( term )
188188 }
189189 }
190190
@@ -193,7 +193,7 @@ impl CoverageCounters {
193193 from_bcb : BasicCoverageBlock ,
194194 to_bcb : BasicCoverageBlock ,
195195 counter_kind : BcbCounter ,
196- ) -> Result < Operand , Error > {
196+ ) -> Result < CovTerm , Error > {
197197 if level_enabled ! ( tracing:: Level :: DEBUG ) {
198198 // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
199199 // have an expression (to be injected into an existing `BasicBlock` represented by this
@@ -206,14 +206,14 @@ impl CoverageCounters {
206206 }
207207 }
208208 self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
209- let operand = counter_kind. as_operand ( ) ;
209+ let term = counter_kind. as_term ( ) ;
210210 if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
211211 Error :: from_string ( format ! (
212212 "attempt to set an edge counter more than once; from_bcb: \
213213 {from_bcb:?} already had counter {replaced:?}",
214214 ) )
215215 } else {
216- Ok ( operand )
216+ Ok ( term )
217217 }
218218 }
219219
@@ -318,7 +318,7 @@ impl<'a> MakeBcbCounters<'a> {
318318 & mut self ,
319319 traversal : & mut TraverseCoverageGraphWithLoops ,
320320 branching_bcb : BasicCoverageBlock ,
321- branching_counter_operand : Operand ,
321+ branching_counter_operand : CovTerm ,
322322 ) -> Result < ( ) , Error > {
323323 let branches = self . bcb_branches ( branching_bcb) ;
324324 debug ! (
@@ -370,7 +370,7 @@ impl<'a> MakeBcbCounters<'a> {
370370 " [new intermediate expression: {}]" ,
371371 self . format_counter( & intermediate_expression)
372372 ) ;
373- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
373+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
374374 self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
375375 some_sumup_counter_operand. replace ( intermediate_expression_operand) ;
376376 }
@@ -403,15 +403,15 @@ impl<'a> MakeBcbCounters<'a> {
403403 Ok ( ( ) )
404404 }
405405
406- fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < Operand , Error > {
406+ fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < CovTerm , Error > {
407407 self . recursive_get_or_make_counter_operand ( bcb, 1 )
408408 }
409409
410410 fn recursive_get_or_make_counter_operand (
411411 & mut self ,
412412 bcb : BasicCoverageBlock ,
413413 debug_indent_level : usize ,
414- ) -> Result < Operand , Error > {
414+ ) -> Result < CovTerm , Error > {
415415 // If the BCB already has a counter, return it.
416416 if let Some ( counter_kind) = & self . coverage_counters . bcb_counters [ bcb] {
417417 debug ! (
@@ -420,7 +420,7 @@ impl<'a> MakeBcbCounters<'a> {
420420 bcb,
421421 self . format_counter( counter_kind) ,
422422 ) ;
423- return Ok ( counter_kind. as_operand ( ) ) ;
423+ return Ok ( counter_kind. as_term ( ) ) ;
424424 }
425425
426426 // A BCB with only one incoming edge gets a simple `Counter` (via `make_counter()`).
@@ -485,7 +485,7 @@ impl<'a> MakeBcbCounters<'a> {
485485 NESTED_INDENT . repeat( debug_indent_level) ,
486486 self . format_counter( & intermediate_expression)
487487 ) ;
488- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
488+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
489489 self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
490490 some_sumup_edge_counter_operand. replace ( intermediate_expression_operand) ;
491491 }
@@ -509,7 +509,7 @@ impl<'a> MakeBcbCounters<'a> {
509509 & mut self ,
510510 from_bcb : BasicCoverageBlock ,
511511 to_bcb : BasicCoverageBlock ,
512- ) -> Result < Operand , Error > {
512+ ) -> Result < CovTerm , Error > {
513513 self . recursive_get_or_make_edge_counter_operand ( from_bcb, to_bcb, 1 )
514514 }
515515
@@ -518,7 +518,7 @@ impl<'a> MakeBcbCounters<'a> {
518518 from_bcb : BasicCoverageBlock ,
519519 to_bcb : BasicCoverageBlock ,
520520 debug_indent_level : usize ,
521- ) -> Result < Operand , Error > {
521+ ) -> Result < CovTerm , Error > {
522522 // If the source BCB has only one successor (assumed to be the given target), an edge
523523 // counter is unnecessary. Just get or make a counter for the source BCB.
524524 let successors = self . bcb_successors ( from_bcb) . iter ( ) ;
@@ -537,7 +537,7 @@ impl<'a> MakeBcbCounters<'a> {
537537 to_bcb,
538538 self . format_counter( counter_kind)
539539 ) ;
540- return Ok ( counter_kind. as_operand ( ) ) ;
540+ return Ok ( counter_kind. as_term ( ) ) ;
541541 }
542542
543543 // Make a new counter to count this edge.
0 commit comments