LLVM  14.0.0git
Macros | Functions | Variables
InstrProfiling.cpp File Reference
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <string>
#include "llvm/ProfileData/InstrProfData.inc"
Include dependency graph for InstrProfiling.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instrprof"
 
#define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType)   ParamLLVMType
 
#define INSTR_PROF_DATA(Type, LLVMType, Name, Init)   LLVMType,
 
#define INSTR_PROF_DATA(Type, LLVMType, Name, Init)   Init,
 
#define INSTR_PROF_MIN_VAL_COUNTS   10
 
#define INSTR_PROF_VALUE_NODE(Type, LLVMType, Name, Init)   LLVMType,
 

Functions

 INITIALIZE_PASS_BEGIN (InstrProfilingLegacyPass, "instrprof", "Frontend instrumentation-based coverage lowering.", false, false) INITIALIZE_PASS_END(InstrProfilingLegacyPass
 
static InstrProfIncrementInstcastToIncrementInst (Instruction *Instr)
 
static bool containsProfilingIntrinsics (Module &M)
 Check if the module contains uses of any profiling intrinsics. More...
 
static FunctionCallee getOrInsertValueProfilingCall (Module &M, const TargetLibraryInfo &TLI, ValueProfilingCallType CallType=ValueProfilingCallType::Default)
 
static std::string getVarName (InstrProfIncrementInst *Inc, StringRef Prefix)
 Get the name of a profiling variable for a particular function. More...
 
static uint64_t getIntModuleFlagOrZero (const Module &M, StringRef Flag)
 
static bool enablesValueProfiling (const Module &M)
 
static bool profDataReferencedByCode (const Module &M)
 
static bool shouldRecordFunctionAddr (Function *F)
 
static bool needsRuntimeRegistrationOfSectionRange (const Triple &TT)
 

Variables

 instrprof
 
Frontend instrumentation based coverage lowering
 
Frontend instrumentation based coverage false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "instrprof"

Definition at line 58 of file InstrProfiling.cpp.

◆ INSTR_PROF_DATA [1/2]

#define INSTR_PROF_DATA (   Type,
  LLVMType,
  Name,
  Init 
)    LLVMType,

◆ INSTR_PROF_DATA [2/2]

#define INSTR_PROF_DATA (   Type,
  LLVMType,
  Name,
  Init 
)    Init,

◆ INSTR_PROF_MIN_VAL_COUNTS

#define INSTR_PROF_MIN_VAL_COUNTS   10

◆ INSTR_PROF_VALUE_NODE

#define INSTR_PROF_VALUE_NODE (   Type,
  LLVMType,
  Name,
  Init 
)    LLVMType,

◆ VALUE_PROF_FUNC_PARAM

#define VALUE_PROF_FUNC_PARAM (   ParamType,
  ParamName,
  ParamLLVMType 
)    ParamLLVMType

Function Documentation

◆ castToIncrementInst()

static InstrProfIncrementInst* castToIncrementInst ( Instruction Instr)
static

Definition at line 438 of file InstrProfiling.cpp.

◆ containsProfilingIntrinsics()

static bool containsProfilingIntrinsics ( Module M)
static

Check if the module contains uses of any profiling intrinsics.

Definition at line 524 of file InstrProfiling.cpp.

References F, llvm::Intrinsic::getName(), and M.

Referenced by llvm::InstrProfiling::run().

◆ enablesValueProfiling()

static bool enablesValueProfiling ( const Module M)
static

Definition at line 775 of file InstrProfiling.cpp.

References getIntModuleFlagOrZero(), llvm::isIRPGOFlagSet(), and M.

Referenced by profDataReferencedByCode().

◆ getIntModuleFlagOrZero()

static uint64_t getIntModuleFlagOrZero ( const Module M,
StringRef  Flag 
)
static

Definition at line 765 of file InstrProfiling.cpp.

References M.

Referenced by enablesValueProfiling().

◆ getOrInsertValueProfilingCall()

static FunctionCallee getOrInsertValueProfilingCall ( Module M,
const TargetLibraryInfo TLI,
ValueProfilingCallType  CallType = ValueProfilingCallType::Default 
)
static

◆ getVarName()

static std::string getVarName ( InstrProfIncrementInst Inc,
StringRef  Prefix 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( InstrProfilingLegacyPass  ,
"instrprof"  ,
"Frontend instrumentation-based coverage lowering."  ,
false  ,
false   
)

◆ needsRuntimeRegistrationOfSectionRange()

static bool needsRuntimeRegistrationOfSectionRange ( const Triple TT)
static

Definition at line 822 of file InstrProfiling.cpp.

◆ profDataReferencedByCode()

static bool profDataReferencedByCode ( const Module M)
static

Definition at line 781 of file InstrProfiling.cpp.

References enablesValueProfiling(), and M.

Referenced by shouldRecordFunctionAddr().

◆ shouldRecordFunctionAddr()

static bool shouldRecordFunctionAddr ( Function F)
inlinestatic

Definition at line 785 of file InstrProfiling.cpp.

References F, and profDataReferencedByCode().

Variable Documentation

◆ false

Frontend instrumentation based coverage false

Definition at line 430 of file InstrProfiling.cpp.

◆ instrprof

instrprof

Definition at line 429 of file InstrProfiling.cpp.

◆ lowering

Frontend instrumentation based coverage lowering

Definition at line 430 of file InstrProfiling.cpp.