12#ifndef LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H
13#define LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H
61 return Ctx->CountersSectionEnd -
Ctx->CountersSectionStart;
77 std::unique_ptr<MemoryBuffer>
Buffer;
90 const std::unique_ptr<Context>
Ctx;
113 friend struct yaml::SequenceElementTraits<
Probe>;
125template <
class IntPtrT>
134 return Data.empty() ? nullptr :
Data.data();
141 get(std::unique_ptr<InstrProfCorrelator::Context>
Ctx,
145 std::vector<RawInstrProf::ProfileData<IntPtrT>>
Data;
167 std::unique_ptr<InstrProfCorrelator::Context>
Ctx)
174template <
class IntPtrT>
178 std::unique_ptr<InstrProfCorrelator::Context>
Ctx)
183 std::unique_ptr<DWARFContext> DICtx;
186 std::optional<uint64_t> getLocation(
const DWARFDie &Die)
const;
190 static bool isDIEOfProbe(
const DWARFDie &Die);
219 void correlateProfileDataImpl(
223 Error correlateProfileNameImpl()
override;
228template <
class IntPtrT>
241 void correlateProfileDataImpl(
245 Error correlateProfileNameImpl()
override;
This file defines the DenseSet and SmallDenseSet classes.
BinaryInstrProfCorrelator - A child of InstrProfCorrelatorImpl that takes an object file as input to ...
size_t getNamesSize() const
Return the number of bytes in the names string.
const char * getNamesPointer() const
Return a pointer to the names string that this class constructs.
BinaryInstrProfCorrelator(std::unique_ptr< InstrProfCorrelator::Context > Ctx)
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Implements a dense probed hash-table based set.
DwarfInstrProfCorrelator - A child of InstrProfCorrelatorImpl that takes DWARF debug info as input to...
DwarfInstrProfCorrelator(std::unique_ptr< DWARFContext > DICtx, std::unique_ptr< InstrProfCorrelator::Context > Ctx)
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
InstrProfCorrelatorImpl - A child of InstrProfCorrelator with a template pointer type so that the Pro...
static llvm::Expected< std::unique_ptr< InstrProfCorrelatorImpl< IntPtrT > > > get(std::unique_ptr< InstrProfCorrelator::Context > Ctx, const object::ObjectFile &Obj, ProfCorrelatorKind FileKind)
virtual Error correlateProfileNameImpl()=0
virtual void correlateProfileDataImpl(int MaxWarnings, InstrProfCorrelator::CorrelationData *Data=nullptr)=0
std::vector< RawInstrProf::ProfileData< IntPtrT > > Data
Error correlateProfileData(int MaxWarnings) override
Construct a ProfileData vector used to correlate raw instrumentation data to their functions.
static bool classof(const InstrProfCorrelator *C)
InstrProfCorrelatorImpl(std::unique_ptr< InstrProfCorrelator::Context > Ctx)
void addDataProbe(uint64_t FunctionName, uint64_t CFGHash, IntPtrT CounterOffset, IntPtrT FunctionPtr, uint32_t NumCounters)
const RawInstrProf::ProfileData< IntPtrT > * getDataPointer() const
Return a pointer to the underlying ProfileData vector that this class constructs.
T maybeSwap(T Value) const
Error dumpYaml(int MaxWarnings, raw_ostream &OS) override
Process debug info and dump the correlation data.
size_t getDataSize() const
Return the number of ProfileData elements.
InstrProfCorrelator - A base class used to create raw instrumentation data to their functions.
virtual Error correlateProfileData(int MaxWarnings)=0
Construct a ProfileData vector used to correlate raw instrumentation data to their functions.
static const char * FunctionNameAttributeName
static const char * CFGHashAttributeName
static llvm::Expected< std::unique_ptr< InstrProfCorrelator > > get(StringRef Filename, ProfCorrelatorKind FileKind)
InstrProfCorrelator(InstrProfCorrelatorKind K, std::unique_ptr< Context > Ctx)
uint64_t getCountersSectionSize() const
Return the size of the counters section in bytes.
std::vector< std::string > NamesVec
static const char * NumCountersAttributeName
virtual Error dumpYaml(int MaxWarnings, raw_ostream &OS)=0
Process debug info and dump the correlation data.
const char * getNamesPointer() const
Return a pointer to the names string that this class constructs.
ProfCorrelatorKind
Indicate if we should use the debug info or profile metadata sections to correlate.
virtual ~InstrProfCorrelator()=default
InstrProfCorrelatorKind getKind() const
const std::unique_ptr< Context > Ctx
std::optional< size_t > getDataSize() const
Return the number of ProfileData elements.
size_t getNamesSize() const
Return the number of bytes in the names string.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
This class is the base class for all object file types.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
constexpr T byteswap(T V) noexcept
Reverses the bytes in the given integer value V.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
bool ShouldSwapBytes
True if target and host have different endian orders.
std::unique_ptr< MemoryBuffer > Buffer
uint64_t CountersSectionEnd
static llvm::Expected< std::unique_ptr< Context > > get(std::unique_ptr< MemoryBuffer > Buffer, const object::ObjectFile &Obj, ProfCorrelatorKind FileKind)
uint64_t CountersSectionStart
The address range of the __llvm_prf_cnts section.
const char * DataStart
The pointer points to start/end of profile data/name sections if FileKind is Binary.
std::vector< Probe > Probes
std::optional< std::string > LinkageName
std::optional< int > LineNumber
yaml::Hex64 CounterOffset
std::optional< std::string > FilePath