LLVM 22.0.0git
SampleProf.h File Reference
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.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/ProfileData/HashKeyMap.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MathExtras.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::TypeCountMap = std::map<FunctionId, uint64_t>
 Key represents type of a C++ polymorphic class type by its vtable and value represents its counter.
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::CallsiteTypeMap = std::map<LineLocation, TypeCountMap>
using llvm::sampleprof::LocToLocMap
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 , llvm::illegal_line_offset
}
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) , llvm::sampleprof::SecFlagHasVTableTypeProf = (1 << 5)
}
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

LLVM_ABI 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)
LLVM_ABI raw_ostreamllvm::sampleprof::operator<< (raw_ostream &OS, const LineLocation &Loc)
std::error_code llvm::sampleprof::serializeTypeMap (const TypeCountMap &Map, const MapVector< FunctionId, uint32_t > &NameTable, raw_ostream &OS)
 Write Map to the output stream.
LLVM_ABI 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_ostreamllvm::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.
LLVM_ABI raw_ostreamllvm::sampleprof::operator<< (raw_ostream &OS, const FunctionSamples &FS)
LLVM_ABI void llvm::sampleprof::sortFuncProfiles (const SampleProfileMap &ProfileMap, std::vector< NameFunctionSamples > &SortedProfiles)
std::string llvm::getUniqueInternalLinkagePostfix (const StringRef &FName)

Variables

constexpr char llvm::sampleprof::kVTableProfPrefix [] = "vtables "