LLVM  6.0.0svn
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
llvm::InstrProfRecord Struct Reference

Profiling information for a single function. More...

#include "llvm/ProfileData/InstrProf.h"

Inheritance diagram for llvm::InstrProfRecord:
Inheritance graph
[legend]
Collaboration diagram for llvm::InstrProfRecord:
Collaboration graph
[legend]

Public Types

using ValueMapType = std::vector< std::pair< uint64_t, uint64_t > >
 

Public Member Functions

 InstrProfRecord ()=default
 
 InstrProfRecord (std::vector< uint64_t > Counts)
 
 InstrProfRecord (InstrProfRecord &&)=default
 
 InstrProfRecord (const InstrProfRecord &RHS)
 
InstrProfRecordoperator= (InstrProfRecord &&)=default
 
InstrProfRecordoperator= (const InstrProfRecord &RHS)
 
uint32_t getNumValueKinds () const
 Return the number of value profile kinds with non-zero number of profile sites. More...
 
uint32_t getNumValueSites (uint32_t ValueKind) const
 Return the number of instrumented sites for ValueKind. More...
 
uint32_t getNumValueData (uint32_t ValueKind) const
 Return the total number of ValueData for ValueKind. More...
 
uint32_t getNumValueDataForSite (uint32_t ValueKind, uint32_t Site) const
 Return the number of value data collected for ValueKind at profiling site: Site. More...
 
std::unique_ptr< InstrProfValueData[]> getValueForSite (uint32_t ValueKind, uint32_t Site, uint64_t *TotalC=nullptr) const
 Return the array of profiled values at Site. More...
 
uint64_t getValueForSite (InstrProfValueData Dest[], uint32_t ValueKind, uint32_t Site) const
 Get the target value/counts of kind ValueKind collected at site Site and store the result in array Dest. More...
 
void reserveSites (uint32_t ValueKind, uint32_t NumValueSites)
 Reserve space for NumValueSites sites. More...
 
void addValueData (uint32_t ValueKind, uint32_t Site, InstrProfValueData *VData, uint32_t N, ValueMapType *ValueMap)
 Add ValueData for ValueKind at value Site. More...
 
void merge (InstrProfRecord &Other, uint64_t Weight, function_ref< void(instrprof_error)> Warn)
 Merge the counts in Other into this one. More...
 
void scale (uint64_t Weight, function_ref< void(instrprof_error)> Warn)
 Scale up profile counts (including value profile data) by Weight. More...
 
void sortValueData ()
 Sort value profile data (per site) by count. More...
 
void Clear ()
 Clear value data entries and edge counters. More...
 
void clearValueData ()
 Clear value data entries. More...
 

Public Attributes

std::vector< uint64_t > Counts
 

Detailed Description

Profiling information for a single function.

Definition at line 592 of file InstrProf.h.

Member Typedef Documentation

◆ ValueMapType

using llvm::InstrProfRecord::ValueMapType = std::vector<std::pair<uint64_t, uint64_t> >

Definition at line 617 of file InstrProf.h.

Constructor & Destructor Documentation

◆ InstrProfRecord() [1/4]

llvm::InstrProfRecord::InstrProfRecord ( )
default

◆ InstrProfRecord() [2/4]

llvm::InstrProfRecord::InstrProfRecord ( std::vector< uint64_t >  Counts)
inline

Definition at line 596 of file InstrProf.h.

◆ InstrProfRecord() [3/4]

llvm::InstrProfRecord::InstrProfRecord ( InstrProfRecord &&  )
default

◆ InstrProfRecord() [4/4]

llvm::InstrProfRecord::InstrProfRecord ( const InstrProfRecord RHS)
inline

Definition at line 598 of file InstrProf.h.

Member Function Documentation

◆ addValueData()

void llvm::InstrProfRecord::addValueData ( uint32_t  ValueKind,
uint32_t  Site,
InstrProfValueData *  VData,
uint32_t  N,
ValueMapType ValueMap 
)

Add ValueData for ValueKind at value Site.

Definition at line 587 of file InstrProf.cpp.

References I, and N.

Referenced by llvm::TextInstrProfReader::readHeader().

◆ Clear()

void llvm::InstrProfRecord::Clear ( )
inline

Clear value data entries and edge counters.

Definition at line 671 of file InstrProf.h.

Referenced by llvm::TextInstrProfReader::readNextRecord().

◆ clearValueData()

void llvm::InstrProfRecord::clearValueData ( )
inline

Clear value data entries.

