LLVM 22.0.0git
llvm::coverage::mcdc::TVIdxBuilder Class Reference

Compute TestVector Indices "TVIdx" from the Conds graph. More...

#include "llvm/ProfileData/Coverage/CoverageMapping.h"

Classes

struct  MCDCNode

Public Member Functions

LLVM_ABI TVIdxBuilder (const SmallVectorImpl< ConditionIDs > &NextIDs, int Offset=0)
 Calculate and assign Indices.

Public Attributes

SmallVector< MCDCNodeSavedNodes
 This is no longer needed after the assignment.
SmallVector< std::array< int, 2 > > Indices
 Output: Index for TestVectors bitmap (These are not CondIDs)
int NumTestVectors
 Output: The number of test vectors.

Static Public Attributes

static constexpr auto HardMaxTVs
 Hard limit of test vectors.

Detailed Description

Compute TestVector Indices "TVIdx" from the Conds graph.

Clang CodeGen handles the bitmap index based on TVIdx. llvm-cov reconstructs conditions from TVIdx.

For each leaf "The final decision",

  • TVIdx should be unique.
  • TVIdx has the Width.
    • The width represents the number of possible paths.
    • The minimum width is 1 "deterministic".
  • The order of leaves are sorted by Width DESC. It expects latter TVIdx(s) (with Width=1) could be pruned and altered to other simple branch conditions.

Definition at line 648 of file CoverageMapping.h.

Constructor & Destructor Documentation

◆ TVIdxBuilder()

mcdc::TVIdxBuilder::TVIdxBuilder ( const SmallVectorImpl< ConditionIDs > & NextIDs,
int Offset = 0 )

Calculate and assign Indices.

Parameters
NextIDsThe list of {FalseID, TrueID} indexed by ID The first element [0] should be the root node.
OffsetOffset of index to final decisions.

-Width

Ord

ID

Cond (0 or 1)

Definition at line 283 of file CoverageMapping.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::CallingConv::C, llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SmallVectorImpl< T >::erase(), HardMaxTVs, I, Indices, N, NumTestVectors, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), SavedNodes, llvm::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::sort().

Member Data Documentation

◆ HardMaxTVs

auto llvm::coverage::mcdc::TVIdxBuilder::HardMaxTVs
staticconstexpr
Initial value:
=
std::numeric_limits<decltype(NumTestVectors)>::max()
int NumTestVectors
Output: The number of test vectors.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)

Hard limit of test vectors.

Definition at line 670 of file CoverageMapping.h.

Referenced by TVIdxBuilder().

◆ Indices

SmallVector<std::array<int, 2> > llvm::coverage::mcdc::TVIdxBuilder::Indices

Output: Index for TestVectors bitmap (These are not CondIDs)

Definition at line 663 of file CoverageMapping.h.

Referenced by TVIdxBuilder().

◆ NumTestVectors

int llvm::coverage::mcdc::TVIdxBuilder::NumTestVectors

Output: The number of test vectors.

Error with HardMaxTVs if the number has exploded.

Definition at line 667 of file CoverageMapping.h.

Referenced by TVIdxBuilder().

◆ SavedNodes

SmallVector<MCDCNode> llvm::coverage::mcdc::TVIdxBuilder::SavedNodes

This is no longer needed after the assignment.

It may be used in assert() for reconfirmation.

Definition at line 659 of file CoverageMapping.h.

Referenced by TVIdxBuilder().


The documentation for this class was generated from the following files: