LLVM  6.0.0svn
Namespaces | Macros | Functions | Variables
InstrProf.cpp File Reference
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SwapByteOrder.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <string>
#include <system_error>
#include <utility>
#include <vector>
#include "llvm/ProfileData/InstrProfData.inc"
Include dependency graph for InstrProf.cpp:

Go to the source code of this file.

Namespaces

 llvm
 Compute iterated dominance frontiers using a linear time algorithm.
 

Macros

#define INSTR_PROF_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix)   SectNameCommon,
 
#define INSTR_PROF_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix)   SectNameCoff,
 
#define INSTR_PROF_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix)   Prefix,
 
#define INSTR_PROF_COMMON_API_IMPL
 

Functions

static std::string getInstrProfErrString (instrprof_error Err)
 
std::string llvm::getInstrProfSectionName (InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
 Return the name of the profile section corresponding to IPSK. More...
 
std::string llvm::getPGOFuncName (StringRef RawFuncName, GlobalValue::LinkageTypes Linkage, StringRef FileName, uint64_t Version=INSTR_PROF_INDEX_VERSION)
 Return the modified name for a function suitable to be used the key for profile lookup. More...
 
static StringRef llvm::stripDirPrefix (StringRef PathNameStr, uint32_t NumPrefix)
 
std::string llvm::getPGOFuncName (const Function &F, bool InLTO=false, uint64_t Version=INSTR_PROF_INDEX_VERSION)
 Return the modified name for function F suitable to be used the key for profile lookup. More...
 
StringRef llvm::getFuncNameWithoutPrefix (StringRef PGOFuncName, StringRef FileName="<unknown>")
 Given a PGO function name, remove the filename prefix and return the original (static) function name. More...
 
std::string llvm::getPGOFuncNameVarName (StringRef FuncName, GlobalValue::LinkageTypes Linkage)
 Return the name of the global variable used to store a function name in PGO instrumentation. More...
 
GlobalVariablellvm::createPGOFuncNameVar (Module &M, GlobalValue::LinkageTypes Linkage, StringRef PGOFuncName)
 Create and return the global variable for function name used in PGO instrumentation. More...
 
GlobalVariablellvm::createPGOFuncNameVar (Function &F, StringRef PGOFuncName)
 Create and return the global variable for function name used in PGO instrumentation. More...
 
Error llvm::collectPGOFuncNameStrings (ArrayRef< std::string > NameStrs, bool doCompression, std::string &Result)
 Given a vector of strings (function PGO names) NameStrs, the method generates a combined string Result thatis ready to be serialized. More...
 
StringRef llvm::getPGOFuncNameVarInitializer (GlobalVariable *NameVar)
 Return the initializer in string of the PGO name var NameVar. More...
 
Error llvm::collectPGOFuncNameStrings (ArrayRef< GlobalVariable *> NameVars, std::string &Result, bool doCompression=true)
 Produce Result string with the same format described above. More...
 
Error llvm::readPGOFuncNameStrings (StringRef NameStrings, InstrProfSymtab &Symtab)
 NameStrings is a string composed of one of more sub-strings encoded in the format described above. More...
 
uint32_t llvm::getNumValueKindsInstrProf (const void *Record)
 ValueProfRecordClosure Interface implementation for InstrProfRecord class. More...
 
uint32_t llvm::getNumValueSitesInstrProf (const void *Record, uint32_t VKind)
 
uint32_t llvm::getNumValueDataInstrProf (const void *Record, uint32_t VKind)
 
uint32_t llvm::getNumValueDataForSiteInstrProf (const void *R, uint32_t VK, uint32_t S)
 
void llvm::getValueForSiteInstrProf (const void *R, InstrProfValueData *Dst, uint32_t K, uint32_t S)
 
ValueProfData * llvm::allocValueProfDataInstrProf (size_t TotalSizeInBytes)
 
template<class T >
static T llvm::swapToHostOrder (const unsigned char *&D, support::endianness Orig)
 
static std::unique_ptr< ValueProfData > llvm::allocValueProfData (uint32_t TotalSize)
 
void llvm::annotateValueSite (Module &M, Instruction &Inst, const InstrProfRecord &InstrProfR, InstrProfValueKind ValueKind, uint32_t SiteIndx, uint32_t MaxMDCount=3)
 Get the value profile data for value site SiteIdx from InstrProfR and annotate the instruction Inst with the value profile meta data. More...
 
void llvm::annotateValueSite (Module &M, Instruction &Inst, ArrayRef< InstrProfValueData > VDs, uint64_t Sum, InstrProfValueKind ValueKind, uint32_t MaxMDCount)
 Same as the above interface but using an ArrayRef, as well as Sum. More...
 
bool llvm::getValueProfDataFromInst (const Instruction &Inst, InstrProfValueKind ValueKind, uint32_t MaxNumValueData, InstrProfValueData ValueData[], uint32_t &ActualNumValueData, uint64_t &TotalC)
 Extract the value profile data from Inst which is annotated with value profile meta data. More...
 
MDNodellvm::getPGOFuncNameMetadata (const Function &F)
 Return the PGOFuncName meta data associated with a function. More...
 
void llvm::createPGOFuncNameMetadata (Function &F, StringRef PGOFuncName)
 Create the PGOFuncName meta data if PGOFuncName is different from function's raw name. More...
 
bool llvm::needsComdatForCounter (const Function &F, const Module &M)
 Check if we can use Comdat for profile variables. More...
 
bool llvm::isIRPGOFlagSet (const Module *M)
 Check if INSTR_PROF_RAW_VERSION_VAR is defined. More...
 
bool llvm::canRenameComdatFunc (const Function &F, bool CheckAddressTaken=false)
 Check if we can safely rename this Comdat function. More...
 
void llvm::getMemOPSizeRangeFromOption (StringRef Str, int64_t &RangeStart, int64_t &RangeLast)
 

Variables

static cl::opt< boolStaticFuncFullModulePrefix ("static-func-full-module-prefix", cl::init(true), cl::desc("Use full module build paths in the profile counter names for " "static functions."))
 
static cl::opt< unsignedStaticFuncStripDirNamePrefix ("static-func-strip-dirname-prefix", cl::init(0), cl::desc("Strip specified level of directory name from source path in " "the profile counter name for static functions."))
 
static ManagedStatic< InstrProfErrorCategoryType > ErrorCategory
 
static ValueProfRecordClosure llvm::InstrProfRecordClosure
 

Macro Definition Documentation

◆ INSTR_PROF_COMMON_API_IMPL

#define INSTR_PROF_COMMON_API_IMPL

Definition at line 601 of file InstrProf.cpp.

◆ INSTR_PROF_SECT_ENTRY [1/3]

#define INSTR_PROF_SECT_ENTRY (   Kind,
  SectNameCommon,
  SectNameCoff,
  Prefix 
)    SectNameCommon,

