@@ -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
@@ -161,22 +161,22 @@ impl CoverageCounters {
161
161
& mut self ,
162
162
bcb : BasicCoverageBlock ,
163
163
counter_kind : BcbCounter ,
164
- ) -> Result < Operand , Error > {
164
+ ) -> Result < CovTerm , Error > {
165
165
debug_assert ! (
166
166
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
167
167
// have an expression (to be injected into an existing `BasicBlock` represented by this
168
168
// `BasicCoverageBlock`).
169
169
counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
170
170
"attempt to add a `Counter` to a BCB target with existing incoming edge counters"
171
171
) ;
172
- let operand = counter_kind. as_operand ( ) ;
172
+ let term = counter_kind. as_term ( ) ;
173
173
if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
174
174
Error :: from_string ( format ! (
175
175
"attempt to set a BasicCoverageBlock coverage counter more than once; \
176
176
{bcb:?} already had counter {replaced:?}",
177
177
) )
178
178
} else {
179
- Ok ( operand )
179
+ Ok ( term )
180
180
}
181
181
}
182
182
@@ -185,7 +185,7 @@ impl CoverageCounters {
185
185
from_bcb : BasicCoverageBlock ,
186
186
to_bcb : BasicCoverageBlock ,
187
187
counter_kind : BcbCounter ,
188
- ) -> Result < Operand , Error > {
188
+ ) -> Result < CovTerm , Error > {
189
189
if level_enabled ! ( tracing:: Level :: DEBUG ) {
190
190
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
191
191
// have an expression (to be injected into an existing `BasicBlock` represented by this
@@ -198,14 +198,14 @@ impl CoverageCounters {
198
198
}
199
199
}
200
200
self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
201
- let operand = counter_kind. as_operand ( ) ;
201
+ let term = counter_kind. as_term ( ) ;
202
202
if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
203
203
Error :: from_string ( format ! (
204
204
"attempt to set an edge counter more than once; from_bcb: \
205
205
{from_bcb:?} already had counter {replaced:?}",
206
206
) )
207
207
} else {
208
- Ok ( operand )
208
+ Ok ( term )
209
209
}
210
210
}
211
211
@@ -310,7 +310,7 @@ impl<'a> MakeBcbCounters<'a> {
310
310
& mut self ,
311
311
traversal : & mut TraverseCoverageGraphWithLoops ,
312
312
branching_bcb : BasicCoverageBlock ,
313
- branching_counter_operand : Operand ,
313
+ branching_counter_operand : CovTerm ,
314
314
) -> Result < ( ) , Error > {
315
315
let branches = self . bcb_branches ( branching_bcb) ;
316
316
debug ! (
@@ -362,7 +362,7 @@ impl<'a> MakeBcbCounters<'a> {
362
362
" [new intermediate expression: {}]" ,
363
363
self . format_counter( & intermediate_expression)
364
364
) ;
365
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
365
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
366
366
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
367
367
some_sumup_counter_operand. replace ( intermediate_expression_operand) ;
368
368
}
@@ -395,15 +395,15 @@ impl<'a> MakeBcbCounters<'a> {
395
395
Ok ( ( ) )
396
396
}
397
397
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 > {
399
399
self . recursive_get_or_make_counter_operand ( bcb, 1 )
400
400
}
401
401
402
402
fn recursive_get_or_make_counter_operand (
403
403
& mut self ,
404
404
bcb : BasicCoverageBlock ,
405
405
debug_indent_level : usize ,
406
- ) -> Result < Operand , Error > {
406
+ ) -> Result < CovTerm , Error > {
407
407
// If the BCB already has a counter, return it.
408
408
if let Some ( counter_kind) = & self . coverage_counters . bcb_counters [ bcb] {
409
409
debug ! (
@@ -412,7 +412,7 @@ impl<'a> MakeBcbCounters<'a> {
412
412
bcb,
413
413
self . format_counter( counter_kind) ,
414
414
) ;
415
- return Ok ( counter_kind. as_operand ( ) ) ;
415
+ return Ok ( counter_kind. as_term ( ) ) ;
416
416
}
417
417
418
418
// A BCB with only one incoming edge gets a simple `Counter` (via `make_counter()`).
@@ -477,7 +477,7 @@ impl<'a> MakeBcbCounters<'a> {
477
477
NESTED_INDENT . repeat( debug_indent_level) ,
478
478
self . format_counter( & intermediate_expression)
479
479
) ;
480
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
480
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
481
481
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
482
482
some_sumup_edge_counter_operand. replace ( intermediate_expression_operand) ;
483
483
}
@@ -501,7 +501,7 @@ impl<'a> MakeBcbCounters<'a> {
501
501
& mut self ,
502
502
from_bcb : BasicCoverageBlock ,
503
503
to_bcb : BasicCoverageBlock ,
504
- ) -> Result < Operand , Error > {
504
+ ) -> Result < CovTerm , Error > {
505
505
self . recursive_get_or_make_edge_counter_operand ( from_bcb, to_bcb, 1 )
506
506
}
507
507
@@ -510,7 +510,7 @@ impl<'a> MakeBcbCounters<'a> {
510
510
from_bcb : BasicCoverageBlock ,
511
511
to_bcb : BasicCoverageBlock ,
512
512
debug_indent_level : usize ,
513
- ) -> Result < Operand , Error > {
513
+ ) -> Result < CovTerm , Error > {
514
514
// If the source BCB has only one successor (assumed to be the given target), an edge
515
515
// counter is unnecessary. Just get or make a counter for the source BCB.
516
516
let successors = self . bcb_successors ( from_bcb) . iter ( ) ;
@@ -529,7 +529,7 @@ impl<'a> MakeBcbCounters<'a> {
529
529
to_bcb,
530
530
self . format_counter( counter_kind)
531
531
) ;
532
- return Ok ( counter_kind. as_operand ( ) ) ;
532
+ return Ok ( counter_kind. as_term ( ) ) ;
533
533
}
534
534
535
535
// Make a new counter to count this edge.
0 commit comments