@@ -21,18 +21,18 @@ use std::fmt::{self, Debug};
21
21
#[ derive( Clone ) ]
22
22
pub ( super ) enum BcbCounter {
23
23
Counter { id : CounterId } ,
24
- Expression { id : ExpressionId , lhs : Operand , op : Op , rhs : Operand } ,
24
+ Expression { id : ExpressionId , lhs : CovTerm , op : Op , rhs : CovTerm } ,
25
25
}
26
26
27
27
impl BcbCounter {
28
28
fn is_expression ( & self ) -> bool {
29
29
matches ! ( self , Self :: Expression { .. } )
30
30
}
31
31
32
- pub ( super ) fn as_operand ( & self ) -> Operand {
32
+ pub ( super ) fn as_term ( & self ) -> CovTerm {
33
33
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) ,
36
36
}
37
37
}
38
38
}
@@ -126,9 +126,9 @@ impl CoverageCounters {
126
126
127
127
fn make_expression < F > (
128
128
& mut self ,
129
- lhs : Operand ,
129
+ lhs : CovTerm ,
130
130
op : Op ,
131
- rhs : Operand ,
131
+ rhs : CovTerm ,
132
132
debug_block_label_fn : F ,
133
133
) -> BcbCounter
134
134
where
@@ -169,22 +169,22 @@ impl CoverageCounters {
169
169
& mut self ,
170
170
bcb : BasicCoverageBlock ,
171
171
counter_kind : BcbCounter ,
172
- ) -> Result < Operand , Error > {
172
+ ) -> Result < CovTerm , Error > {
173
173
debug_assert ! (
174
174
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
175
175
// have an expression (to be injected into an existing `BasicBlock` represented by this
176
176
// `BasicCoverageBlock`).
177
177
counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
178
178
"attempt to add a `Counter` to a BCB target with existing incoming edge counters"
179
179
) ;
180
- let operand = counter_kind. as_operand ( ) ;
180
+ let term = counter_kind. as_term ( ) ;
181
181
if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
182
182
Error :: from_string ( format ! (
183
183
"attempt to set a BasicCoverageBlock coverage counter more than once; \
184
184
{bcb:?} already had counter {replaced:?}",
185
185
) )
186
186
} else {
187
- Ok ( operand )
187
+ Ok ( term )
188
188
}
189
189
}
190
190
@@ -193,7 +193,7 @@ impl CoverageCounters {
193
193
from_bcb : BasicCoverageBlock ,
194
194
to_bcb : BasicCoverageBlock ,
195
195
counter_kind : BcbCounter ,
196
- ) -> Result < Operand , Error > {
196
+ ) -> Result < CovTerm , Error > {
197
197
if level_enabled ! ( tracing:: Level :: DEBUG ) {
198
198
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
199
199
// have an expression (to be injected into an existing `BasicBlock` represented by this
@@ -206,14 +206,14 @@ impl CoverageCounters {
206
206
}
207
207
}
208
208
self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
209
- let operand = counter_kind. as_operand ( ) ;
209
+ let term = counter_kind. as_term ( ) ;
210
210
if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
211
211
Error :: from_string ( format ! (
212
212
"attempt to set an edge counter more than once; from_bcb: \
213
213
{from_bcb:?} already had counter {replaced:?}",
214
214
) )
215
215
} else {
216
- Ok ( operand )
216
+ Ok ( term )
217
217
}
218
218
}
219
219
@@ -318,7 +318,7 @@ impl<'a> MakeBcbCounters<'a> {
318
318
& mut self ,
319
319
traversal : & mut TraverseCoverageGraphWithLoops ,
320
320
branching_bcb : BasicCoverageBlock ,
321
- branching_counter_operand : Operand ,
321
+ branching_counter_operand : CovTerm ,
322
322
) -> Result < ( ) , Error > {
323
323
let branches = self . bcb_branches ( branching_bcb) ;
324
324
debug ! (
@@ -370,7 +370,7 @@ impl<'a> MakeBcbCounters<'a> {
370
370
" [new intermediate expression: {}]" ,
371
371
self . format_counter( & intermediate_expression)
372
372
) ;
373
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
373
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
374
374
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
375
375
some_sumup_counter_operand. replace ( intermediate_expression_operand) ;
376
376
}
@@ -403,15 +403,15 @@ impl<'a> MakeBcbCounters<'a> {
403
403
Ok ( ( ) )
404
404
}
405
405
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 > {
407
407
self . recursive_get_or_make_counter_operand ( bcb, 1 )
408
408
}
409
409
410
410
fn recursive_get_or_make_counter_operand (
411
411
& mut self ,
412
412
bcb : BasicCoverageBlock ,
413
413
debug_indent_level : usize ,
414
- ) -> Result < Operand , Error > {
414
+ ) -> Result < CovTerm , Error > {
415
415
// If the BCB already has a counter, return it.
416
416
if let Some ( counter_kind) = & self . coverage_counters . bcb_counters [ bcb] {
417
417
debug ! (
@@ -420,7 +420,7 @@ impl<'a> MakeBcbCounters<'a> {
420
420
bcb,
421
421
self . format_counter( counter_kind) ,
422
422
) ;
423
- return Ok ( counter_kind. as_operand ( ) ) ;
423
+ return Ok ( counter_kind. as_term ( ) ) ;
424
424
}
425
425
426
426
// A BCB with only one incoming edge gets a simple `Counter` (via `make_counter()`).
@@ -485,7 +485,7 @@ impl<'a> MakeBcbCounters<'a> {
485
485
NESTED_INDENT . repeat( debug_indent_level) ,
486
486
self . format_counter( & intermediate_expression)
487
487
) ;
488
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
488
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
489
489
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
490
490
some_sumup_edge_counter_operand. replace ( intermediate_expression_operand) ;
491
491
}
@@ -509,7 +509,7 @@ impl<'a> MakeBcbCounters<'a> {
509
509
& mut self ,
510
510
from_bcb : BasicCoverageBlock ,
511
511
to_bcb : BasicCoverageBlock ,
512
- ) -> Result < Operand , Error > {
512
+ ) -> Result < CovTerm , Error > {
513
513
self . recursive_get_or_make_edge_counter_operand ( from_bcb, to_bcb, 1 )
514
514
}
515
515
@@ -518,7 +518,7 @@ impl<'a> MakeBcbCounters<'a> {
518
518
from_bcb : BasicCoverageBlock ,
519
519
to_bcb : BasicCoverageBlock ,
520
520
debug_indent_level : usize ,
521
- ) -> Result < Operand , Error > {
521
+ ) -> Result < CovTerm , Error > {
522
522
// If the source BCB has only one successor (assumed to be the given target), an edge
523
523
// counter is unnecessary. Just get or make a counter for the source BCB.
524
524
let successors = self . bcb_successors ( from_bcb) . iter ( ) ;
@@ -537,7 +537,7 @@ impl<'a> MakeBcbCounters<'a> {
537
537
to_bcb,
538
538
self . format_counter( counter_kind)
539
539
) ;
540
- return Ok ( counter_kind. as_operand ( ) ) ;
540
+ return Ok ( counter_kind. as_term ( ) ) ;
541
541
}
542
542
543
543
// Make a new counter to count this edge.
0 commit comments