Definition at line 677 of file InstrProf.h.

References llvm_unreachable, llvm::makeMutableArrayRef(), and llvm::None.

Referenced by llvm::RawInstrProfReader< IntPtrT >::readHeader().

◆ getNumValueData()

uint32_t llvm::InstrProfRecord::getNumValueData ( uint32_t  ValueKind) const
inline

Return the total number of ValueData for ValueKind.

Definition at line 756 of file InstrProf.h.

References N.

◆ getNumValueDataForSite()

uint32_t llvm::InstrProfRecord::getNumValueDataForSite ( uint32_t  ValueKind,
uint32_t  Site 
) const
inline

Return the number of value data collected for ValueKind at profiling site: Site.

Definition at line 767 of file InstrProf.h.

Referenced by llvm::annotateValueSite(), and llvm::InstrProfWriter::writeRecordInText().

◆ getNumValueKinds()

uint32_t llvm::InstrProfRecord::getNumValueKinds ( ) const
inline

Return the number of value profile kinds with non-zero number of profile sites.

Definition at line 749 of file InstrProf.h.

References Kind.

Referenced by llvm::InstrProfWriter::writeRecordInText().

◆ getNumValueSites()

uint32_t llvm::InstrProfRecord::getNumValueSites ( uint32_t  ValueKind) const
inline

Return the number of instrumented sites for ValueKind.

Definition at line 763 of file InstrProf.h.

Referenced by llvm::InstrProfValueSiteRecord::scale(), and llvm::InstrProfWriter::writeRecordInText().

◆ getValueForSite() [1/2]

std::unique_ptr< InstrProfValueData[]> llvm::InstrProfRecord::getValueForSite ( uint32_t  ValueKind,
uint32_t  Site,
uint64_t *  TotalC = nullptr 
) const
inline

Return the array of profiled values at Site.

If TotalC is not null, the total count of all target values at this site will be stored in *TotalC.

Definition at line 773 of file InstrProf.h.

References llvm::NVPTXISD::Dummy, and N.

Referenced by llvm::annotateValueSite(), and llvm::InstrProfWriter::writeRecordInText().

◆ getValueForSite() [2/2]

uint64_t llvm::InstrProfRecord::getValueForSite ( InstrProfValueData  Dest[],
uint32_t  ValueKind,
uint32_t  Site 
) const
inline

Get the target value/counts of kind ValueKind collected at site Site and store the result in array Dest.

Return the total counts of all target values at this site.

Definition at line 789 of file InstrProf.h.

References I, and llvm::SaturatingAdd().

◆ merge()

void llvm::InstrProfRecord::merge ( InstrProfRecord Other,
uint64_t  Weight,
function_ref< void(instrprof_error)>  Warn 
)

Merge the counts in Other into this one.

Optionally scale merged counts by Weight.

Definition at line 522 of file InstrProf.cpp.

References llvm::count_mismatch, llvm::counter_overflow, Counts, E, I, Kind, and llvm::SaturatingMultiplyAdd().

Referenced by llvm::InstrProfWriter::addRecord().

◆ operator=() [1/2]

InstrProfRecord& llvm::InstrProfRecord::operator= ( InstrProfRecord &&  )
default

◆ operator=() [2/2]

InstrProfRecord& llvm::InstrProfRecord::operator= ( const InstrProfRecord RHS)
inline

Definition at line 604 of file InstrProf.h.

References Counts.

◆ reserveSites()

void llvm::InstrProfRecord::reserveSites ( uint32_t  ValueKind,
uint32_t  NumValueSites 
)
inline

Reserve space for NumValueSites sites.

Definition at line 803 of file InstrProf.h.

Referenced by llvm::TextInstrProfReader::readHeader().

◆ scale()

void llvm::InstrProfRecord::scale ( uint64_t  Weight,
function_ref< void(instrprof_error)>  Warn 
)

Scale up profile counts (including value profile data) by Weight.

Definition at line 550 of file InstrProf.cpp.

References llvm::counter_overflow, Kind, llvm::lower_bound(), and llvm::SaturatingMultiply().

Referenced by llvm::InstrProfWriter::addRecord().

◆ sortValueData()

void llvm::InstrProfRecord::sortValueData ( )
inline

Sort value profile data (per site) by count.

Definition at line 664 of file InstrProf.h.

References Kind.

Referenced by llvm::InstrProfWriter::addRecord().

Member Data Documentation

◆ Counts

std::vector<uint64_t> llvm::InstrProfRecord::Counts

The documentation for this struct was generated from the following files: