LLVM  16.0.0git
MemProf.h
Go to the documentation of this file.
1 #ifndef LLVM_PROFILEDATA_MEMPROF_H_
2 #define LLVM_PROFILEDATA_MEMPROF_H_
3 
4 #include "llvm/ADT/DenseMap.h"
6 #include "llvm/ADT/SmallVector.h"
7 #include "llvm/IR/GlobalValue.h"
9 #include "llvm/Support/Endian.h"
12 
13 #include <cstdint>
14 #include <optional>
15 
16 namespace llvm {
17 namespace memprof {
18 
19 enum class Meta : uint64_t {
20  Start = 0,
21 #define MIBEntryDef(NameTag, Name, Type) NameTag,
23 #undef MIBEntryDef
24  Size
25 };
26 
28 
29 // Holds the actual MemInfoBlock data with all fields. Contents may be read or
30 // written partially by providing an appropriate schema to the serialize and
31 // deserialize methods.
33  PortableMemInfoBlock() = default;
34  explicit PortableMemInfoBlock(const MemInfoBlock &Block) {
35 #define MIBEntryDef(NameTag, Name, Type) Name = Block.Name;
37 #undef MIBEntryDef
38  }
39 
40  PortableMemInfoBlock(const MemProfSchema &Schema, const unsigned char *Ptr) {
41  deserialize(Schema, Ptr);
42  }
43 
44  // Read the contents of \p Ptr based on the \p Schema to populate the
45  // MemInfoBlock member.
46  void deserialize(const MemProfSchema &Schema, const unsigned char *Ptr) {
47  using namespace support;
48 
49  for (const Meta Id : Schema) {
50  switch (Id) {
51 #define MIBEntryDef(NameTag, Name, Type) \
52  case Meta::Name: { \
53  Name = endian::readNext<Type, little, unaligned>(Ptr); \
54  } break;
56 #undef MIBEntryDef
57  default:
58  llvm_unreachable("Unknown meta type id, is the profile collected from "
59  "a newer version of the runtime?");
60  }
61  }
62  }
63 
64  // Write the contents of the MemInfoBlock based on the \p Schema provided to
65  // the raw_ostream \p OS.
66  void serialize(const MemProfSchema &Schema, raw_ostream &OS) const {
67  using namespace support;
68 
70  for (const Meta Id : Schema) {
71  switch (Id) {
72 #define MIBEntryDef(NameTag, Name, Type) \
73  case Meta::Name: { \
74  LE.write<Type>(Name); \
75  } break;
77 #undef MIBEntryDef
78  default:
79  llvm_unreachable("Unknown meta type id, invalid input?");
80  }
81  }
82  }
83 
84  // Print out the contents of the MemInfoBlock in YAML format.
85  void printYAML(raw_ostream &OS) const {
86  OS << " MemInfoBlock:\n";
87 #define MIBEntryDef(NameTag, Name, Type) \
88  OS << " " << #Name << ": " << Name << "\n";
90 #undef MIBEntryDef
91  }
92 
93  // Define getters for each type which can be called by analyses.
94 #define MIBEntryDef(NameTag, Name, Type) \
95  Type get##Name() const { return Name; }
97 #undef MIBEntryDef
98 
99  void clear() { *this = PortableMemInfoBlock(); }
100 
101  // Returns the full schema currently in use.
104 #define MIBEntryDef(NameTag, Name, Type) List.push_back(Meta::Name);
106 #undef MIBEntryDef
107  return List;
108  }
109 
110  bool operator==(const PortableMemInfoBlock &Other) const {
111 #define MIBEntryDef(NameTag, Name, Type) \
112  if (Other.get##Name() != get##Name()) \
113  return false;
115 #undef MIBEntryDef
116  return true;
117  }
118 
119  bool operator!=(const PortableMemInfoBlock &Other) const {
120  return !operator==(Other);
121  }
122 
123  static constexpr size_t serializedSize() {
124  size_t Result = 0;
125 #define MIBEntryDef(NameTag, Name, Type) Result += sizeof(Type);
127 #undef MIBEntryDef
128  return Result;
129  }
130 
131 private:
132 #define MIBEntryDef(NameTag, Name, Type) Type Name = Type();
134 #undef MIBEntryDef
135 };
136 
137 // A type representing the id generated by hashing the contents of the Frame.
139 // Describes a call frame for a dynamic allocation context. The contents of
140 // the frame are populated by symbolizing the stack depot call frame from the
141 // compiler runtime.
142 struct Frame {
143  // A uuid (uint64_t) identifying the function. It is obtained by
144  // llvm::md5(FunctionName) which returns the lower 64 bits.
146  // The symbol name for the function. Only populated in the Frame by the reader
147  // if requested during initialization. This field should not be serialized.
148  std::optional<std::string> SymbolName;
149  // The source line offset of the call from the beginning of parent function.
151  // The source column number of the call to help distinguish multiple calls
152  // on the same line.
154  // Whether the current frame is inlined.
156 
157  Frame(const Frame &Other) {
158  Function = Other.Function;
159  SymbolName = Other.SymbolName;
160  LineOffset = Other.LineOffset;
161  Column = Other.Column;
162  IsInlineFrame = Other.IsInlineFrame;
163  }
164 
165  Frame(uint64_t Hash, uint32_t Off, uint32_t Col, bool Inline)
166  : Function(Hash), LineOffset(Off), Column(Col), IsInlineFrame(Inline) {}
167 
168  bool operator==(const Frame &Other) const {
169  // Ignore the SymbolName field to avoid a string compare. Comparing the
170  // function hash serves the same purpose.
171  return Other.Function == Function && Other.LineOffset == LineOffset &&
172  Other.Column == Column && Other.IsInlineFrame == IsInlineFrame;
173  }
174 
175  Frame &operator=(const Frame &Other) {
176  Function = Other.Function;
177  SymbolName = Other.SymbolName;
178  LineOffset = Other.LineOffset;
179  Column = Other.Column;
180  IsInlineFrame = Other.IsInlineFrame;
181  return *this;
182  }
183 
184  bool operator!=(const Frame &Other) const { return !operator==(Other); }
185 
186  // Write the contents of the frame to the ostream \p OS.
187  void serialize(raw_ostream &OS) const {
188  using namespace support;
189 
190  endian::Writer LE(OS, little);
191 
192  // If the type of the GlobalValue::GUID changes, then we need to update
193  // the reader and the writer.
194  static_assert(std::is_same<GlobalValue::GUID, uint64_t>::value,
195  "Expect GUID to be uint64_t.");
196  LE.write<uint64_t>(Function);
197 
198  LE.write<uint32_t>(LineOffset);
199  LE.write<uint32_t>(Column);
200  LE.write<bool>(IsInlineFrame);
201  }
202 
203  // Read a frame from char data which has been serialized as little endian.
204  static Frame deserialize(const unsigned char *Ptr) {
205  using namespace support;
206 
207  const uint64_t F = endian::readNext<uint64_t, little, unaligned>(Ptr);
208  const uint32_t L = endian::readNext<uint32_t, little, unaligned>(Ptr);
209  const uint32_t C = endian::readNext<uint32_t, little, unaligned>(Ptr);
210  const bool I = endian::readNext<bool, little, unaligned>(Ptr);
211  return Frame(/*Function=*/F, /*LineOffset=*/L, /*Column=*/C,
212  /*IsInlineFrame=*/I);
213  }
214 
215  // Returns the size of the frame information.
216  static constexpr size_t serializedSize() {
217  return sizeof(Frame::Function) + sizeof(Frame::LineOffset) +
218  sizeof(Frame::Column) + sizeof(Frame::IsInlineFrame);
219  }
220 
221  // Print the frame information in YAML format.
222  void printYAML(raw_ostream &OS) const {
223  OS << " -\n"
224  << " Function: " << Function << "\n"
225  << " SymbolName: " << SymbolName.value_or("<None>") << "\n"
226  << " LineOffset: " << LineOffset << "\n"
227  << " Column: " << Column << "\n"
228  << " Inline: " << IsInlineFrame << "\n";
229  }
230 
231  // Return a hash value based on the contents of the frame. Here we don't use
232  // hashing from llvm ADT since we are going to persist the hash id, the hash
233  // combine algorithm in ADT uses a new randomized seed each time.
234  inline FrameId hash() const {
235  auto HashCombine = [](auto Value, size_t Seed) {
236  std::hash<decltype(Value)> Hasher;
237  // The constant used below is the 64 bit representation of the fractional
238  // part of the golden ratio. Used here for the randomness in their bit
239  // pattern.
240  return Hasher(Value) + 0x9e3779b97f4a7c15 + (Seed << 6) + (Seed >> 2);
241  };
242 
243  size_t Result = 0;
244  Result ^= HashCombine(Function, Result);
245  Result ^= HashCombine(LineOffset, Result);
246  Result ^= HashCombine(Column, Result);
247  Result ^= HashCombine(IsInlineFrame, Result);
248  return static_cast<FrameId>(Result);
249  }
250 };
251 
252 // Holds allocation information in a space efficient format where frames are
253 // represented using unique identifiers.
255  // The dynamic calling context for the allocation in bottom-up (leaf-to-root)
256  // order. Frame contents are stored out-of-line.
258  // The statistics obtained from the runtime for the allocation.
260 
261  IndexedAllocationInfo() = default;
262  IndexedAllocationInfo(ArrayRef<FrameId> CS, const MemInfoBlock &MB)
263  : CallStack(CS.begin(), CS.end()), Info(MB) {}
264 
265  // Returns the size in bytes when this allocation info struct is serialized.
266  size_t serializedSize() const {
267  return sizeof(uint64_t) + // The number of frames to serialize.
268  sizeof(FrameId) * CallStack.size() + // The callstack frame ids.
269  PortableMemInfoBlock::serializedSize(); // The size of the payload.
270  }
271 
272  bool operator==(const IndexedAllocationInfo &Other) const {
273  if (Other.Info != Info)
274  return false;
275 
276  if (Other.CallStack.size() != CallStack.size())
277  return false;
278 
279  for (size_t J = 0; J < Other.CallStack.size(); J++) {
280  if (Other.CallStack[J] != CallStack[J])
281  return false;
282  }
283  return true;
284  }
285 
286  bool operator!=(const IndexedAllocationInfo &Other) const {
287  return !operator==(Other);
288  }
289 };
290 
291 // Holds allocation information with frame contents inline. The type should
292 // be used for temporary in-memory instances.
294  // Same as IndexedAllocationInfo::CallStack with the frame contents inline.
296  // Same as IndexedAllocationInfo::Info;
298 
299  AllocationInfo() = default;
301  const IndexedAllocationInfo &IndexedAI,
302  llvm::function_ref<const Frame(const FrameId)> IdToFrameCallback) {
303  for (const FrameId &Id : IndexedAI.CallStack) {
304  CallStack.push_back(IdToFrameCallback(Id));
305  }
306  Info = IndexedAI.Info;
307  }
308 
309  void printYAML(raw_ostream &OS) const {
310  OS << " -\n";
311  OS << " Callstack:\n";
312  // TODO: Print out the frame on one line with to make it easier for deep
313  // callstacks once we have a test to check valid YAML is generated.
314  for (const Frame &F : CallStack) {
315  F.printYAML(OS);
316  }
317  Info.printYAML(OS);
318  }
319 };
320 
321 // Holds the memprof profile information for a function. The internal
322 // representation stores frame ids for efficiency. This representation should
323 // be used in the profile conversion and manipulation tools.
325  // Memory allocation sites in this function for which we have memory
326  // profiling data.
328  // Holds call sites in this function which are part of some memory
329  // allocation context. We store this as a list of locations, each with its
330  // list of inline locations in bottom-up order i.e. from leaf to root. The
331  // inline location list may include additional entries, users should pick
332  // the last entry in the list with the same function GUID.
334 
335  void clear() {
336  AllocSites.clear();
337  CallSites.clear();
338  }
339 
340  void merge(const IndexedMemProfRecord &Other) {
341  // TODO: Filter out duplicates which may occur if multiple memprof
342  // profiles are merged together using llvm-profdata.
343  AllocSites.append(Other.AllocSites);
344  CallSites.append(Other.CallSites);
345  }
346 
347  size_t serializedSize() const {
348  size_t Result = sizeof(GlobalValue::GUID);
349  for (const IndexedAllocationInfo &N : AllocSites)
350  Result += N.serializedSize();
351 
352  // The number of callsites we have information for.
353  Result += sizeof(uint64_t);
354  for (const auto &Frames : CallSites) {
355  // The number of frame ids to serialize.
356  Result += sizeof(uint64_t);
357  Result += Frames.size() * sizeof(FrameId);
358  }
359  return Result;
360  }
361 
362  bool operator==(const IndexedMemProfRecord &Other) const {
363  if (Other.AllocSites.size() != AllocSites.size())
364  return false;
365 
366  if (Other.CallSites.size() != CallSites.size())
367  return false;
368 
369  for (size_t I = 0; I < AllocSites.size(); I++) {
370  if (AllocSites[I] != Other.AllocSites[I])
371  return false;
372  }
373 
374  for (size_t I = 0; I < CallSites.size(); I++) {
375  if (CallSites[I] != Other.CallSites[I])
376  return false;
377  }
378  return true;
379  }
380 
381  // Serializes the memprof records in \p Records to the ostream \p OS based
382  // on the schema provided in \p Schema.
383  void serialize(const MemProfSchema &Schema, raw_ostream &OS);
384 
385  // Deserializes memprof records from the Buffer.
386  static IndexedMemProfRecord deserialize(const MemProfSchema &Schema,
387  const unsigned char *Buffer);
388 
389  // Returns the GUID for the function name after canonicalization. For
390  // memprof, we remove any .llvm suffix added by LTO. MemProfRecords are
391  // mapped to functions using this GUID.
392  static GlobalValue::GUID getGUID(const StringRef FunctionName);
393 };
394 
395 // Holds the memprof profile information for a function. The internal
396 // representation stores frame contents inline. This representation should
397 // be used for small amount of temporary, in memory instances.
399  // Same as IndexedMemProfRecord::AllocSites with frame contents inline.
401  // Same as IndexedMemProfRecord::CallSites with frame contents inline.
403 
404  MemProfRecord() = default;
407  llvm::function_ref<const Frame(const FrameId Id)> IdToFrameCallback) {
408  for (const IndexedAllocationInfo &IndexedAI : Record.AllocSites) {
409  AllocSites.emplace_back(IndexedAI, IdToFrameCallback);
410  }
411  for (const ArrayRef<FrameId> Site : Record.CallSites) {
413  for (const FrameId Id : Site) {
414  Frames.push_back(IdToFrameCallback(Id));
415  }
416  CallSites.push_back(Frames);
417  }
418  }
419 
420  // Prints out the contents of the memprof record in YAML.
421  void print(llvm::raw_ostream &OS) const {
422  if (!AllocSites.empty()) {
423  OS << " AllocSites:\n";
424  for (const AllocationInfo &N : AllocSites)
425  N.printYAML(OS);
426  }
427 
428  if (!CallSites.empty()) {
429  OS << " CallSites:\n";
430  for (const llvm::SmallVector<Frame> &Frames : CallSites) {
431  for (const Frame &F : Frames) {
432  OS << " -\n";
433  F.printYAML(OS);
434  }
435  }
436  }
437  }
438 };
439 
440 // Reads a memprof schema from a buffer. All entries in the buffer are
441 // interpreted as uint64_t. The first entry in the buffer denotes the number of
442 // ids in the schema. Subsequent entries are integers which map to memprof::Meta
443 // enum class entries. After successfully reading the schema, the pointer is one
444 // byte past the schema contents.
445 Expected<MemProfSchema> readMemProfSchema(const unsigned char *&Buffer);
446 
447 // Trait for reading IndexedMemProfRecord data from the on-disk hash table.
449 public:
455 
456  RecordLookupTrait() = delete;
457  RecordLookupTrait(const MemProfSchema &S) : Schema(S) {}
458 
459  static bool EqualKey(uint64_t A, uint64_t B) { return A == B; }
460  static uint64_t GetInternalKey(uint64_t K) { return K; }
461  static uint64_t GetExternalKey(uint64_t K) { return K; }
462 
464 
465  static std::pair<offset_type, offset_type>
466  ReadKeyDataLength(const unsigned char *&D) {
467  using namespace support;
468 
469  offset_type KeyLen = endian::readNext<offset_type, little, unaligned>(D);
470  offset_type DataLen = endian::readNext<offset_type, little, unaligned>(D);
471  return std::make_pair(KeyLen, DataLen);
472  }
473 
474  uint64_t ReadKey(const unsigned char *D, offset_type /*Unused*/) {
475  using namespace support;
476  return endian::readNext<external_key_type, little, unaligned>(D);
477  }
478 
479  data_type ReadData(uint64_t K, const unsigned char *D,
480  offset_type /*Unused*/) {
482  return Record;
483  }
484 
485 private:
486  // Holds the memprof schema used to deserialize records.
487  MemProfSchema Schema;
488  // Holds the records from one function deserialized from the indexed format.
490 };
491 
492 // Trait for writing IndexedMemProfRecord data to the on-disk hash table.
494 public:
497 
500 
503 
504  // Pointer to the memprof schema to use for the generator. Unlike the reader
505  // we must use a default constructor with no params for the writer trait so we
506  // have a public member which must be initialized by the user.
507  MemProfSchema *Schema = nullptr;
508 
509  RecordWriterTrait() = default;
510 
511  static hash_value_type ComputeHash(key_type_ref K) { return K; }
512 
513  static std::pair<offset_type, offset_type>
515  using namespace support;
516 
517  endian::Writer LE(Out, little);
518  offset_type N = sizeof(K);
519  LE.write<offset_type>(N);
521  LE.write<offset_type>(M);
522  return std::make_pair(N, M);
523  }
524 
525  void EmitKey(raw_ostream &Out, key_type_ref K, offset_type /*Unused*/) {
526  using namespace support;
527  endian::Writer LE(Out, little);
528  LE.write<uint64_t>(K);
529  }
530 
531  void EmitData(raw_ostream &Out, key_type_ref /*Unused*/, data_type_ref V,
532  offset_type /*Unused*/) {
533  assert(Schema != nullptr && "MemProf schema is not initialized!");
534  V.serialize(*Schema, Out);
535  }
536 };
537 
538 // Trait for writing frame mappings to the on-disk hash table.
540 public:
541  using key_type = FrameId;
543 
544  using data_type = Frame;
545  using data_type_ref = Frame &;
546 
549 
550  static hash_value_type ComputeHash(key_type_ref K) { return K; }
551 
552  static std::pair<offset_type, offset_type>
554  using namespace support;
555  endian::Writer LE(Out, little);
556  offset_type N = sizeof(K);
557  LE.write<offset_type>(N);
559  LE.write<offset_type>(M);
560  return std::make_pair(N, M);
561  }
562 
563  void EmitKey(raw_ostream &Out, key_type_ref K, offset_type /*Unused*/) {
564  using namespace support;
565  endian::Writer LE(Out, little);
566  LE.write<key_type>(K);
567  }
568 
569  void EmitData(raw_ostream &Out, key_type_ref /*Unused*/, data_type_ref V,
570  offset_type /*Unused*/) {
571  V.serialize(Out);
572  }
573 };
574 
575 // Trait for reading frame mappings from the on-disk hash table.
577 public:
578  using data_type = const Frame;
583 
585  return A == B;
586  }
587  static uint64_t GetInternalKey(internal_key_type K) { return K; }
588  static uint64_t GetExternalKey(external_key_type K) { return K; }
589 
591 
592  static std::pair<offset_type, offset_type>
593  ReadKeyDataLength(const unsigned char *&D) {
594  using namespace support;
595 
596  offset_type KeyLen = endian::readNext<offset_type, little, unaligned>(D);
597  offset_type DataLen = endian::readNext<offset_type, little, unaligned>(D);
598  return std::make_pair(KeyLen, DataLen);
599  }
600 
601  uint64_t ReadKey(const unsigned char *D, offset_type /*Unused*/) {
602  using namespace support;
603  return endian::readNext<external_key_type, little, unaligned>(D);
604  }
605 
606  data_type ReadData(uint64_t K, const unsigned char *D,
607  offset_type /*Unused*/) {
608  return Frame::deserialize(D);
609  }
610 };
611 } // namespace memprof
612 } // namespace llvm
613 
614 #endif // LLVM_PROFILEDATA_MEMPROF_H_
llvm::GlobalValue::GUID
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
Definition: GlobalValue.h:583
llvm::memprof::Frame::Frame
Frame(const Frame &Other)
Definition: MemProf.h:157
llvm::memprof::RecordLookupTrait::ReadKeyDataLength
static std::pair< offset_type, offset_type > ReadKeyDataLength(const unsigned char *&D)
Definition: MemProf.h:466
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::memprof::IndexedMemProfRecord
Definition: MemProf.h:324
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::memprof::AllocationInfo::Info
PortableMemInfoBlock Info
Definition: MemProf.h:297
llvm::memprof::FrameLookupTrait::ComputeHash
hash_value_type ComputeHash(internal_key_type K)
Definition: MemProf.h:590
llvm::memprof::Frame::LineOffset
uint32_t LineOffset
Definition: MemProf.h:150
llvm::memprof::IndexedMemProfRecord::clear
void clear()
Definition: MemProf.h:335
llvm::memprof::IndexedMemProfRecord::operator==
bool operator==(const IndexedMemProfRecord &Other) const
Definition: MemProf.h:362
llvm::Function
Definition: Function.h:60
llvm::memprof::IndexedAllocationInfo::CallStack
llvm::SmallVector< FrameId > CallStack
Definition: MemProf.h:257
llvm::memprof::Frame::hash
FrameId hash() const
Definition: MemProf.h:234
llvm::memprof::PortableMemInfoBlock::serializedSize
static constexpr size_t serializedSize()
Definition: MemProf.h:123
llvm::memprof::RecordWriterTrait::EmitKeyDataLength
static std::pair< offset_type, offset_type > EmitKeyDataLength(raw_ostream &Out, key_type_ref K, data_type_ref V)
Definition: MemProf.h:514
llvm::memprof::IndexedMemProfRecord::CallSites
llvm::SmallVector< llvm::SmallVector< FrameId > > CallSites
Definition: MemProf.h:333
llvm::memprof::RecordWriterTrait::EmitKey
void EmitKey(raw_ostream &Out, key_type_ref K, offset_type)
Definition: MemProf.h:525
llvm::SmallVector< Meta, static_cast< int >(Meta::Size)>
llvm::memprof::PortableMemInfoBlock::getSchema
static MemProfSchema getSchema()
Definition: MemProf.h:102
llvm::memprof::Frame::operator!=
bool operator!=(const Frame &Other) const
Definition: MemProf.h:184
llvm::memprof::FrameWriterTrait::ComputeHash
static hash_value_type ComputeHash(key_type_ref K)
Definition: MemProf.h:550
llvm::memprof::MemProfRecord::AllocSites
llvm::SmallVector< AllocationInfo > AllocSites
Definition: MemProf.h:400
DenseMap.h
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:235
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:226
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::memprof::MemProfRecord::MemProfRecord
MemProfRecord(const IndexedMemProfRecord &Record, llvm::function_ref< const Frame(const FrameId Id)> IdToFrameCallback)
Definition: MemProf.h:405
llvm::memprof::RecordWriterTrait
Definition: MemProf.h:493
llvm::support::endian::Writer
Adapter to write values to a stream in a particular byte order.
Definition: EndianStream.h:52
llvm::memprof::FrameLookupTrait
Definition: MemProf.h:576
llvm::memprof::IndexedAllocationInfo::serializedSize
size_t serializedSize() const
Definition: MemProf.h:266
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::memprof::Frame::printYAML
void printYAML(raw_ostream &OS) const
Definition: MemProf.h:222
llvm::memprof::PortableMemInfoBlock::operator!=
bool operator!=(const PortableMemInfoBlock &Other) const
Definition: MemProf.h:119
llvm::memprof::RecordWriterTrait::ComputeHash
static hash_value_type ComputeHash(key_type_ref K)
Definition: MemProf.h:511
llvm::memprof::AllocationInfo
Definition: MemProf.h:293
GlobalValue.h
llvm::memprof::CallStack
Helper class to iterate through stack ids in both metadata (memprof MIB and callsite) and the corresp...
Definition: MemoryProfileInfo.h:108
llvm::support::little
@ little
Definition: Endian.h:27
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::memprof::RecordLookupTrait
Definition: MemProf.h:448
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::memprof::RecordWriterTrait::EmitData
void EmitData(raw_ostream &Out, key_type_ref, data_type_ref V, offset_type)
Definition: MemProf.h:531
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::memprof::FrameLookupTrait::EqualKey
static bool EqualKey(internal_key_type A, internal_key_type B)
Definition: MemProf.h:584
llvm::AArch64CC::LE
@ LE
Definition: AArch64BaseInfo.h:268
STLFunctionalExtras.h
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:687
llvm::memprof::FrameLookupTrait::ReadData
data_type ReadData(uint64_t K, const unsigned char *D, offset_type)
Definition: MemProf.h:606
llvm::memprof::PortableMemInfoBlock::clear
void clear()
Definition: MemProf.h:99
llvm::memprof::PortableMemInfoBlock::printYAML
void printYAML(raw_ostream &OS) const
Definition: MemProf.h:85
llvm::memprof::Frame::IsInlineFrame
bool IsInlineFrame
Definition: MemProf.h:155
llvm::memprof::readMemProfSchema
Expected< MemProfSchema > readMemProfSchema(const unsigned char *&Buffer)
Definition: MemProf.cpp:84
llvm::memprof::FrameLookupTrait::ReadKeyDataLength
static std::pair< offset_type, offset_type > ReadKeyDataLength(const unsigned char *&D)
Definition: MemProf.h:593
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::memprof::IndexedAllocationInfo::operator!=
bool operator!=(const IndexedAllocationInfo &Other) const
Definition: MemProf.h:286
llvm::memprof::FrameWriterTrait::EmitKeyDataLength
static std::pair< offset_type, offset_type > EmitKeyDataLength(raw_ostream &Out, key_type_ref K, data_type_ref V)
Definition: MemProf.h:553
llvm::memprof::Frame::operator==
bool operator==(const Frame &Other) const
Definition: MemProf.h:168
llvm::memprof::IndexedAllocationInfo::IndexedAllocationInfo
IndexedAllocationInfo(ArrayRef< FrameId > CS, const MemInfoBlock &MB)
Definition: MemProf.h:262
llvm::memprof::RecordLookupTrait::GetExternalKey
static uint64_t GetExternalKey(uint64_t K)
Definition: MemProf.h:461
Seed
static ManagedStatic< cl::opt< uint64_t >, CreateSeed > Seed
Definition: RandomNumberGenerator.cpp:40
llvm::memprof::Meta
Meta
Definition: MemProf.h:19
llvm::memprof::Frame
Definition: MemProf.h:142
uint64_t
llvm::memprof::FrameLookupTrait::ReadKey
uint64_t ReadKey(const unsigned char *D, offset_type)
Definition: MemProf.h:601
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::memprof::RecordLookupTrait::ComputeHash
hash_value_type ComputeHash(uint64_t K)
Definition: MemProf.h:463
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::memprof::Meta::Start
@ Start
llvm::memprof::PortableMemInfoBlock::PortableMemInfoBlock
PortableMemInfoBlock()=default
llvm::memprof::RecordLookupTrait::ReadData
data_type ReadData(uint64_t K, const unsigned char *D, offset_type)
Definition: MemProf.h:479
llvm::memprof::FrameLookupTrait::GetExternalKey
static uint64_t GetExternalKey(external_key_type K)
Definition: MemProf.h:588
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::memprof::RecordLookupTrait::ReadKey
uint64_t ReadKey(const unsigned char *D, offset_type)
Definition: MemProf.h:474
llvm::memprof::FrameWriterTrait::EmitData
void EmitData(raw_ostream &Out, key_type_ref, data_type_ref V, offset_type)
Definition: MemProf.h:569
llvm::memprof::Frame::serialize
void serialize(raw_ostream &OS) const
Definition: MemProf.h:187
Ptr
@ Ptr
Definition: TargetLibraryInfo.cpp:60
llvm::Record
Definition: Record.h:1573
llvm::memprof::RecordLookupTrait::RecordLookupTrait
RecordLookupTrait(const MemProfSchema &S)
Definition: MemProf.h:457
llvm::memprof::Frame::SymbolName
std::optional< std::string > SymbolName
Definition: MemProf.h:148
llvm::memprof::IndexedAllocationInfo::Info
PortableMemInfoBlock Info
Definition: MemProf.h:259
llvm::memprof::AllocationInfo::AllocationInfo
AllocationInfo(const IndexedAllocationInfo &IndexedAI, llvm::function_ref< const Frame(const FrameId)> IdToFrameCallback)
Definition: MemProf.h:300
llvm::memprof::PortableMemInfoBlock::PortableMemInfoBlock
PortableMemInfoBlock(const MemInfoBlock &Block)
Definition: MemProf.h:34
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::memprof::FrameWriterTrait
Definition: MemProf.h:539
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::memprof::IndexedAllocationInfo::operator==
bool operator==(const IndexedAllocationInfo &Other) const
Definition: MemProf.h:272
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::memprof::PortableMemInfoBlock
Definition: MemProf.h:32
llvm::memprof::RecordLookupTrait::EqualKey
static bool EqualKey(uint64_t A, uint64_t B)
Definition: MemProf.h:459
llvm::memprof::IndexedMemProfRecord::merge
void merge(const IndexedMemProfRecord &Other)
Definition: MemProf.h:340
llvm::memprof::Frame::Function
GlobalValue::GUID Function
Definition: MemProf.h:145
MemProfData.inc
llvm::memprof::Frame::Column
uint32_t Column
Definition: MemProf.h:153
llvm::AMDGPU::HSAMD::Kernel::Key::SymbolName
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Definition: AMDGPUMetadata.h:386
llvm::memprof::MemProfRecord
Definition: MemProf.h:398
EndianStream.h
llvm::memprof::IndexedAllocationInfo
Definition: MemProf.h:254
llvm::memprof::MemProfRecord::print
void print(llvm::raw_ostream &OS) const
Definition: MemProf.h:421
llvm::memprof::Frame::operator=
Frame & operator=(const Frame &Other)
Definition: MemProf.h:175
llvm::memprof::Frame::serializedSize
static constexpr size_t serializedSize()
Definition: MemProf.h:216
llvm::memprof::IndexedMemProfRecord::serializedSize
size_t serializedSize() const
Definition: MemProf.h:347
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:614
llvm::memprof::Frame::Frame
Frame(uint64_t Hash, uint32_t Off, uint32_t Col, bool Inline)
Definition: MemProf.h:165
llvm::memprof::Frame::deserialize
static Frame deserialize(const unsigned char *Ptr)
Definition: MemProf.h:204
llvm::memprof::MemProfRecord::CallSites
llvm::SmallVector< llvm::SmallVector< Frame > > CallSites
Definition: MemProf.h:402
llvm::memprof::AllocationInfo::CallStack
llvm::SmallVector< Frame > CallStack
Definition: MemProf.h:295
SmallVector.h
llvm::memprof::PortableMemInfoBlock::operator==
bool operator==(const PortableMemInfoBlock &Other) const
Definition: MemProf.h:110
llvm::memprof::IndexedMemProfRecord::AllocSites
llvm::SmallVector< IndexedAllocationInfo > AllocSites
Definition: MemProf.h:327
llvm::memprof::FrameLookupTrait::GetInternalKey
static uint64_t GetInternalKey(internal_key_type K)
Definition: MemProf.h:587
llvm::memprof::IndexedMemProfRecord::serialize
void serialize(const MemProfSchema &Schema, raw_ostream &OS)
Definition: MemProf.cpp:11
List
const NodeList & List
Definition: RDFGraph.cpp:199
N
#define N
support
Reimplement select in terms of SEL *We would really like to support but we need to prove that the add doesn t need to overflow between the two bit chunks *Implement pre post increment support(e.g. PR935) *Implement smarter const ant generation for binops with large immediates. A few ARMv6T2 ops should be pattern matched
Definition: README.txt:10
MIBEntryDef.inc
llvm::memprof::Meta::Size
@ Size
llvm::memprof::AllocationInfo::printYAML
void printYAML(raw_ostream &OS) const
Definition: MemProf.h:309
llvm::memprof::FrameWriterTrait::EmitKey
void EmitKey(raw_ostream &Out, key_type_ref K, offset_type)
Definition: MemProf.h:563
raw_ostream.h
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:241
llvm::memprof::IndexedMemProfRecord::deserialize
static IndexedMemProfRecord deserialize(const MemProfSchema &Schema, const unsigned char *Buffer)
Definition: MemProf.cpp:35
llvm::memprof::PortableMemInfoBlock::deserialize
void deserialize(const MemProfSchema &Schema, const unsigned char *Ptr)
Definition: MemProf.h:46
llvm::memprof::PortableMemInfoBlock::serialize
void serialize(const MemProfSchema &Schema, raw_ostream &OS) const
Definition: MemProf.h:66
Endian.h
llvm::memprof::PortableMemInfoBlock::PortableMemInfoBlock
PortableMemInfoBlock(const MemProfSchema &Schema, const unsigned char *Ptr)
Definition: MemProf.h:40
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::memprof::FrameId
uint64_t FrameId
Definition: MemProf.h:138
llvm::memprof::RecordLookupTrait::GetInternalKey
static uint64_t GetInternalKey(uint64_t K)
Definition: MemProf.h:460
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1251
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:941