13 #ifndef LLVM_PROFILEDATA_SAMPLEPROFWRITER_H
14 #define LLVM_PROFILEDATA_SAMPLEPROFWRITER_H
26 namespace sampleprof {
35 :
OS(Filename, EC, Flags) {}
52 for (
const auto &
F : M) {
54 if (!
write(Name, P[Name]))
64 for (
auto &
I : ProfileMap) {
67 if (!
write(FName, Profile))
110 #endif // LLVM_PROFILEDATA_SAMPLEPROFWRITER_H
raw_fd_ostream OS
Output stream where to emit the profile to.
Represents either an error or a value T.
Sample-based profile writer. Base class.
A Module instance is used to store all the information related to an LLVM module. ...
SampleProfileWriter(StringRef Filename, std::error_code &EC, sys::fs::OpenFlags Flags)
StringRef getName() const
Return a constant reference to the value's name.
Representation of the samples collected for a function.
bool write(StringRef FName, const FunctionSamples &S) override
Write samples to a text file.
bool write(const Module &M, StringMap< FunctionSamples > &P)
bool write(const Function &F, const FunctionSamples &S)
Write sample profiles in S for function F.
virtual ~SampleProfileWriter()
Sample-based profile writer (binary format).
Module.h This file contains the declarations for the Module class.
static ErrorOr< std::unique_ptr< SampleProfileWriter > > create(StringRef Filename, SampleProfileFormat Format)
Profile writer factory.
bool write(const Module &M, StringMap< FunctionSamples > &P)
Write all the sample profiles for all the functions in M.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
The file should be opened in text mode on platforms that make this distinction.
A raw_ostream that writes to a file descriptor.
virtual bool write(StringRef FName, const FunctionSamples &S)=0
Write sample profiles in S for function FName.
SampleProfileWriterText(StringRef F, std::error_code &EC)
bool write(StringRef F, const FunctionSamples &S) override
Write samples to a binary file.
Provides ErrorOr<T> smart pointer.
bool write(StringMap< FunctionSamples > &ProfileMap)
Write all the sample profiles in the given map of samples.
bool write(const Module &M, StringMap< FunctionSamples > &P)
StringRef - Represent a constant reference to a string, i.e.
Sample-based profile writer (text format).
SampleProfileWriterBinary(StringRef F, std::error_code &EC)