X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FProfileData%2FSampleProfReader.h;h=e9ceae5d83513d252d6ac90fbff46ca04608e441;hp=e52ecf8e2123dace529fa924ca3233e2882bf28e;hb=9657de5f228505bc17c68ce15e0c9215456a71fa;hpb=e542d91ee58918e0933a4a1f74cfa19ffcce500f diff --git a/include/llvm/ProfileData/SampleProfReader.h b/include/llvm/ProfileData/SampleProfReader.h index e52ecf8e212..e9ceae5d835 100644 --- a/include/llvm/ProfileData/SampleProfReader.h +++ b/include/llvm/ProfileData/SampleProfReader.h @@ -21,6 +21,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/ProfileData/SampleProf.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/MemoryBuffer.h" @@ -64,9 +65,6 @@ public: virtual ~SampleProfileReader() {} - /// \brief Print all the profiles to dbgs(). - void dump(); - /// \brief Read and validate the file header. virtual std::error_code readHeader() = 0; @@ -74,16 +72,19 @@ public: virtual std::error_code read() = 0; /// \brief Print the profile for \p FName on stream \p OS. - void printFunctionProfile(raw_ostream &OS, StringRef FName); + void dumpFunctionProfile(StringRef FName, raw_ostream &OS = dbgs()); - /// \brief Print the profile for \p FName on dbgs(). - void dumpFunctionProfile(StringRef FName); + /// \brief Print all the profiles on stream \p OS. + void dump(raw_ostream &OS = dbgs()); /// \brief Return the samples collected for function \p F. FunctionSamples *getSamplesFor(const Function &F) { return &Profiles[F.getName()]; } + /// \brief Return all the profiles. + StringMap &getProfiles() { return Profiles; } + /// \brief Report a parse error message. void reportParseError(int64_t LineNumber, Twine Msg) const { Ctx.diagnose(DiagnosticInfoSampleProfile(Buffer->getBufferIdentifier(), @@ -91,7 +92,7 @@ public: } /// \brief Create a sample profile reader appropriate to the file format. - static std::error_code create(std::string Filename, + static std::error_code create(StringRef Filename, std::unique_ptr &Reader, LLVMContext &C);