LLVM: include/llvm/ProfileData/InstrProfReader.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_PROFILEDATA_INSTRPROFREADER_H
15#define LLVM_PROFILEDATA_INSTRPROFREADER_H
16
35#include
36#include
37#include
38#include
39#include
40#include
41#include
42#include
43
44namespace llvm {
45
47
48namespace vfs {
50}
51
52
56public:
62
63private:
64 reader_type *Reader = nullptr;
66
67 void increment() {
68 if (Error E = Reader->readNextRecord(Record)) {
69
72 }
73 }
74
75public:
78
80 increment();
81 return *this;
82 }
84 return Reader == RHS.Reader;
85 }
87 return Reader != RHS.Reader;
88 }
91};
92
93
94
97 std::string LastErrorMsg;
98
99public:
102
103
105
106
108
109
113
114
116
117
120
121
123
125
127
129
130
132
133
135
136
138
139
141
142
144
145
146
148
149
150
151
152
153
154
155
156
157
158
160
161
163
164protected:
166
168
170
171
173 LastError = Err;
174 LastErrorMsg = ErrMsg;
178 }
179
182 LastError = IPE.get();
184 });
186 }
187
188
190
191public:
192
194
195
197
198
204
205
206
213 std::function<void(Error)> Warn = nullptr);
214
216 std::unique_ptr Buffer,
221 std::function<void(Error)> Warn = nullptr);
222
223
224
225
232
236};
237
238
239
240
241
242
243
244
245
247private:
248
249 std::unique_ptr DataBuffer;
250
252
254
256
257 Error readTemporalProfTraceData();
258
259public:
261 : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, true, '#') {}
264
265
267
268
270
274
278
280 return static_cast<bool>(ProfileKind &
282 }
283
285 return static_cast<bool>(ProfileKind &
287 }
288
292
296
298
299 return false;
300 }
301
305
307
308
309 Error readHeader() override;
310
311
313
318};
319
320
321
322
323
324
325
326
327template
329private:
330
331 std::unique_ptr DataBuffer;
332
333
335
337
338
339 std::unique_ptr BIDFetcherCorrelator;
340
341
343
344 std::vector<std::pair<uint64_t, uint64_t>> TemporalProfTimestamps;
345 bool ShouldSwapBytes;
346
347
348
357 const char *CountersStart;
358 const char *CountersEnd;
359 const char *BitmapStart;
360 const char *BitmapEnd;
361 const char *NamesStart;
362 const char *NamesEnd;
363 const char *VNamesStart = nullptr;
364 const char *VNamesEnd = nullptr;
365
366
367 const uint8_t *ValueDataStart;
370 std::vectorllvm::object::BuildID BinaryIds;
371
372 std::function<void(Error)> Warn;
373
374
375 static const uint64_t MaxCounterValue = (1ULL << 56);
376
377public:
379 std::unique_ptr DataBuffer,
383 std::function<void(Error)> Warn)
384 : DataBuffer(std::move(DataBuffer)),
386 Correlator)),
387 BIDFetcher(BIDFetcher),
388 BIDFetcherCorrelatorKind(BIDFetcherCorrelatorKind), Warn(Warn) {}
389
392
398
400
404
408
412
416
420
424
426
428 return false;
429 }
430
434
435
437
440 return *Symtab.get();
441 }
442
445
446private:
448 Error readNextHeader(const char *CurrentPos);
450
451 template IntT swap(IntT Int) const {
453 }
454
456 if (!ShouldSwapBytes)
460 else
462 }
463
464 inline uint8_t getNumPaddingBytes(uint64_t SizeInBytes) {
465 return 7 & (sizeof(uint64_t) - SizeInBytes % sizeof(uint64_t));
466 }
467
468 Error readName(NamedInstrProfRecord &Record);
469 Error readFuncHash(NamedInstrProfRecord &Record);
470 Error readRawCounts(InstrProfRecord &Record);
471 Error readRawBitmapBytes(InstrProfRecord &Record);
472 Error readValueProfilingData(InstrProfRecord &Record);
473 bool atEnd() const { return Data == DataEnd; }
474
475 void advanceData() {
476
477 if (!Correlator && !BIDFetcherCorrelator) {
478
479
480
481
482
483 CountersDelta -= sizeof(*Data);
484 BitmapDelta -= sizeof(*Data);
485 }
486 Data++;
487 ValueDataStart += CurValueDataSize;
488 }
489
490 const char *getNextHeaderPos() const {
492 return (const char *)ValueDataStart;
493 }
494
495 StringRef getName(uint64_t NameRef) const {
496 return Symtab->getFuncOrVarName(swap(NameRef));
497 }
498
499 int getCounterTypeSize() const {
501 }
502};
503
506
508
510
511}
512
513
514
516 std::vector DataBuffer;
518 unsigned FormatVersion;
519
520
521
523
524public:
526 : HashType(HashType), FormatVersion(FormatVersion) {}
527
529
534
538
540
541 static std::pair<offset_type, offset_type>
544
549 return std::make_pair(KeyLen, DataLen);
550 }
551
555
557 const unsigned char *const End);
560
561
563 ValueProfDataEndianness = Endianness;
564 }
565};
566
569
570
571
573
574
578 virtual bool atEnd() const = 0;
591};
592
595
602
603template
605
606template
608private:
609 std::unique_ptr HashTable;
610 typename HashTableImpl::data_iterator RecordIterator;
612
614
615public:
617 const unsigned char *const Payload,
618 const unsigned char *const Base,
621
626
627 bool atEnd() const override {
628 return RecordIterator == HashTable->data_end();
629 }
630
632 HashTable->getInfoObj().setValueProfDataEndianness(Endianness);
633 }
634
636
640
644
648
652
656
660
664
668
670
672
673
674
675
676
677
678 return Symtab.create(HashTable->keys());
679 }
680};
681
682
690
692private:
693
696
697 std::unique_ptrmemprof::MemProfSummary MemProfSum;
698
700
701 std::unique_ptr MemProfRecordTable;
702
703 std::unique_ptr MemProfFrameTable;
704
705 std::unique_ptr MemProfCallStackTable;
706
707 const unsigned char *FrameBase = nullptr;
708
709 const unsigned char *CallStackBase = nullptr;
710
711 unsigned RadixTreeSize = 0;
712
713 std::unique_ptrmemprof::DataAccessProfData DataAccessProfileData;
714
715 Error deserializeV2(const unsigned char *Start, const unsigned char *Ptr);
716 Error deserializeRadixTreeBased(const unsigned char *Start,
717 const unsigned char *Ptr,
719
720public:
722
725
728
731
732
734 return DataAccessProfileData.get();
735 }
736
737
739
741};
742
743
745private:
746
747 std::unique_ptr DataBuffer;
748
749 std::unique_ptr RemappingBuffer;
750
751 std::unique_ptr Index;
752
753 std::unique_ptr Remapper;
754
755 std::unique_ptr Summary;
756
757 std::unique_ptr CS_Summary;
759
760
761
763
765
766
767 unsigned RecordIndex = 0;
768
769
770
771
773 const unsigned char *Cur, bool UseCS);
774
775public:
777 std::unique_ptr DataBuffer,
778 std::unique_ptr RemappingBuffer = nullptr)
779 : DataBuffer(std::move(DataBuffer)),
780 RemappingBuffer(std::move(RemappingBuffer)) {}
783
784
786 bool isIRLevelProfile() const override { return Index->isIRLevelProfile(); }
788 return Index->hasCSIRLevelProfile();
789 }
790
792 return Index->instrEntryBBEnabled();
793 }
794
796 return Index->instrLoopEntriesEnabled();
797 }
798
800 return Index->hasSingleByteCoverage();
801 }
802
803 bool functionEntryOnly() const override { return Index->functionEntryOnly(); }
804
805 bool hasMemoryProfile() const override { return Index->hasMemoryProfile(); }
806
808 return Index->hasTemporalProfile();
809 }
810
811
812
814 return Index->getProfileKind();
815 }
816
817
818 static bool hasFormat(const MemoryBuffer &DataBuffer);
819
820
821 Error readHeader() override;
822
824
825
826
827
828
829
830
831
834 StringRef DeprecatedFuncName = "",
835 uint64_t *MismatchedFuncSum = nullptr);
836
837
838
840 return MemProfReader.getMemProfRecord(FuncNameHash);
841 }
842
845 return MemProfReader.getMemProfCallerCalleePairs();
846 }
847
849 return MemProfReader.getAllMemProfData();
850 }
851
852
854 std::vector<uint64_t> &Counts);
855
856
859
860
861
863 if (UseCS) {
864 assert(CS_Summary && "No context sensitive profile summary");
865 return CS_Summary->getMaxFunctionCount();
866 } else {
867 assert(Summary && "No profile summary");
868 return Summary->getMaxFunctionCount();
869 }
870 }
871
872
875 const Twine &RemappingPath = "");
876
878 create(std::unique_ptr Buffer,
879 std::unique_ptr RemappingBuffer = nullptr);
880
881
883 Index->setValueProfDataEndianness(Endianness);
884 }
885
886
887
888
890
891
892
894 if (UseCS) {
895 assert(CS_Summary && "No context sensitive summary");
896 return *CS_Summary;
897 } else {
898 assert(Summary && "No profile summary");
899 return *Summary;
900 }
901 }
902
903
905 return MemProfReader.getSummary();
906 }
907
908
909
911 return MemProfReader.getDataAccessProfileData();
912 }
913
914 Error readBinaryIds(std::vectorllvm::object::BuildID &BinaryIds) override;
916};
917
918}
919
920#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a library for handling Build IDs and using them to find debug info.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
InstrProfLookupTrait::offset_type offset_type
InstrProfLookupTrait::data_type data_type
#define VARIANT_MASK_CSIR_PROF
#define VARIANT_MASK_MEMPROF
#define VARIANT_MASK_TEMPORAL_PROF
#define VARIANT_MASK_IR_PROF
#define VARIANT_MASK_BYTE_COVERAGE
#define VARIANT_MASK_INSTR_ENTRY
#define VARIANT_MASK_FUNCTION_ENTRY_ONLY
#define VARIANT_MASK_INSTR_LOOP_ENTRIES
Defines facilities for reading and writing on-disk hash tables.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
uint64_t getVersion() const override
Return the profile version.
Definition InstrProfReader.h:785
IndexedInstrProfReader(const IndexedInstrProfReader &)=delete
bool hasTemporalProfile() const override
Return true if this has a temporal profile.
Definition InstrProfReader.h:807
Expected< memprof::MemProfRecord > getMemProfRecord(uint64_t FuncNameHash)
Return the memprof record for the function identified by llvm::md5(Name).
Definition InstrProfReader.h:839
bool hasSingleByteCoverage() const override
Return true if the profile has single byte counters representing coverage.
Definition InstrProfReader.h:799
bool instrLoopEntriesEnabled() const override
Return true if the profile instruments all loop entries.
Definition InstrProfReader.h:795
memprof::MemProfSummary * getMemProfSummary() const
Return the MemProf summary. Will be null if unavailable (version < 4).
Definition InstrProfReader.h:904
ProfileSummary & getSummary(bool UseCS)
Return the profile summary.
Definition InstrProfReader.h:893
bool hasMemoryProfile() const override
Return true if profile includes a memory profile.
Definition InstrProfReader.h:805
bool functionEntryOnly() const override
Return true if the profile only instruments function entries.
Definition InstrProfReader.h:803
uint64_t getMaximumFunctionCount(bool UseCS)
Return the maximum of all known function counts.
Definition InstrProfReader.h:862
DenseMap< uint64_t, SmallVector< memprof::CallEdgeTy, 0 > > getMemProfCallerCalleePairs()
Definition InstrProfReader.h:844
InstrProfKind getProfileKind() const override
Returns a BitsetEnum describing the attributes of the indexed instr profile.
Definition InstrProfReader.h:813
void setValueProfDataEndianness(llvm::endianness Endianness)
Definition InstrProfReader.h:882
memprof::DataAccessProfData * getDataAccessProfileData() const
Returns non-owned pointer to the data access profile data.
Definition InstrProfReader.h:910
memprof::AllMemProfData getAllMemProfData() const
Definition InstrProfReader.h:848
IndexedInstrProfReader(std::unique_ptr< MemoryBuffer > DataBuffer, std::unique_ptr< MemoryBuffer > RemappingBuffer=nullptr)
Definition InstrProfReader.h:776
bool hasCSIRLevelProfile() const override
Definition InstrProfReader.h:787
IndexedInstrProfReader & operator=(const IndexedInstrProfReader &)=delete
bool instrEntryBBEnabled() const override
Definition InstrProfReader.h:791
bool isIRLevelProfile() const override
Definition InstrProfReader.h:786
Definition InstrProfReader.h:691
LLVM_ABI Error deserialize(const unsigned char *Start, uint64_t MemProfOffset)
IndexedMemProfReader()=default
memprof::MemProfSummary * getSummary() const
Definition InstrProfReader.h:740
LLVM_ABI memprof::DataAccessProfData * getDataAccessProfileData() const
Definition InstrProfReader.h:733
LLVM_ABI memprof::AllMemProfData getAllMemProfData() const
LLVM_ABI Expected< memprof::MemProfRecord > getMemProfRecord(const uint64_t FuncNameHash) const
LLVM_ABI DenseMap< uint64_t, SmallVector< memprof::CallEdgeTy, 0 > > getMemProfCallerCalleePairs() const
InstrProfCorrelatorImpl - A child of InstrProfCorrelator with a template pointer type so that the Pro...
InstrProfCorrelator - A base class used to create raw instrumentation data to their functions.
ProfCorrelatorKind
Indicate if we should use the debug info or profile metadata sections to correlate.
static std::pair< instrprof_error, std::string > take(Error E)
Consume an Error and return the raw enum value contained within it, and the optional error message.
const std::string & getMessage() const
instrprof_error get() const
A file format agnostic iterator over profiling data.
Definition InstrProfReader.h:55
bool operator==(const InstrProfIterator &RHS) const
Definition InstrProfReader.h:83
value_type & operator*()
Definition InstrProfReader.h:89
value_type & reference
Definition InstrProfReader.h:61
InstrProfIterator(reader_type *Reader)
Definition InstrProfReader.h:77
InstrProfIterator & operator++()
Definition InstrProfReader.h:79
bool operator!=(const InstrProfIterator &RHS) const
Definition InstrProfReader.h:86
value_type * operator->()
Definition InstrProfReader.h:90
std::ptrdiff_t difference_type
Definition InstrProfReader.h:59
value_type * pointer
Definition InstrProfReader.h:60
std::input_iterator_tag iterator_category
Definition InstrProfReader.h:57
record_type value_type
Definition InstrProfReader.h:58
InstrProfIterator()=default
InstrProfLookupTrait(IndexedInstrProf::HashT HashType, unsigned FormatVersion)
Definition InstrProfReader.h:525
StringRef internal_key_type
Definition InstrProfReader.h:530
uint64_t hash_value_type
Definition InstrProfReader.h:532
uint64_t offset_type
Definition InstrProfReader.h:533
void setValueProfDataEndianness(llvm::endianness Endianness)
Definition InstrProfReader.h:562
StringRef ReadKey(const unsigned char *D, offset_type N)
Definition InstrProfReader.h:552
static std::pair< offset_type, offset_type > ReadKeyDataLength(const unsigned char *&D)
Definition InstrProfReader.h:542
static StringRef GetExternalKey(StringRef K)
Definition InstrProfReader.h:537
LLVM_ABI data_type ReadData(StringRef K, const unsigned char *D, offset_type N)
LLVM_ABI bool readValueProfilingData(const unsigned char *&D, const unsigned char *const End)
LLVM_ABI hash_value_type ComputeHash(StringRef K)
static bool EqualKey(StringRef A, StringRef B)
Definition InstrProfReader.h:535
static StringRef GetInternalKey(StringRef K)
Definition InstrProfReader.h:536
ArrayRef< NamedInstrProfRecord > data_type
Definition InstrProfReader.h:528
StringRef external_key_type
Definition InstrProfReader.h:531
Error populateSymtab(InstrProfSymtab &Symtab) override
Definition InstrProfReader.h:671
bool hasSingleByteCoverage() const override
Definition InstrProfReader.h:653
void advanceToNextKey() override
Definition InstrProfReader.h:625
bool hasCSIRLevelProfile() const override
Definition InstrProfReader.h:641
void setValueProfDataEndianness(llvm::endianness Endianness) override
Definition InstrProfReader.h:631
InstrProfKind getProfileKind() const override
Error getRecords(ArrayRef< NamedInstrProfRecord > &Data) override
bool functionEntryOnly() const override
Definition InstrProfReader.h:657
~InstrProfReaderIndex() override=default
bool instrLoopEntriesEnabled() const override
Definition InstrProfReader.h:649
uint64_t getVersion() const override
Definition InstrProfReader.h:635
bool isIRLevelProfile() const override
Definition InstrProfReader.h:637
bool hasMemoryProfile() const override
Definition InstrProfReader.h:661
bool hasTemporalProfile() const override
Definition InstrProfReader.h:665
bool instrEntryBBEnabled() const override
Definition InstrProfReader.h:645
InstrProfReaderIndex(const unsigned char *Buckets, const unsigned char *const Payload, const unsigned char *const Base, IndexedInstrProf::HashT HashType, uint64_t Version)
bool atEnd() const override
Definition InstrProfReader.h:627
A remapper that applies remappings based on a symbol remapping file.
Name matcher supporting fuzzy matching of symbol names to names in profiles.
Definition InstrProfReader.h:683
virtual Error getRecords(StringRef FuncName, ArrayRef< NamedInstrProfRecord > &Data)=0
virtual ~InstrProfReaderRemapper()=default
virtual Error populateRemappings()
Definition InstrProfReader.h:686
Base class and interface for reading profiling data of any known instrprof format.
Definition InstrProfReader.h:95
InstrProfIterator begin()
Iterator over profile data.
Definition InstrProfReader.h:118
virtual bool instrEntryBBEnabled() const =0
virtual Error readNextRecord(NamedInstrProfRecord &Record)=0
Read a single record.
Error error(Error &&E)
Definition InstrProfReader.h:180
InstrProfIterator end()
Definition InstrProfReader.h:119
virtual Error readBinaryIds(std::vector< llvm::object::BuildID > &BinaryIds)
Read a list of binary ids.
Definition InstrProfReader.h:110
virtual bool functionEntryOnly() const =0
Return true if the profile only instruments function entries.
std::unique_ptr< InstrProfSymtab > Symtab
Definition InstrProfReader.h:165
Error getError()
Get the current error.
Definition InstrProfReader.h:199
virtual InstrProfSymtab & getSymtab()=0
Return the PGO symtab.
InstrProfReader()=default
virtual bool hasSingleByteCoverage() const =0
Return true if the profile has single byte counters representing coverage.
virtual bool hasTemporalProfile() const =0
Return true if this has a temporal profile.
Error success()
Clear the current error and return a successful one.
Definition InstrProfReader.h:189
bool hasError()
Return true if the reader encountered an error reading profiling data.
Definition InstrProfReader.h:196
virtual InstrProfKind getProfileKind() const =0
Returns a BitsetEnum describing the attributes of the profile.
SmallVector< TemporalProfTraceTy > TemporalProfTraces
A list of temporal profile traces.
Definition InstrProfReader.h:167
uint64_t TemporalProfTraceStreamSize
The total number of temporal profile traces seen.
Definition InstrProfReader.h:169
virtual Error printBinaryIds(raw_ostream &OS)
Print binary ids.
Definition InstrProfReader.h:115
uint64_t getTemporalProfTraceStreamSize()
Definition InstrProfReader.h:233
virtual uint64_t getVersion() const =0
Return the profile version.
virtual bool hasMemoryProfile() const =0
Return true if profile includes a memory profile.
virtual bool instrLoopEntriesEnabled() const =0
Return true if the profile instruments all loop entries.
virtual SmallVector< TemporalProfTraceTy > & getTemporalProfTraces(std::optional< uint64_t > Weight={})
Definition InstrProfReader.h:227
virtual bool hasCSIRLevelProfile() const =0
virtual bool isIRLevelProfile() const =0
virtual ~InstrProfReader()=default
virtual Error readHeader()=0
Read the header. Required before reading first record.
Error error(instrprof_error Err, const std::string &ErrMsg="")
Set the current error and return same.
Definition InstrProfReader.h:172
LLVM_ABI void accumulateCounts(CountSumOrPercent &Sum, bool IsCS)
Compute the sum of counts and return in Sum.
static LLVM_ABI Expected< std::unique_ptr< InstrProfReader > > create(const Twine &Path, vfs::FileSystem &FS, const InstrProfCorrelator *Correlator=nullptr, const object::BuildIDFetcher *BIDFetcher=nullptr, const InstrProfCorrelator::ProfCorrelatorKind BIDFetcherCorrelatorKind=InstrProfCorrelator::ProfCorrelatorKind::NONE, std::function< void(Error)> Warn=nullptr)
Factory method to create an appropriately typed reader for the given instrprof file.
bool isEOF()
Return true if the reader has finished reading the profile data.
Definition InstrProfReader.h:193
A symbol table used for function [IR]PGO name look-up with keys (such as pointers,...
LLVM_ABI Error create(object::SectionRef &Section)
Create InstrProfSymtab from an object file section which contains function PGO names.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Provides lookup and iteration over an on disk hash table.
Reader for the raw instrprof binary format from runtime.
Definition InstrProfReader.h:328
bool functionEntryOnly() const override
Return true if the profile only instruments function entries.
Definition InstrProfReader.h:421
RawInstrProfReader(std::unique_ptr< MemoryBuffer > DataBuffer, const InstrProfCorrelator *Correlator, const object::BuildIDFetcher *BIDFetcher, const InstrProfCorrelator::ProfCorrelatorKind BIDFetcherCorrelatorKind, std::function< void(Error)> Warn)
Definition InstrProfReader.h:378
Error readHeader() override
Read the header. Required before reading first record.
Error readNextRecord(NamedInstrProfRecord &Record) override
Read a single record.
Error printBinaryIds(raw_ostream &OS) override
Print binary ids.
static bool hasFormat(const MemoryBuffer &DataBuffer)
RawInstrProfReader & operator=(const RawInstrProfReader &)=delete
bool hasSingleByteCoverage() const override
Return true if the profile has single byte counters representing coverage.
Definition InstrProfReader.h:417
bool isIRLevelProfile() const override
Definition InstrProfReader.h:401
InstrProfKind getProfileKind() const override
Returns a BitsetEnum describing the attributes of the raw instr profile.
bool hasMemoryProfile() const override
Return true if profile includes a memory profile.
Definition InstrProfReader.h:425
bool instrLoopEntriesEnabled() const override
Return true if the profile instruments all loop entries.
Definition InstrProfReader.h:413
InstrProfSymtab & getSymtab() override
Return the PGO symtab.
Definition InstrProfReader.h:438
Error readBinaryIds(std::vector< llvm::object::BuildID > &BinaryIds) override
Read a list of binary ids.
bool hasTemporalProfile() const override
Return true if this has a temporal profile.
Definition InstrProfReader.h:431
bool instrEntryBBEnabled() const override
Definition InstrProfReader.h:409
uint64_t getVersion() const override
Return the profile version.
Definition InstrProfReader.h:399
SmallVector< TemporalProfTraceTy > & getTemporalProfTraces(std::optional< uint64_t > Weight={}) override
RawInstrProfReader(const RawInstrProfReader &)=delete
bool hasCSIRLevelProfile() const override
Definition InstrProfReader.h:405
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.
bool isIRLevelProfile() const override
Definition InstrProfReader.h:271
uint64_t getVersion() const override
Return the profile version.
Definition InstrProfReader.h:269
static bool hasFormat(const MemoryBuffer &Buffer)
Return true if the given buffer is in text instrprof format.
TextInstrProfReader(std::unique_ptr< MemoryBuffer > DataBuffer_)
Definition InstrProfReader.h:260
bool hasSingleByteCoverage() const override
Return true if the profile has single byte counters representing coverage.
Definition InstrProfReader.h:289
TextInstrProfReader(const TextInstrProfReader &)=delete
bool hasMemoryProfile() const override
Return true if profile includes a memory profile.
Definition InstrProfReader.h:297
bool hasCSIRLevelProfile() const override
Definition InstrProfReader.h:275
InstrProfSymtab & getSymtab() override
Return the PGO symtab.
Definition InstrProfReader.h:314
bool instrEntryBBEnabled() const override
Definition InstrProfReader.h:279
bool functionEntryOnly() const override
Return true if the profile only instruments function entries.
Definition InstrProfReader.h:293
InstrProfKind getProfileKind() const override
Returns a BitsetEnum describing the attributes of the profile.
Definition InstrProfReader.h:306
bool hasTemporalProfile() const override
Return true if this has a temporal profile.
Definition InstrProfReader.h:302
TextInstrProfReader & operator=(const TextInstrProfReader &)=delete
bool instrLoopEntriesEnabled() const override
Return true if the profile instruments all loop entries.
Definition InstrProfReader.h:284
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A forward iterator which reads text lines from a buffer.
Encapsulates the data access profile data and the methods to operate on it.
BuildIDFetcher searches local cache directories for debug info.
This class implements an extremely fast bulk output stream that can only output to a stream.
The virtual file system interface.
llvm::SmallVector< Meta, static_cast< int >(Meta::Size)> MemProfSchema
constexpr uint64_t MinimumSupportedVersion
value_type readNext(const CharT *&memory, endianness endian)
Read a value of a particular endianness from a buffer, and increment the buffer past that value.
This is an optimization pass for GlobalISel generic memory operations.
RawInstrProfReader< uint64_t > RawInstrProfReader64
Definition InstrProfReader.h:505
OnDiskIterableChainedHashTable< InstrProfLookupTrait > OnDiskHashTableImplV3
Definition InstrProfReader.h:593
OnDiskIterableChainedHashTable< memprof::RecordLookupTrait > MemProfRecordHashTable
Definition InstrProfReader.h:596
constexpr T byteswap(T V) noexcept
Reverses the bytes in the given integer value V.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
auto dyn_cast_or_null(const Y &Val)
FunctionAddr VTableAddr uintptr_t uintptr_t Version
OnDiskIterableChainedHashTable< memprof::CallStackLookupTrait > MemProfCallStackHashTable
Definition InstrProfReader.h:600
OnDiskIterableChainedHashTable< memprof::FrameLookupTrait > MemProfFrameHashTable
Definition InstrProfReader.h:598
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
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.
InstrProfKind
An enum describing the attributes of an instrumented profile.
@ LoopEntriesInstrumentation
@ FunctionEntryInstrumentation
RawInstrProfReader< uint32_t > RawInstrProfReader32
Definition InstrProfReader.h:504
Implement std::hash so that hash_code can be used in STL containers.
Definition InstrProfReader.h:567
virtual Error populateSymtab(InstrProfSymtab &)=0
virtual Error getRecords(ArrayRef< NamedInstrProfRecord > &Data)=0
virtual ~InstrProfReaderIndexBase()=default
virtual bool instrLoopEntriesEnabled() const =0
virtual InstrProfKind getProfileKind() const =0
virtual bool hasTemporalProfile() const =0
virtual bool isIRLevelProfile() const =0
virtual void advanceToNextKey()=0
virtual bool hasMemoryProfile() const =0
virtual bool hasCSIRLevelProfile() const =0
virtual uint64_t getVersion() const =0
virtual bool atEnd() const =0
virtual bool instrEntryBBEnabled() const =0
virtual Error getRecords(StringRef FuncName, ArrayRef< NamedInstrProfRecord > &Data)=0
virtual void setValueProfDataEndianness(llvm::endianness Endianness)=0
virtual bool functionEntryOnly() const =0
virtual bool hasSingleByteCoverage() const =0
Profiling information for a single function.