LLVM 20.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
SampleProf.h File Reference
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/ProfileData/FunctionId.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/ProfileData/HashKeyMap.h"
#include <algorithm>
#include <cstdint>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <system_error>
#include <unordered_map>
#include <utility>

Go to the source code of this file.

Classes

struct  std::is_error_code_enum< llvm::sampleprof_error >
 
struct  llvm::sampleprof::SecHdrTableEntry
 
struct  llvm::sampleprof::LineLocation
 Represents the relative location of an instruction. More...
 
struct  llvm::sampleprof::LineLocationHash
 
class  llvm::sampleprof::SampleRecord
 Representation of a single sample record. More...
 
struct  llvm::sampleprof::SampleRecord::CallTargetComparator
 
struct  llvm::sampleprof::SampleContextFrame
 
struct  llvm::sampleprof::SampleContextFrameHash
 
class  llvm::sampleprof::SampleContext
 
struct  llvm::sampleprof::SampleContext::Hash
 
class  llvm::sampleprof::FunctionSamples
 Representation of the samples collected for a function. More...
 
class  llvm::sampleprof::SampleProfileMap
 This class provides operator overloads to the map container using MD5 as the key type, so that existing code can still work in most cases using SampleContext as key. More...
 
class  llvm::sampleprof::SampleSorter< LocationT, SampleT >
 Sort a LocationT->SampleT map by LocationT. More...
 
class  llvm::sampleprof::SampleContextTrimmer
 SampleContextTrimmer impelements helper functions to trim, merge cold context profiles. More...
 
class  llvm::sampleprof::ProfileConverter
 Helper class for profile conversion. More...
 
struct  llvm::sampleprof::ProfileConverter::FrameNode
 
class  llvm::sampleprof::ProfileSymbolList
 ProfileSymbolList records the list of function symbols shown up in the binary used to generate the profile. More...
 
struct  llvm::DenseMapInfo< SampleContext >
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  std
 Implement std::hash so that hash_code can be used in STL containers.
 
namespace  llvm::sampleprof
 

Typedefs

using llvm::sampleprof::SampleContextFrameVector = SmallVector< SampleContextFrame, 1 >
 
using llvm::sampleprof::SampleContextFrames = ArrayRef< SampleContextFrame >
 
using llvm::sampleprof::BodySampleMap = std::map< LineLocation, SampleRecord >
 
using llvm::sampleprof::FunctionSamplesMap = std::map< FunctionId, FunctionSamples >
 
using llvm::sampleprof::CallsiteSampleMap = std::map< LineLocation, FunctionSamplesMap >
 
using llvm::sampleprof::LocToLocMap = std::unordered_map< LineLocation, LineLocation, LineLocationHash >
 
using llvm::sampleprof::NameFunctionSamples = std::pair< hash_code, const FunctionSamples * >
 

Enumerations

enum class  llvm::sampleprof_error {
  llvm::success = 0 , llvm::bad_magic , llvm::unsupported_version , llvm::too_large ,
  llvm::truncated , llvm::malformed , llvm::unrecognized_format , llvm::unsupported_writing_format ,
  llvm::truncated_name_table , llvm::not_implemented , llvm::counter_overflow , llvm::ostream_seek_unsupported ,
  llvm::uncompress_failed , llvm::zlib_unavailable , llvm::hash_mismatch
}
 
enum  llvm::sampleprof::SampleProfileFormat {
  llvm::sampleprof::SPF_None = 0 , llvm::sampleprof::SPF_Text = 0x1 , llvm::sampleprof::SPF_Compact_Binary = 0x2 , llvm::sampleprof::SPF_GCC = 0x3 ,
  llvm::sampleprof::SPF_Ext_Binary = 0x4 , llvm::sampleprof::SPF_Binary = 0xff
}
 
enum  llvm::sampleprof::SampleProfileLayout { llvm::sampleprof::SPL_None = 0 , llvm::sampleprof::SPL_Nest = 0x1 , llvm::sampleprof::SPL_Flat = 0x2 }
 
enum  llvm::sampleprof::SecType {
  llvm::sampleprof::SecInValid = 0 , llvm::sampleprof::SecProfSummary = 1 , llvm::sampleprof::SecNameTable = 2 , llvm::sampleprof::SecProfileSymbolList = 3 ,
  llvm::sampleprof::SecFuncOffsetTable = 4 , llvm::sampleprof::SecFuncMetadata = 5 , llvm::sampleprof::SecCSNameTable = 6 , llvm::sampleprof::SecFuncProfileFirst = 32 ,
  llvm::sampleprof::SecLBRProfile = SecFuncProfileFirst
}
 
