LLVM 22.0.0git
llvm::BlockCoverageInference Class Reference

#include "llvm/Transforms/Instrumentation/BlockCoverageInference.h"

Public Types

using BlockSet = SmallSetVector<const BasicBlock *, 4>

Public Member Functions

 BlockCoverageInference (const Function &F, bool ForceInstrumentEntry)
bool shouldInstrumentBlock (const BasicBlock &BB) const
BlockSet getDependencies (const BasicBlock &BB) const
uint64_t getInstrumentedBlocksHash () const
void dump (raw_ostream &OS) const
 Dump the inference graph.
void viewBlockCoverageGraph (const DenseMap< const BasicBlock *, bool > *Coverage=nullptr) const
 View the inferred block coverage as a dot file.

Friends

class DotFuncBCIInfo

Detailed Description

Definition at line 29 of file BlockCoverageInference.h.

Member Typedef Documentation

◆ BlockSet

Constructor & Destructor Documentation

◆ BlockCoverageInference()

BlockCoverageInference::BlockCoverageInference ( const Function & F,
bool ForceInstrumentEntry )

Definition at line 50 of file BlockCoverageInference.cpp.

References assert(), and shouldInstrumentBlock().

Member Function Documentation

◆ dump()

void BlockCoverageInference::dump ( raw_ostream & OS) const

Dump the inference graph.

Definition at line 339 of file BlockCoverageInference.cpp.

References getInstrumentedBlocksHash(), shouldInstrumentBlock(), and llvm::Twine::utohexstr().

◆ getDependencies()

BlockCoverageInference::BlockSet BlockCoverageInference::getDependencies ( const BasicBlock & BB) const
Returns
the set of blocks Deps such that BB is covered iff any blocks in Deps are covered.

Definition at line 65 of file BlockCoverageInference.cpp.

References assert(), llvm::BasicBlock::getParent(), and llvm::SetVector< T, Vector, Set, N >::set_union().

◆ getInstrumentedBlocksHash()

uint64_t BlockCoverageInference::getInstrumentedBlocksHash ( ) const
Returns
a hash that depends on the set of instrumented blocks.

Definition at line 77 of file BlockCoverageInference.cpp.

References llvm::Data, llvm::JamCRC::getCRC(), shouldInstrumentBlock(), llvm::JamCRC::update(), and llvm::support::endian::write64le().

Referenced by dump().

◆ shouldInstrumentBlock()

bool BlockCoverageInference::shouldInstrumentBlock ( const BasicBlock & BB) const
Returns
true if BB should be instrumented for coverage.

Definition at line 91 of file BlockCoverageInference.cpp.

References assert(), and llvm::BasicBlock::getParent().

Referenced by BlockCoverageInference(), dump(), and getInstrumentedBlocksHash().

◆ viewBlockCoverageGraph()

void BlockCoverageInference::viewBlockCoverageGraph ( const DenseMap< const BasicBlock *, bool > * Coverage = nullptr) const

View the inferred block coverage as a dot file.

Filled gray blocks are instrumented, red outlined blocks are found to be covered, red edges show that a block's coverage can be inferred from its successors, and blue edges show that a block's coverage can be inferred from its predecessors.

Definition at line 332 of file BlockCoverageInference.cpp.

References DotFuncBCIInfo, Info, and llvm::WriteGraph().

◆ DotFuncBCIInfo

friend class DotFuncBCIInfo
friend

Definition at line 30 of file BlockCoverageInference.h.

References DotFuncBCIInfo.

Referenced by DotFuncBCIInfo, and viewBlockCoverageGraph().


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