@@ -112,9 +112,7 @@ pub enum CoverageKind {
112112 ///
113113 /// If this statement does not survive MIR optimizations, any mappings that
114114 /// refer to this counter can have those references simplified to zero.
115- CounterIncrement {
116- id : CounterId ,
117- } ,
115+ CounterIncrement { id : CounterId } ,
118116
119117 /// Marks the point in MIR control-flow represented by a coverage expression.
120118 ///
@@ -124,18 +122,23 @@ pub enum CoverageKind {
124122 /// (This is only inserted for expression IDs that are directly used by
125123 /// mappings. Intermediate expressions with no direct mappings are
126124 /// 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 } ,
139142}
140143
141144impl Debug for CoverageKind {
@@ -146,10 +149,12 @@ impl Debug for CoverageKind {
146149 BlockMarker { id } => write ! ( fmt, "BlockMarker({:?})" , id. index( ) ) ,
147150 CounterIncrement { id } => write ! ( fmt, "CounterIncrement({:?})" , id. index( ) ) ,
148151 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)
151157 }
152- UpdateTestVector { bitmap_idx } => write ! ( fmt, "UpdateTestVector({:?})" , bitmap_idx) ,
153158 }
154159 }
155160}
@@ -205,9 +210,11 @@ pub enum MappingKind {
205210 /// Associates a normal region of code with a counter/expression/zero.
206211 Code ( CovTerm ) ,
207212 /// 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 } ,
209216 /// Associates a decision region with a bitmap and number of conditions.
210- Decision ( DecisionInfo ) ,
217+ MCDCDecision ( DecisionInfo ) ,
211218}
212219
213220impl MappingKind {
@@ -219,7 +226,8 @@ impl MappingKind {
219226 match * self {
220227 Self :: Code ( term) => one ( term) ,
221228 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 ( ) ,
223231 }
224232 }
225233
@@ -228,12 +236,15 @@ impl MappingKind {
228236 pub fn map_terms ( & self , map_fn : impl Fn ( CovTerm ) -> CovTerm ) -> Self {
229237 match * self {
230238 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 {
232243 true_term : map_fn ( true_term) ,
233244 false_term : map_fn ( false_term) ,
234245 mcdc_params,
235246 } ,
236- Self :: Decision ( param) => Self :: Decision ( param) ,
247+ Self :: MCDCDecision ( param) => Self :: MCDCDecision ( param) ,
237248 }
238249 }
239250}
@@ -267,7 +278,6 @@ pub struct BranchInfo {
267278 /// data structures without having to scan the entire body first.
268279 pub num_block_markers : usize ,
269280 pub branch_spans : Vec < BranchSpan > ,
270- pub mcdc_bitmap_bytes_num : u32 ,
271281 pub decision_spans : Vec < DecisionSpan > ,
272282}
273283
@@ -309,5 +319,6 @@ pub struct DecisionInfo {
309319#[ derive( TyEncodable , TyDecodable , Hash , HashStable , TypeFoldable , TypeVisitable ) ]
310320pub struct DecisionSpan {
311321 pub span : Span ,
312- pub mcdc_params : DecisionInfo ,
322+ pub conditions_num : u16 ,
323+ pub join_marker : BlockMarkerId ,
313324}
0 commit comments