◆ INSTR_PROF_SECT_ENTRY [2/3]

#define INSTR_PROF_SECT_ENTRY (   Kind,
  SectNameCommon,
  SectNameCoff,
  Prefix 
)    SectNameCoff,

◆ INSTR_PROF_SECT_ENTRY [3/3]

#define INSTR_PROF_SECT_ENTRY (   Kind,
  SectNameCommon,
  SectNameCoff,
  Prefix 
)    Prefix,

Function Documentation

◆ getInstrProfErrString()

static std::string getInstrProfErrString ( instrprof_error  Err)
static

Variable Documentation

◆ ErrorCategory

ManagedStatic<InstrProfErrorCategoryType> ErrorCategory
static

Definition at line 135 of file InstrProf.cpp.

Referenced by llvm::instrprof_category().

◆ StaticFuncFullModulePrefix

cl::opt<bool> StaticFuncFullModulePrefix("static-func-full-module-prefix", cl::init(true), cl::desc("Use full module build paths in the profile counter names for " "static functions."))
static

Referenced by llvm::getPGOFuncName().

◆ StaticFuncStripDirNamePrefix

cl::opt<unsigned> StaticFuncStripDirNamePrefix("static-func-strip-dirname-prefix", cl::init(0), cl::desc("Strip specified level of directory name from source path in " "the profile counter name for static functions."))
static

Referenced by llvm::getPGOFuncName().