LLVM  14.0.0git
Macros | Enumerations | Functions | Variables
GCOVProfiling.cpp File Reference
#include "CFGMST.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.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/InitializePasses.h"
#include "llvm/Pass.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/GCOVProfiler.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
Include dependency graph for GCOVProfiling.cpp:

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)
 
 INITIALIZE_PASS_BEGIN (GCOVProfilerLegacyPass, "insert-gcov-profiling", "Insert instrumentation for GCOV profiling", false, false) INITIALIZE_PASS_END(GCOVProfilerLegacyPass
 
static StringRef getFunctionName (const DISubprogram *SP)
 
static SmallString< 128 > getFilename (const DISubprogram *SP)
 Extract a filename for a DISubprogram. More...
 
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< bool > AtomicCounter ("gcov-atomic-counter", cl::Hidden, cl::desc("Make counter updates atomic"))
 
insert gcov profiling
 
insert gcov Insert instrumentation for GCOV false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "insert-gcov-profiling"

Definition at line 57 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 59 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 648 of file GCOVProfiling.cpp.

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

◆ 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 266 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 255 of file GCOVProfiling.cpp.

References llvm::DIScope::getName().

◆ getInstrBB()

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

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( GCOVProfilerLegacyPass  ,
"insert-gcov-profiling ,
"Insert instrumentation for GCOV profiling ,
false  ,
false   
)

◆ isUsingScopeBasedEH()

static bool isUsingScopeBasedEH ( Function F)
static

◆ wordsOfString()

static unsigned wordsOfString ( StringRef  s)
static

Definition at line 76 of file GCOVProfiling.cpp.

References s.

Variable Documentation

◆ AtomicCounter

cl::opt<bool> AtomicCounter("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)
static

◆ false

insert gcov Insert instrumentation for GCOV false

Definition at line 249 of file GCOVProfiling.cpp.

◆ profiling

insert gcov Insert instrumentation for GCOV profiling

Definition at line 248 of file GCOVProfiling.cpp.