13 #ifndef LLVM_PROFILEDATA_SAMPLEPROFREADER_H
14 #define LLVM_PROFILEDATA_SAMPLEPROFREADER_H
32 namespace sampleprof {
72 virtual std::error_code
read() = 0;
122 std::error_code
read()
override;
134 std::error_code
read()
override;
170 #endif // LLVM_PROFILEDATA_SAMPLEPROFREADER_H
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.
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.
static bool hasFormat(const MemoryBuffer &Buffer)
Return true if Buffer is in the format supported by this class.
SampleProfileReader(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
static ErrorOr< std::unique_ptr< SampleProfileReader > > create(StringRef Filename, LLVMContext &C)
Create a sample profile reader appropriate to the file format.
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 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"...
StringMap< FunctionSamples > & getProfiles()
Return all the profiles.
SampleProfileReaderBinary(std::unique_ptr< MemoryBuffer > B, LLVMContext &C)
const uint8_t * End
Points to the end of the buffer.
std::error_code readHeader() override
Read and validate the file header.
void reportParseError(int64_t LineNumber, Twine Msg) const
Report a parse error message.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Provides ErrorOr<T> smart pointer.
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...
StringRef - Represent a constant reference to a string, i.e.
Diagnostic information for the sample profiler.
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.