12#ifndef LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H
13#define LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H
65 return Ctx->CountersSectionEnd -
Ctx->CountersSectionStart;
81 std::unique_ptr<MemoryBuffer>
Buffer;
94 const std::unique_ptr<Context>
Ctx;
117 friend struct yaml::SequenceElementTraits<
Probe>;
129template <
class IntPtrT>
138 return Data.empty() ? nullptr :
Data.data();
145 get(std::unique_ptr<InstrProfCorrelator::Context>
Ctx,
149 std::vector<RawInstrProf::ProfileData<IntPtrT>>
Data;
171 std::unique_ptr<InstrProfCorrelator::Context>
Ctx)
178template <
class IntPtrT>
182 std::unique_ptr<InstrProfCorrelator::Context>
Ctx)
187 std::unique_ptr<DWARFContext> DICtx;
190 std::optional<uint64_t> getLocation(
const DWARFDie &Die)
const;
194 static bool isDIEOfProbe(
const DWARFDie &Die);
223 void correlateProfileDataImpl(
227 Error correlateProfileNameImpl()
override;
232template <
class IntPtrT>
245 void correlateProfileDataImpl(
249 Error correlateProfileNameImpl()
override;
This file declares a Build ID fetcher implementation for obtaining debug info from debuginfod.
This file declares a library for handling Build IDs and using them to find debug info.
This file defines the DenseSet and SmallDenseSet classes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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
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.
static llvm::Expected< std::unique_ptr< InstrProfCorrelator > > get(StringRef Filename, ProfCorrelatorKind FileKind, const object::BuildIDFetcher *BIDFetcher=nullptr, const ArrayRef< llvm::object::BuildID > BIs={})
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.
BuildIDFetcher searches local cache directories for debug info.
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