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