#include "llvm/Transforms/Instrumentation/BlockCoverageInference.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(NumFunctions, "Number of total functions that BCI has processed");
STATISTIC(NumIneligibleFunctions,
"Number of functions for which BCI cannot run on");
STATISTIC(NumBlocks, "Number of total basic blocks that BCI has processed");
STATISTIC(NumInstrumentedBlocks,
"Number of basic blocks instrumented for coverage");
BlockCoverageInference::BlockCoverageInference(const Function &F,
bool ForceInstrumentEntry)
: … { … }
BlockCoverageInference::BlockSet
BlockCoverageInference::getDependencies(const BasicBlock &BB) const { … }
uint64_t BlockCoverageInference::getInstrumentedBlocksHash() const { … }
bool BlockCoverageInference::shouldInstrumentBlock(const BasicBlock &BB) const { … }
void BlockCoverageInference::findDependencies() { … }
void BlockCoverageInference::getReachableAvoiding(const BasicBlock &Start,
const BasicBlock &Avoid,
bool IsForward,
BlockSet &Reachable) const { … }
namespace llvm {
class DotFuncBCIInfo { … };
template <>
struct GraphTraits<DotFuncBCIInfo *> : public GraphTraits<const BasicBlock *> { … };
template <>
struct DOTGraphTraits<DotFuncBCIInfo *> : public DefaultDOTGraphTraits { … };
}
void BlockCoverageInference::viewBlockCoverageGraph(
const DenseMap<const BasicBlock *, bool> *Coverage) const { … }
void BlockCoverageInference::dump(raw_ostream &OS) const { … }
std::string
BlockCoverageInference::getBlockNames(ArrayRef<const BasicBlock *> BBs) { … }