LLVM: include/llvm/ProfileData/InstrProfCorrelator.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12#ifndef LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H

13#define LLVM_PROFILEDATA_INSTRPROFCORRELATOR_H

14

24#include

25#include

26

27namespace llvm {

31}

32

33

34

36public:

37

38

40

42 get(StringRef Filename, ProfCorrelatorKind FileKind,

45

46

47

48

50

51

52

54

55

57

58

60

61

63

64

66 return Ctx->CountersSectionEnd - Ctx->CountersSectionStart;

67 }

68

72

76

77protected:

82 std::unique_ptr Buffer;

83

86

87

92

94 };

95 const std::unique_ptr Ctx;

96

99

102

112

116

120

121private:

124

126};

127

128

129

130template

132public:

135

136

137

139 return Data.empty() ? nullptr : Data.data();

140 }

141

142

144

146 get(std::unique_ptrInstrProfCorrelator::Context Ctx,

148

149protected:

150 std::vector<RawInstrProf::ProfileData> Data;

151

154 int MaxWarnings,

156

158

160

162 IntPtrT CounterOffset, IntPtrT FunctionPtr,

164

165

169

170private:

172 std::unique_ptrInstrProfCorrelator::Context Ctx)

175};

176

177

178

179template

181public:

183 std::unique_ptrInstrProfCorrelator::Context Ctx)

185 DICtx(std::move(DICtx)) {}

186

187private:

188 std::unique_ptr DICtx;

189

190

192

193

194

195 static bool isDIEOfProbe(const DWARFDie &Die);

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224 void correlateProfileDataImpl(

225 int MaxWarnings,

227

229};

230

231

232

233template

235public:

238

239

241

242

244

245private:

246 void correlateProfileDataImpl(

247 int MaxWarnings,

249

251};

252

253}

254

255#endif

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.

static MemoryLocation getLocation(Instruction *I)

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t getNamesSize() const

Return the number of bytes in the names string.

Definition InstrProfCorrelator.h:243

const char * getNamesPointer() const

Return a pointer to the names string that this class constructs.

Definition InstrProfCorrelator.h:240

BinaryInstrProfCorrelator(std::unique_ptr< InstrProfCorrelator::Context > Ctx)

Definition InstrProfCorrelator.h:236

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(std::unique_ptr< DWARFContext > DICtx, std::unique_ptr< InstrProfCorrelator::Context > Ctx)

Definition InstrProfCorrelator.h:182

Lightweight error class with error context and mandatory checking.

Tagged union holding either a T or a Error.

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

Definition InstrProfCorrelator.h:150

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.

Definition InstrProfCorrelator.h:138

T maybeSwap(T Value) const

Definition InstrProfCorrelator.h:166

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.

Definition InstrProfCorrelator.h:143

InstrProfCorrelator - A base class used to create raw instrumentation data to their functions.

Definition InstrProfCorrelator.h:35

virtual Error correlateProfileData(int MaxWarnings)=0

Construct a ProfileData vector used to correlate raw instrumentation data to their functions.

static LLVM_ABI const char * FunctionNameAttributeName

Definition InstrProfCorrelator.h:69

static LLVM_ABI const char * CFGHashAttributeName

Definition InstrProfCorrelator.h:70

InstrProfCorrelator(InstrProfCorrelatorKind K, std::unique_ptr< Context > Ctx)

Definition InstrProfCorrelator.h:97

uint64_t getCountersSectionSize() const

Return the size of the counters section in bytes.

Definition InstrProfCorrelator.h:65

std::vector< std::string > NamesVec

Definition InstrProfCorrelator.h:101

std::string Names

Definition InstrProfCorrelator.h:100

static LLVM_ABI const char * NumCountersAttributeName

Definition InstrProfCorrelator.h:71

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.

Definition InstrProfCorrelator.h:59

ProfCorrelatorKind

Indicate if we should use the debug info or profile metadata sections to correlate.

Definition InstrProfCorrelator.h:39

@ DEBUG_INFO

Definition InstrProfCorrelator.h:39

@ NONE

Definition InstrProfCorrelator.h:39

@ BINARY

Definition InstrProfCorrelator.h:39

InstrProfCorrelatorKind

Definition InstrProfCorrelator.h:73

@ CK_32Bit

Definition InstrProfCorrelator.h:73

@ CK_64Bit

Definition InstrProfCorrelator.h:73

virtual ~InstrProfCorrelator()=default

InstrProfCorrelatorKind getKind() const

Definition InstrProfCorrelator.h:74

const std::unique_ptr< Context > Ctx

Definition InstrProfCorrelator.h:95

LLVM_ABI std::optional< size_t > getDataSize() const

Return the number of ProfileData elements.

static LLVM_ABI 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.

Definition InstrProfCorrelator.h:62

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.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

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.

Definition InstrProfCorrelator.h:78

size_t NameSize

Definition InstrProfCorrelator.h:91

bool ShouldSwapBytes

True if target and host have different endian orders.

Definition InstrProfCorrelator.h:93

std::unique_ptr< MemoryBuffer > Buffer

Definition InstrProfCorrelator.h:82

const char * NameStart

Definition InstrProfCorrelator.h:90

uint64_t CountersSectionEnd

Definition InstrProfCorrelator.h:85

static LLVM_ABI 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.

Definition InstrProfCorrelator.h:84

const char * DataEnd

Definition InstrProfCorrelator.h:89

const char * DataStart

The pointer points to start/end of profile data/name sections if FileKind is Binary.

Definition InstrProfCorrelator.h:88

std::vector< Probe > Probes

Definition InstrProfCorrelator.h:114

std::string FunctionName

Definition InstrProfCorrelator.h:104

std::optional< std::string > LinkageName

Definition InstrProfCorrelator.h:105

std::optional< int > LineNumber

Definition InstrProfCorrelator.h:110

yaml::Hex64 CounterOffset

Definition InstrProfCorrelator.h:107

yaml::Hex64 CFGHash

Definition InstrProfCorrelator.h:106

std::optional< std::string > FilePath

Definition InstrProfCorrelator.h:109

uint32_t NumCounters

Definition InstrProfCorrelator.h:108

This class should be specialized by any type that needs to be converted to/from a YAML mapping.

This class should be specialized by any type for which vectors of that type need to be converted to/f...