@@ -112,9 +112,7 @@ pub enum CoverageKind {
112
112
///
113
113
/// If this statement does not survive MIR optimizations, any mappings that
114
114
/// refer to this counter can have those references simplified to zero.
115
- CounterIncrement {
116
- id : CounterId ,
117
- } ,
115
+ CounterIncrement { id : CounterId } ,
118
116
119
117
/// Marks the point in MIR control-flow represented by a coverage expression.
120
118
///
@@ -124,18 +122,23 @@ pub enum CoverageKind {
124
122
/// (This is only inserted for expression IDs that are directly used by
125
123
/// mappings. Intermediate expressions with no direct mappings are
126
124
/// retained/zeroed based on whether they are transitively used.)
127
- ExpressionUsed {
128
- id : ExpressionId ,
129
- } ,
130
-
131
- UpdateCondBitmap {
132
- id : ConditionId ,
133
- value : bool ,
134
- } ,
135
-
136
- UpdateTestVector {
137
- bitmap_idx : u32 ,
138
- } ,
125
+ ExpressionUsed { id : ExpressionId } ,
126
+
127
+ /// Marks the point in MIR control flow represented by a evaluated condition.
128
+ ///
129
+ /// This is eventually lowered to `llvm.instrprof.mcdc.condbitmap.update` in LLVM IR.
130
+ ///
131
+ /// If this statement does not survive MIR optimizations, the condition would never be
132
+ /// taken as evaluated.
133
+ CondBitmapUpdate { id : ConditionId , value : bool } ,
134
+
135
+ /// Marks the point in MIR control flow represented by a evaluated decision.
136
+ ///
137
+ /// This is eventually lowered to `llvm.instrprof.mcdc.tvbitmap.update` in LLVM IR.
138
+ ///
139
+ /// If this statement does not survive MIR optimizations, the decision would never be
140
+ /// taken as evaluated.
141
+ TestVectorBitmapUpdate { bitmap_idx : u32 } ,
139
142
}
140
143
141
144
impl Debug for CoverageKind {
@@ -146,10 +149,12 @@ impl Debug for CoverageKind {
146
149
BlockMarker { id } => write ! ( fmt, "BlockMarker({:?})" , id. index( ) ) ,
147
150
CounterIncrement { id } => write ! ( fmt, "CounterIncrement({:?})" , id. index( ) ) ,
148
151
ExpressionUsed { id } => write ! ( fmt, "ExpressionUsed({:?})" , id. index( ) ) ,
149
- UpdateCondBitmap { id, value } => {
150
- write ! ( fmt, "UpdateCondBitmap({:?}, {value})" , id. index( ) )
152
+ CondBitmapUpdate { id, value } => {
153
+ write ! ( fmt, "CondBitmapUpdate({:?}, {:?})" , id. index( ) , value)
154
+ }
155
+ TestVectorBitmapUpdate { bitmap_idx } => {
156
+ write ! ( fmt, "TestVectorUpdate({:?})" , bitmap_idx)
151
157
}
152
- UpdateTestVector { bitmap_idx } => write ! ( fmt, "UpdateTestVector({:?})" , bitmap_idx) ,
153
158
}
154
159
}
155
160
}
@@ -205,9 +210,11 @@ pub enum MappingKind {
205
210
/// Associates a normal region of code with a counter/expression/zero.
206
211
Code ( CovTerm ) ,
207
212
/// Associates a branch region with separate counters for true and false.
208
- Branch { true_term : CovTerm , false_term : CovTerm , mcdc_params : ConditionInfo } ,
213
+ Branch { true_term : CovTerm , false_term : CovTerm } ,
214
+ /// Associates a branch region with separate counters for true and false.
215
+ MCDCBranch { true_term : CovTerm , false_term : CovTerm , mcdc_params : ConditionInfo } ,
209
216
/// Associates a decision region with a bitmap and number of conditions.
210
- Decision ( DecisionInfo ) ,
217
+ MCDCDecision ( DecisionInfo ) ,
211
218
}
212
219
213
220
impl MappingKind {
@@ -219,7 +226,8 @@ impl MappingKind {
219
226
match * self {
220
227
Self :: Code ( term) => one ( term) ,
221
228
Self :: Branch { true_term, false_term, .. } => two ( true_term, false_term) ,
222
- Self :: Decision ( _) => zero ( ) ,
229
+ Self :: MCDCBranch { true_term, false_term, .. } => two ( true_term, false_term) ,
230
+ Self :: MCDCDecision ( _) => zero ( ) ,
223
231
}
224
232
}
225
233
@@ -228,12 +236,15 @@ impl MappingKind {
228
236
pub fn map_terms ( & self , map_fn : impl Fn ( CovTerm ) -> CovTerm ) -> Self {
229
237
match * self {
230
238
Self :: Code ( term) => Self :: Code ( map_fn ( term) ) ,
231
- Self :: Branch { true_term, false_term, mcdc_params } => Self :: Branch {
239
+ Self :: Branch { true_term, false_term } => {
240
+ Self :: Branch { true_term : map_fn ( true_term) , false_term : map_fn ( false_term) }
241
+ }
242
+ Self :: MCDCBranch { true_term, false_term, mcdc_params } => Self :: MCDCBranch {
232
243
true_term : map_fn ( true_term) ,
233
244
false_term : map_fn ( false_term) ,
234
245
mcdc_params,
235
246
} ,
236
- Self :: Decision ( param) => Self :: Decision ( param) ,
247
+ Self :: MCDCDecision ( param) => Self :: MCDCDecision ( param) ,
237
248
}
238
249
}
239
250
}
@@ -267,7 +278,6 @@ pub struct BranchInfo {
267
278
/// data structures without having to scan the entire body first.
268
279
pub num_block_markers : usize ,
269
280
pub branch_spans : Vec < BranchSpan > ,
270
- pub mcdc_bitmap_bytes_num : u32 ,
271
281
pub decision_spans : Vec < DecisionSpan > ,
272
282
}
273
283
@@ -309,5 +319,6 @@ pub struct DecisionInfo {
309
319
#[ derive( TyEncodable , TyDecodable , Hash , HashStable , TypeFoldable , TypeVisitable ) ]
310
320
pub struct DecisionSpan {
311
321
pub span : Span ,
312
- pub mcdc_params : DecisionInfo ,
322
+ pub conditions_num : u16 ,
323
+ pub join_marker : BlockMarkerId ,
313
324
}
0 commit comments