@@ -19,18 +19,18 @@ const NESTED_INDENT: &str = " ";
19
19
#[ derive( Clone ) ]
20
20
pub ( super ) enum BcbCounter {
21
21
Counter { id : CounterId } ,
22
- Expression { id : ExpressionId , lhs : Operand , op : Op , rhs : Operand } ,
22
+ Expression { id : ExpressionId , lhs : CovTerm , op : Op , rhs : CovTerm } ,
23
23
}
24
24
25
25
impl BcbCounter {
26
26
fn is_expression ( & self ) -> bool {
27
27
matches ! ( self , Self :: Expression { .. } )
28
28
}
29
29
30
- pub ( super ) fn as_operand ( & self ) -> Operand {
30
+ pub ( super ) fn as_term ( & self ) -> CovTerm {
31
31
match * self {
32
- BcbCounter :: Counter { id, .. } => Operand :: Counter ( id) ,
33
- BcbCounter :: Expression { id, .. } => Operand :: Expression ( id) ,
32
+ BcbCounter :: Counter { id, .. } => CovTerm :: Counter ( id) ,
33
+ BcbCounter :: Expression { id, .. } => CovTerm :: Expression ( id) ,
34
34
}
35
35
}
36
36
}
@@ -106,7 +106,7 @@ impl CoverageCounters {
106
106
BcbCounter :: Counter { id }
107
107
}
108
108
109
- fn make_expression ( & mut self , lhs : Operand , op : Op , rhs : Operand ) -> BcbCounter {
109
+ fn make_expression ( & mut self , lhs : CovTerm , op : Op , rhs : CovTerm ) -> BcbCounter {
110
110
let id = self . next_expression ( ) ;
111
111
BcbCounter :: Expression { id, lhs, op, rhs }
112
112
}
@@ -138,22 +138,22 @@ impl CoverageCounters {
138
138
& mut self ,
139
139
bcb : BasicCoverageBlock ,
140
140
counter_kind : BcbCounter ,
141
- ) -> Result < Operand , Error > {
141
+ ) -> Result < CovTerm , Error > {
142
142
debug_assert ! (
143
143
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
144
144
// have an expression (to be injected into an existing `BasicBlock` represented by this
145
145
// `BasicCoverageBlock`).
146
146
counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
147
147
"attempt to add a `Counter` to a BCB target with existing incoming edge counters"
148
148
) ;
149
- let operand = counter_kind. as_operand ( ) ;
149
+ let term = counter_kind. as_term ( ) ;
150
150
if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
151
151
Error :: from_string ( format ! (
152
152
"attempt to set a BasicCoverageBlock coverage counter more than once; \
153
153
{bcb:?} already had counter {replaced:?}",
154
154
) )
155
155
} else {
156
- Ok ( operand )
156
+ Ok ( term )
157
157
}
158
158
}
159
159
@@ -162,7 +162,7 @@ impl CoverageCounters {
162
162
from_bcb : BasicCoverageBlock ,
163
163
to_bcb : BasicCoverageBlock ,
164
164
counter_kind : BcbCounter ,
165
- ) -> Result < Operand , Error > {
165
+ ) -> Result < CovTerm , Error > {
166
166
if level_enabled ! ( tracing:: Level :: DEBUG ) {
167
167
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
168
168
// have an expression (to be injected into an existing `BasicBlock` represented by this
@@ -175,14 +175,14 @@ impl CoverageCounters {
175
175
}
176
176
}
177
177
self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
178
- let operand = counter_kind. as_operand ( ) ;
178
+ let term = counter_kind. as_term ( ) ;
179
179
if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
180
180
Error :: from_string ( format ! (
181
181
"attempt to set an edge counter more than once; from_bcb: \
182
182
{from_bcb:?} already had counter {replaced:?}",
183
183
) )
184
184
} else {
185
- Ok ( operand )
185
+ Ok ( term )
186
186
}
187
187
}
188
188
@@ -284,7 +284,7 @@ impl<'a> MakeBcbCounters<'a> {
284
284
& mut self ,
285
285
traversal : & mut TraverseCoverageGraphWithLoops ,
286
286
branching_bcb : BasicCoverageBlock ,
287
- branching_counter_operand : Operand ,
287
+ branching_counter_operand : CovTerm ,
288
288
) -> Result < ( ) , Error > {
289
289
let branches = self . bcb_branches ( branching_bcb) ;
290
290
debug ! (
@@ -332,7 +332,7 @@ impl<'a> MakeBcbCounters<'a> {
332
332
sumup_counter_operand,
333
333
) ;
334
334
debug ! ( " [new intermediate expression: {:?}]" , intermediate_expression) ;
335
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
335
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
336
336
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
337
337
some_sumup_counter_operand. replace ( intermediate_expression_operand) ;
338
338
}
@@ -364,15 +364,15 @@ impl<'a> MakeBcbCounters<'a> {
364
364
Ok ( ( ) )
365
365
}
366
366
367
- fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < Operand , Error > {
367
+ fn get_or_make_counter_operand ( & mut self , bcb : BasicCoverageBlock ) -> Result < CovTerm , Error > {
368
368
self . recursive_get_or_make_counter_operand ( bcb, 1 )
369
369
}
370
370
371
371
fn recursive_get_or_make_counter_operand (
372
372
& mut self ,
373
373
bcb : BasicCoverageBlock ,
374
374
debug_indent_level : usize ,
375
- ) -> Result < Operand , Error > {
375
+ ) -> Result < CovTerm , Error > {
376
376
// If the BCB already has a counter, return it.
377
377
if let Some ( counter_kind) = & self . coverage_counters . bcb_counters [ bcb] {
378
378
debug ! (
@@ -381,7 +381,7 @@ impl<'a> MakeBcbCounters<'a> {
381
381
bcb,
382
382
counter_kind,
383
383
) ;
384
- return Ok ( counter_kind. as_operand ( ) ) ;
384
+ return Ok ( counter_kind. as_term ( ) ) ;
385
385
}
386
386
387
387
// A BCB with only one incoming edge gets a simple `Counter` (via `make_counter()`).
@@ -445,7 +445,7 @@ impl<'a> MakeBcbCounters<'a> {
445
445
NESTED_INDENT . repeat( debug_indent_level) ,
446
446
intermediate_expression
447
447
) ;
448
- let intermediate_expression_operand = intermediate_expression. as_operand ( ) ;
448
+ let intermediate_expression_operand = intermediate_expression. as_term ( ) ;
449
449
self . coverage_counters . intermediate_expressions . push ( intermediate_expression) ;
450
450
some_sumup_edge_counter_operand. replace ( intermediate_expression_operand) ;
451
451
}
@@ -468,7 +468,7 @@ impl<'a> MakeBcbCounters<'a> {
468
468
& mut self ,
469
469
from_bcb : BasicCoverageBlock ,
470
470
to_bcb : BasicCoverageBlock ,
471
- ) -> Result < Operand , Error > {
471
+ ) -> Result < CovTerm , Error > {
472
472
self . recursive_get_or_make_edge_counter_operand ( from_bcb, to_bcb, 1 )
473
473
}
474
474
@@ -477,7 +477,7 @@ impl<'a> MakeBcbCounters<'a> {
477
477
from_bcb : BasicCoverageBlock ,
478
478
to_bcb : BasicCoverageBlock ,
479
479
debug_indent_level : usize ,
480
- ) -> Result < Operand , Error > {
480
+ ) -> Result < CovTerm , Error > {
481
481
// If the source BCB has only one successor (assumed to be the given target), an edge
482
482
// counter is unnecessary. Just get or make a counter for the source BCB.
483
483
let successors = self . bcb_successors ( from_bcb) . iter ( ) ;
@@ -496,7 +496,7 @@ impl<'a> MakeBcbCounters<'a> {
496
496
to_bcb,
497
497
counter_kind
498
498
) ;
499
- return Ok ( counter_kind. as_operand ( ) ) ;
499
+ return Ok ( counter_kind. as_term ( ) ) ;
500
500
}
501
501
502
502
// Make a new counter to count this edge.
0 commit comments