208 #ifndef LLVM_PROFILEDATA_SAMPLEPROFREADER_H
209 #define LLVM_PROFILEDATA_SAMPLEPROFREADER_H
228 namespace sampleprof {
268 virtual std::error_code
read() = 0;
331 std::error_code
read()
override;
346 std::error_code
read()
override;
387 std::error_code readSummaryEntry(std::vector<ProfileSummaryEntry> &Entries);
390 std::error_code readSummary();
417 std::error_code
read()
override;
449 #endif // LLVM_PROFILEDATA_SAMPLEPROFREADER_H
std::vector< std::string > Names
Function names in this profile.
std::unique_ptr< MemoryBuffer > Buffer
Memory buffer holding the profile file.
Represents either an error or a value T.
std::error_code read() override
Read sample profiles from the associated file.
const uint8_t * Data
Points to the current location in the buffer.
virtual ~SampleProfileReader()
std::error_code readHeader() override
Read and validate the file header.
static ErrorOr< std::unique_ptr< SampleProfileReader > > create(const Twine &Filename, LLVMContext &C)
Create a sample profile reader appropriate to the file format.
std::error_code read() override
Read sample profiles from the associated file.
std::error_code readProfile(FunctionSamples &FProfile)
Read the contents of the given profile instance.
GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific read operations.
static bool hasFormat(const MemoryBuffer &Buffer)
Return true if Buffer is in the format supported by this class.
StringRef getName() const
Return a constant reference to the value's name.
Representation of the samples collected for a function.
virtual std::error_code read()=0
Read sample profiles from the associated file.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
StringMap< FunctionSamples > Profiles
Map every function to its associated profile.
Tagged union holding either a T or a Error.
ErrorOr< T > readNumber()
std::error_code readNameTable()
SampleProfileReaderGCC(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
static bool hasFormat(const MemoryBuffer &Buffer)
Return true if Buffer is in the format supported by this class.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
std::error_code readFunctionProfiles()
SampleProfileReader(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
std::error_code readOneFunctionProfile(const InlineCallStack &InlineStack, bool Update, uint32_t Offset)
SmallVector< FunctionSamples *, 10 > InlineCallStack
void reportError(int64_t LineNumber, Twine Msg) const
Report a parse error message.
This is an important class for using LLVM in a threaded context.
FunctionSamples * getSamplesFor(const Function &F)
Return the samples collected for function F.
ErrorOr< T > readNumber()
Read a numeric value of type T from the profile.
LLVMContext & Ctx
LLVM context used to emit diagnostics.
ErrorOr< StringRef > readString()
Read a string from the profile.
void dumpFunctionProfile(StringRef FName, raw_ostream &OS=dbgs())
Print the profile for FName on stream OS.
bool at_eof() const
Return true if we've reached the end of file.
virtual std::error_code readHeader()=0
Read and validate the file header.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
std::vector< StringRef > NameTable
Function name table.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
This interface provides simple read-only access to a block of memory, and provides simple methods for...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
static const uint32_t GCOVTagAFDOFileNames
GCOV tags used to separate sections in the profile file.
StringMap< FunctionSamples > & getProfiles()
Return all the profiles.
static bool hasFormat(const MemoryBuffer &Buffer)
Return true if Buffer is in the format supported by this class.
SampleProfileReaderBinary(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
ErrorOr< StringRef > readString()
const uint8_t * End
Points to the end of the buffer.
std::error_code readHeader() override
Read and validate the file header.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static const uint32_t GCOVTagAFDOFunction
Provides ErrorOr<T> smart pointer.
std::error_code readSectionTag(uint32_t Expected)
Read the section tag and check that it's the same as Expected.
SampleProfileReaderText(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
Sample-based profile reader.
This class implements an extremely fast bulk output stream that can only output to a stream...
ErrorOr< StringRef > readStringFromTable()
Read a string indirectly via the name table.
StringRef - Represent a constant reference to a string, i.e.
GCOVBuffer GcovBuffer
GCOV buffer containing the profile.
Diagnostic information for the sample profiler.
std::error_code readHeader() override
Read and validate the file header.
void computeSummary()
Compute summary for this profile.
void dump(raw_ostream &OS=dbgs())
Print all the profiles on stream OS.
std::error_code read() override
Read sample profiles from the associated file.
ProfileSummary & getSummary()
Return the profile summary.
std::error_code skipNextWord()
std::unique_ptr< ProfileSummary > Summary
Profile summary information.