enum class  llvm::sampleprof::SecCommonFlags : uint32_t { llvm::sampleprof::SecFlagInValid = 0 , llvm::sampleprof::SecFlagCompress = (1 << 0) , llvm::sampleprof::SecFlagFlat = (1 << 1) }
 
enum class  llvm::sampleprof::SecNameTableFlags : uint32_t { llvm::sampleprof::SecFlagInValid = 0 , llvm::sampleprof::SecFlagMD5Name = (1 << 0) , llvm::sampleprof::SecFlagFixedLengthMD5 = (1 << 1) , llvm::sampleprof::SecFlagUniqSuffix = (1 << 2) }
 
enum class  llvm::sampleprof::SecProfSummaryFlags : uint32_t {
  llvm::sampleprof::SecFlagInValid = 0 , llvm::sampleprof::SecFlagPartial = (1 << 0) , llvm::sampleprof::SecFlagFullContext = (1 << 1) , llvm::sampleprof::SecFlagFSDiscriminator = (1 << 2) ,
  llvm::sampleprof::SecFlagIsPreInlined = (1 << 4)
}
 
enum class  llvm::sampleprof::SecFuncMetadataFlags : uint32_t { llvm::sampleprof::SecFlagInvalid = 0 , llvm::sampleprof::SecFlagIsProbeBased = (1 << 0) , llvm::sampleprof::SecFlagHasAttribute = (1 << 1) }
 
enum class  llvm::sampleprof::SecFuncOffsetFlags : uint32_t { llvm::sampleprof::SecFlagInvalid = 0 , llvm::sampleprof::SecFlagOrdered = (1 << 0) }
 
enum  llvm::sampleprof::ContextStateMask {
  llvm::sampleprof::UnknownContext = 0x0 , llvm::sampleprof::RawContext = 0x1 , llvm::sampleprof::SyntheticContext = 0x2 , llvm::sampleprof::InlinedContext = 0x4 ,
  llvm::sampleprof::MergedContext = 0x8
}
 
enum  llvm::sampleprof::ContextAttributeMask { llvm::sampleprof::ContextNone = 0x0 , llvm::sampleprof::ContextWasInlined = 0x1 , llvm::sampleprof::ContextShouldBeInlined = 0x2 , llvm::sampleprof::ContextDuplicatedIntoBase }
 

Functions

const std::error_category & llvm::sampleprof_category ()
 
std::error_code llvm::make_error_code (sampleprof_error E)
 
sampleprof_error llvm::mergeSampleProfErrors (sampleprof_error &Accumulator, sampleprof_error Result)
 
static uint64_t llvm::sampleprof::SPMagic (SampleProfileFormat Format=SPF_Binary)
 
static uint64_t llvm::sampleprof::SPVersion ()
 
static std::string llvm::sampleprof::getSecName (SecType Type)
 
template<class SecFlagType >
static void llvm::sampleprof::verifySecFlag (SecType Type, SecFlagType Flag)
 
template<class SecFlagType >
static void llvm::sampleprof::addSecFlag (SecHdrTableEntry &Entry, SecFlagType Flag)
 
template<class SecFlagType >
static void llvm::sampleprof::removeSecFlag (SecHdrTableEntry &Entry, SecFlagType Flag)
 
template<class SecFlagType >
static bool llvm::sampleprof::hasSecFlag (const SecHdrTableEntry &Entry, SecFlagType Flag)
 
raw_ostreamllvm::sampleprof::operator<< (raw_ostream &OS, const LineLocation &Loc)
 
raw_ostreamllvm::sampleprof::operator<< (raw_ostream &OS, const SampleRecord &Sample)
 
static hash_code llvm::sampleprof::hash_value (const SampleContextFrame &arg)
 
static hash_code llvm::sampleprof::hash_value (const SampleContext &Context)
 
raw_ostream & llvm::sampleprof::operator<< (raw_ostream &OS, const SampleContext &Context)
 
static FunctionId llvm::sampleprof::getRepInFormat (StringRef Name)
 Get the proper representation of a string according to whether the current Format uses MD5 to represent the string.
 
raw_ostreamllvm::sampleprof::operator<< (raw_ostream &OS, const FunctionSamples &FS)
 
void llvm::sampleprof::sortFuncProfiles (const SampleProfileMap &ProfileMap, std::vector< NameFunctionSamples > &SortedProfiles)
 
std::string llvm::getUniqueInternalLinkagePostfix (const StringRef &FName)