LLVM
8.0.1
|
#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/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/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"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "instrprof" |
#define | VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType |
#define | VALUE_RANGE_PROF 1 |
#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 InstrProfIncrementInst * | castToIncrementInst (Instruction *Instr) |
static bool | containsProfilingIntrinsics (Module &M) |
Check if the module contains uses of any profiling intrinsics. More... | |
static Constant * | getOrInsertValueProfilingCall (Module &M, const TargetLibraryInfo &TLI, bool IsRange=false) |
static std::string | getVarName (InstrProfIncrementInst *Inc, StringRef Prefix) |
Get the name of a profiling variable for a particular function. More... | |
static bool | shouldRecordFunctionAddr (Function *F) |
static Comdat * | getOrCreateProfileComdat (Module &M, Function &F, InstrProfIncrementInst *Inc) |
static bool | needsRuntimeRegistrationOfSectionRange (const Module &M) |
Variables | |
cl::opt< std::string > | MemOPSizeRange ("memop-size-range", cl::desc("Set the range of size in memory intrinsic calls to be profiled " "precisely, in a format of <start_val>:<end_val>"), cl::init("")) |
cl::opt< unsigned > | MemOPSizeLarge ("memop-size-large", cl::desc("Set large value thresthold in memory intrinsic size profiling. " "Value of 0 disables the large value profiling."), cl::init(8192)) |
instrprof | |
Frontend instrumentation based coverage | lowering |
Frontend instrumentation based coverage | false |
#define DEBUG_TYPE "instrprof" |
Definition at line 56 of file InstrProfiling.cpp.
#define INSTR_PROF_MIN_VAL_COUNTS 10 |
Referenced by needsRuntimeRegistrationOfSectionRange().
#define VALUE_PROF_FUNC_PARAM | ( | ParamType, | |
ParamName, | |||
ParamLLVMType | |||
) | ParamLLVMType |
#define VALUE_PROF_FUNC_PARAM | ( | ParamType, | |
ParamName, | |||
ParamLLVMType | |||
) | ParamLLVMType |
#define VALUE_RANGE_PROF 1 |
|
static |
Definition at line 372 of file InstrProfiling.cpp.
References llvm::dyn_cast(), E, F(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopsInPreorder(), llvm::BasicBlock::getParent(), I, Loops, and llvm::reverse().
Check if the module contains uses of any profiling intrinsics.
Definition at line 439 of file InstrProfiling.cpp.
References llvm::Module::getFunction(), llvm::Intrinsic::getName(), llvm::Intrinsic::instrprof_increment, llvm::Intrinsic::instrprof_increment_step, llvm::Intrinsic::instrprof_value_profile, and llvm::Value::use_empty().
Referenced by llvm::InstrProfiling::run().
|
inlinestatic |
Definition at line 681 of file InstrProfiling.cpp.
References ComdatPrefix, llvm::getInstrProfComdatPrefix(), llvm::getInstrProfCountersVarPrefix(), llvm::Module::getOrInsertComdat(), llvm::Module::getTargetTriple(), getVarName(), and llvm::needsComdatForCounter().
Referenced by needsRuntimeRegistrationOfSectionRange().
|
static |
Definition at line 512 of file InstrProfiling.cpp.
References llvm::AtomicRMWInst::Add, llvm::CallBase::addParamAttr(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::IRBuilder< T, Inserter >::CreateAdd(), llvm::IRBuilder< T, Inserter >::CreateAtomicRMW(), llvm::IRBuilder< T, Inserter >::CreateConstInBoundsGEP2_64(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::IRBuilder< T, Inserter >::CreateStore(), llvm::User::dropAllReferences(), E, llvm::Instruction::eraseFromParent(), llvm::GlobalVariable::eraseFromParent(), llvm::FunctionType::get(), llvm::Module::getContext(), llvm::TargetLibraryInfo::getExtAttrForI32Param(), llvm::InstrProfIncrementInst::getIndex(), llvm::InstrProfValueProfileInst::getIndex(), llvm::GlobalVariable::getInitializer(), llvm::getInstrProfValueProfFuncName(), llvm::getInstrProfValueRangeProfFuncName(), llvm::InstrProfValueProfileInst::getName(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Module::getOrInsertFunction(), llvm::InstrProfIncrementInst::getStep(), llvm::InstrProfValueProfileInst::getTargetValue(), llvm::InstrProfValueProfileInst::getValueKind(), llvm::Type::getVoidTy(), llvm::ConstantInt::getZExtValue(), I, INT64_MIN, Kind, llvm::SPII::Load, llvm::makeArrayRef(), MemOPSizeLarge, llvm::Monotonic, Name, NC, llvm::X86II::PD, llvm::GlobalValue::PrivateLinkage, llvm::Value::replaceAllUsesWith(), llvm::GlobalValue::setLinkage(), llvm::SPII::Store, and llvm::Constant::stripPointerCasts().
|
static |
Get the name of a profiling variable for a particular function.
Definition at line 636 of file InstrProfiling.cpp.
References llvm::canRenameComdatFunc(), llvm::StringRef::endswith(), llvm::InstrProfIncrementInst::getHash(), llvm::getInstrProfNameVarPrefix(), llvm::Value::getName(), llvm::InstrProfIncrementInst::getName(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ConstantInt::getZExtValue(), llvm::isIRPGOFlagSet(), Name, llvm::StringRef::size(), llvm::StringRef::substr(), and llvm::toStringRef().
Referenced by getOrCreateProfileComdat(), and needsRuntimeRegistrationOfSectionRange().
INITIALIZE_PASS_BEGIN | ( | InstrProfilingLegacyPass | , |
"instrprof" | , | ||
"Frontend instrumentation-based coverage lowering." | , | ||
false | , | ||
false | |||
) |
Referenced by llvm::InstrProfiling::run().
Definition at line 696 of file InstrProfiling.cpp.
References llvm::appendToGlobalCtors(), llvm::appendToUsed(), llvm::collectPGOFuncNameStrings(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::IRBuilder< T, Inserter >::CreateRet(), llvm::IRBuilder< T, Inserter >::CreateRetVoid(), llvm::Data, E, llvm::StringRef::empty(), llvm::GlobalValue::ExternalLinkage, F(), llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::StructType::get(), llvm::ArrayType::get(), llvm::ConstantStruct::get(), llvm::ConstantPointerNull::get(), llvm::ConstantExpr::getBitCast(), llvm::Module::getContext(), llvm::Module::getFunction(), llvm::Module::getGlobalVariable(), llvm::getInstrProfCountersVarPrefix(), llvm::getInstrProfDataVarPrefix(), llvm::getInstrProfInitFuncName(), llvm::getInstrProfNamesRegFuncName(), llvm::getInstrProfNamesVarName(), llvm::getInstrProfRegFuncName(), llvm::getInstrProfRegFuncsName(), llvm::getInstrProfRuntimeHookVarName(), llvm::getInstrProfRuntimeHookVarUseFuncName(), llvm::getInstrProfSectionName(), llvm::getInstrProfValuesVarPrefix(), llvm::getInstrProfVNodesVarName(), llvm::Type::getInt16Ty(), llvm::Type::getInt32Ty(), llvm::IRBuilderBase::getInt64(), llvm::Type::getInt64Ty(), llvm::Type::getInt8PtrTy(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::InstrProfIncrementInst::getName(), llvm::Constant::getNullValue(), llvm::InstrProfIncrementInst::getNumCounters(), getOrCreateProfileComdat(), llvm::Module::getOrInsertComdat(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::ConstantDataArray::getString(), llvm::Module::getTargetTriple(), llvm::Value::getType(), getVarName(), llvm::GlobalValue::getVisibility(), llvm::Type::getVoidTy(), llvm::ConstantInt::getZExtValue(), llvm::GlobalValue::Global, llvm::GlobalValue::HiddenVisibility, if(), INSTR_PROF_MIN_VAL_COUNTS, Int32Ty, llvm::GlobalValue::InternalLinkage, Kind, llvm::GlobalValue::LinkOnceODRLinkage, llvm::SPII::Load, llvm::makeArrayRef(), llvm::max(), llvm::Attribute::NoInline, llvm::Attribute::NoRedZone, llvm::X86II::PD, llvm::GlobalValue::PrivateLinkage, llvm::report_fatal_error(), llvm::GlobalValue::setLinkage(), llvm::GlobalObject::setSection(), llvm::GlobalValue::setVisibility(), shouldRecordFunctionAddr(), llvm::toString(), and llvm::GlobalValue::WeakAnyLinkage.
Definition at line 651 of file InstrProfiling.cpp.
References llvm::Attribute::AlwaysInline, llvm::Function::hasAddressTaken(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalObject::hasComdat(), llvm::Function::hasFnAttribute(), llvm::GlobalValue::hasLinkOnceLinkage(), and llvm::GlobalValue::hasLocalLinkage().
Referenced by needsRuntimeRegistrationOfSectionRange().
Frontend instrumentation based coverage false |
Definition at line 364 of file InstrProfiling.cpp.
instrprof |
Definition at line 364 of file InstrProfiling.cpp.
Frontend instrumentation based coverage lowering |
Definition at line 364 of file InstrProfiling.cpp.
cl::opt<unsigned> MemOPSizeLarge("memop-size-large", cl::desc("Set large value thresthold in memory intrinsic size profiling. " "Value of 0 disables the large value profiling."), cl::init(8192)) |
Referenced by getOrInsertValueProfilingCall().
cl::opt<std::string> MemOPSizeRange("memop-size-range", cl::desc("Set the range of size in memory intrinsic calls to be profiled " "precisely, in a format of <start_val>:<end_val>"), cl::init("")) |
Referenced by llvm::InstrProfiling::run().