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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_PROFILEDATA_DATAACCESSPROF_H_

18#define LLVM_PROFILEDATA_DATAACCESSPROF_H_

19

30

31#include

32#include

33#include

34

35namespace llvm {

36

38

39

51

53

54

55

56

65

66

67

73

74

75

76

77

78

79

80

82

83

85

86

87

89

90

92};

93}

94

95

96

97

98

100

101

103

104

106public:

110 if (std::holds_alternative(SymHandleRef)) {

111 SymHandle = std::get(SymHandleRef).str();

112 } else

113 SymHandle = std::get<uint64_t>(SymHandleRef);

114

115 for (auto Loc : LocRefs)

117 }

118

122

124};

125

126

127

128

130public:

131

132

134

136

137

138

139

140

141

143

144

146

147

148

149

150 LLVM_ABI std::optional

152

153

155

156

157

158

159

162

163

164

165

169

171

172

173

175 return StrToIndexMap.getArrayRef();

176 }

180 return Records.getArrayRef();

181 }

183 return KnownColdSymbols.getArrayRef();

184 }

186 return KnownColdHashes.getArrayRef();

187 }

188 [[nodiscard]] bool empty() const {

189 return Records.empty() && KnownColdSymbols.empty() &&

190 KnownColdHashes.empty();

191 }

192

193private:

194

196

197

198

199 Error deserializeSymbolsAndFilenames(const unsigned char *&Ptr,

200 const uint64_t NumSampledSymbols,

201 const uint64_t NumColdKnownSymbols);

202

203

204

205 Error deserializeRecords(const unsigned char *&Ptr);

206

207

209

210

211

212

215

216

218

222};

223

224}

225}

226

227#endif

This file defines the BumpPtrAllocator interface.

This file defines DenseMapInfo traits for DenseMap<std::variant<Ts...>>.

This file implements a map that provides insertion order iteration.

This file implements a set that has insertion order iteration characteristics.

This file defines the SmallVector class.

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

Lightweight error class with error context and mandatory checking.

This class implements a map that also provides access to all stored values in a deterministic order.

typename VectorType::value_type value_type

A vector that has set insertion semantics.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.

LLVM_ABI Error addKnownSymbolWithoutSamples(SymbolHandleRef SymbolID)

Add a symbol that's seen in the profiled binary without samples.

ArrayRef< StringToIndexMap::value_type > getStrToIndexMapRef() const

The following methods return array reference for various internal data structures.

Definition DataAccessProf.h:174

LLVM_ABI Error serialize(ProfOStream &OS) const

Serialize profile data to the output stream.

LLVM_ABI std::optional< DataAccessProfRecord > getProfileRecord(const SymbolHandleRef SymID) const

Returns a profile record for SymbolID, or std::nullopt if there isn't a record.

ArrayRef< MapVector< SymbolHandleRef, internal::DataAccessProfRecordRef >::value_type > getRecords() const

Definition DataAccessProf.h:179

LLVM_ABI Error deserialize(const unsigned char *&Ptr)

Deserialize this class from the given buffer.

ArrayRef< StringRef > getKnownColdSymbols() const

Definition DataAccessProf.h:182

LLVM_ABI bool isKnownColdSymbol(const SymbolHandleRef SymID) const

Returns true if SymID is seen in profiled binaries and cold.

bool empty() const

Definition DataAccessProf.h:188

LLVM_ABI Error setDataAccessProfile(SymbolHandleRef SymbolID, uint64_t AccessCount)

Methods to set symbolized data access profile.

DataAccessProfData()

Definition DataAccessProf.h:135

ArrayRef< uint64_t > getKnownColdHashes() const

Definition DataAccessProf.h:185

llvm::MapVector< StringRef, uint64_t > StringToIndexMap

Definition DataAccessProf.h:133

Definition DataAccessProf.h:52

std::variant< std::string, uint64_t > SymbolHandle

Definition DataAccessProf.h:102

std::variant< StringRef, uint64_t > SymbolHandleRef

Definition DataAccessProf.h:99

This is an optimization pass for GlobalISel generic memory operations.

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

DataAccessProfRecord(SymbolHandleRef SymHandleRef, uint64_t AccessCount, ArrayRef< internal::SourceLocationRef > LocRefs)

Definition DataAccessProf.h:107

SymbolHandle SymHandle

Definition DataAccessProf.h:120

uint64_t AccessCount

Definition DataAccessProf.h:121

SmallVector< SourceLocation > Locations

Definition DataAccessProf.h:123

DataAccessProfRecord()=default

uint32_t Line

The line number in the source code.

Definition DataAccessProf.h:49

SourceLocation(StringRef FileNameRef, uint32_t Line)

Definition DataAccessProf.h:41

std::string FileName

The filename where the data is located.

Definition DataAccessProf.h:47

uint64_t SymbolID

Definition DataAccessProf.h:81

bool IsStringLiteral

Definition DataAccessProf.h:88

llvm::SmallVector< SourceLocationRef, 0 > Locations

Definition DataAccessProf.h:91

DataAccessProfRecordRef(uint64_t SymbolID, uint64_t AccessCount, bool IsStringLiteral)

Definition DataAccessProf.h:69

uint64_t AccessCount

Definition DataAccessProf.h:84

uint32_t Line

Definition DataAccessProf.h:63

SourceLocationRef(StringRef FileNameRef, uint32_t Line)

Definition DataAccessProf.h:58

StringRef FileName

Definition DataAccessProf.h:61