LLVM 20.0.0git
Macros | Enumerations | Functions | Variables
GCOVProfiling.cpp File Reference
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/CFGMST.h"
#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "insert-gcov-profiling"
 

Enumerations

enum  : uint32_t {
  GCOV_ARC_ON_TREE = 1 << 0 , GCOV_TAG_FUNCTION = 0x01000000 , GCOV_TAG_BLOCKS = 0x01410000 , GCOV_TAG_ARCS = 0x01430000 ,
  GCOV_TAG_LINES = 0x01450000
}
 

Functions

static unsigned wordsOfString (StringRef s)
 
static StringRef getFunctionName (const DISubprogram *SP)
 
static SmallString< 128 > getFilename (const DISubprogram *SP)
 Extract a filename for a DISubprogram.
 
static bool functionHasLines (const Function &F, unsigned &EndLine)
 
static bool isUsingScopeBasedEH (Function &F)
 
static BasicBlockgetInstrBB (CFGMST< Edge, BBInfo > &MST, Edge &E, const DenseSet< const BasicBlock * > &ExecBlocks)
 
static void dumpEdges (CFGMST< Edge, BBInfo > &MST, GCOVFunction &GF)
 

Variables

static cl::opt< std::string > DefaultGCOVVersion ("default-gcov-version", cl::init("408*"), cl::Hidden, cl::ValueRequired)
 
static cl::opt< boolAtomicCounter ("gcov-atomic-counter", cl::Hidden, cl::desc("Make counter updates atomic"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "insert-gcov-profiling"

Definition at line 51 of file GCOVProfiling.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
GCOV_ARC_ON_TREE 
GCOV_TAG_FUNCTION 
GCOV_TAG_BLOCKS 
GCOV_TAG_ARCS 
GCOV_TAG_LINES 

Definition at line 53 of file GCOVProfiling.cpp.

Function Documentation

◆ dumpEdges()

static void dumpEdges ( CFGMST< Edge, BBInfo > &  MST,
GCOVFunction GF 
)
static

◆ functionHasLines()

static bool functionHasLines ( const Function F,
unsigned EndLine 
)
static

Definition at line 595 of file GCOVProfiling.cpp.

References F, llvm::DebugLoc::getLine(), and I.

◆ getFilename()

static SmallString< 128 > getFilename ( const DISubprogram SP)
static

Extract a filename for a DISubprogram.

Prefer relative paths in the coverage notes. Clang also may split up absolute paths into a directory and filename component. When the relative path doesn't exist, reconstruct the absolute path.

Definition at line 213 of file GCOVProfiling.cpp.

References llvm::sys::path::append(), llvm::sys::fs::exists(), llvm::DIScope::getDirectory(), and llvm::DIScope::getFilename().

Referenced by llvm::checkDebugInfoMetadata().

◆ getFunctionName()

static StringRef getFunctionName ( const DISubprogram SP)
static

Definition at line 202 of file GCOVProfiling.cpp.

References llvm::DIScope::getName().

◆ getInstrBB()

static BasicBlock * getInstrBB ( CFGMST< Edge, BBInfo > &  MST,
Edge &  E,
const DenseSet< const BasicBlock * > &  ExecBlocks 
)
static

◆ isUsingScopeBasedEH()

static bool isUsingScopeBasedEH ( Function F)
static

◆ wordsOfString()

static unsigned wordsOfString ( StringRef  s)
static

Definition at line 70 of file GCOVProfiling.cpp.

References llvm::StringRef::size().

Variable Documentation

◆ AtomicCounter

cl::opt< bool > AtomicCounter("gcov-atomic-counter", cl::Hidden, cl::desc("Make counter updates atomic")) ( "gcov-atomic-counter"  ,
cl::Hidden  ,
cl::desc("Make counter updates atomic")   
)
static

◆ DefaultGCOVVersion

cl::opt< std::string > DefaultGCOVVersion("default-gcov-version", cl::init("408*"), cl::Hidden, cl::ValueRequired) ( "default-gcov-version"  ,
cl::init("408*")  ,
cl::Hidden  ,
cl::ValueRequired   
)
static