LLVM 19.0.0git
Classes | Public Member Functions | List of all members
llvm::ValueProfileCollector Class Reference

Utility analysis that determines what values are worth profiling. More...

#include "Transforms/Instrumentation/ValueProfileCollector.h"


struct  CandidateInfo
class  ValueProfileCollectorImpl
 ValueProfileCollectorImpl inherits the API of PluginChainFinal. More...

Public Member Functions

 ValueProfileCollector (Function &Fn, TargetLibraryInfo &TLI)
 ValueProfileCollector (ValueProfileCollector &&)=delete
ValueProfileCollectoroperator= (ValueProfileCollector &&)=delete
 ValueProfileCollector (const ValueProfileCollector &)=delete
ValueProfileCollectoroperator= (const ValueProfileCollector &)=delete
 ~ValueProfileCollector ()
std::vector< CandidateInfoget (InstrProfValueKind Kind) const
 returns a list of value profiling candidates of the given kind

Detailed Description

Utility analysis that determines what values are worth profiling.

The actual logic is inside the ValueProfileCollectorImpl, whose job is to populate the Candidates vector.

Value profiling an expression means to track the values that this expression takes at runtime and the frequency of each value. It is important to distinguish between two sets of value profiles for a particular expression: 1) The set of values at the point of evaluation. 2) The set of values at the point of use. In some cases, the two sets are identical, but it's not unusual for the two to differ.

To elaborate more, consider this C code, and focus on the expression nn: void foo(int nn, bool b) { if (b) memcpy(x, y, nn); } The point of evaluation can be as early as the start of the function, and let's say the value profile for nn is: total=100; (value,freq) set = {(8,10), (32,50)} The point of use is right before we call memcpy, and since we execute the memcpy conditionally, the value profile of nn can be: total=15; (value,freq) set = {(8,10), (4,5)}

For this reason, a plugin is responsible for computing the insertion point for each value to be profiled. The CandidateInfo structure encapsulates all the information needed for each value profile site.

Definition at line 57 of file ValueProfileCollector.h.

Constructor & Destructor Documentation

◆ ValueProfileCollector() [1/3]

ValueProfileCollector::ValueProfileCollector ( Function Fn,
TargetLibraryInfo TLI 

Definition at line 66 of file ValueProfileCollector.cpp.

◆ ValueProfileCollector() [2/3]

llvm::ValueProfileCollector::ValueProfileCollector ( ValueProfileCollector &&  )

◆ ValueProfileCollector() [3/3]

llvm::ValueProfileCollector::ValueProfileCollector ( const ValueProfileCollector )

◆ ~ValueProfileCollector()

ValueProfileCollector::~ValueProfileCollector ( )

Member Function Documentation

◆ get()

std::vector< CandidateInfo > ValueProfileCollector::get ( InstrProfValueKind  Kind) const

returns a list of value profiling candidates of the given kind

Definition at line 73 of file ValueProfileCollector.cpp.

◆ operator=() [1/2]

ValueProfileCollector & llvm::ValueProfileCollector::operator= ( const ValueProfileCollector )

◆ operator=() [2/2]

ValueProfileCollector & llvm::ValueProfileCollector::operator= ( ValueProfileCollector &&  )

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