From c5f76f73474499012b9559e917ec2368b659618a Mon Sep 17 00:00:00 2001 From: Dehao Chen Date: Mon, 22 Feb 2016 22:14:14 +0000 Subject: Add prefix based function layout when profile is available. Summary: If a function is hot, put it in text.hot section. Reviewers: davidxl Subscribers: eraman, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D17460 llvm-svn: 261582 --- llvm/include/llvm/ProfileData/ProfileCommon.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/include') diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h index e7d69431542..76631146dda 100644 --- a/llvm/include/llvm/ProfileData/ProfileCommon.h +++ b/llvm/include/llvm/ProfileData/ProfileCommon.h @@ -21,6 +21,8 @@ #define LLVM_PROFILEDATA_PROFILE_COMMON_H namespace llvm { +class Function; +class Module; namespace IndexedInstrProf { struct Summary; } @@ -28,6 +30,8 @@ namespace sampleprof { class FunctionSamples; } struct InstrProfRecord; +inline const char *getHotSectionPrefix() { return ".hot"; } +inline const char *getUnlikelySectionPrefix() { return ".unlikely"; } // The profile summary is one or more (Cutoff, MinCount, NumCounts) triplets. // The semantics of counts depend on the type of profile. For instrumentation // profile, counts are block counts and for sample profile, counts are @@ -66,6 +70,10 @@ protected: public: static const int Scale = 1000000; + // \brief Returns true if F is a hot function. + static bool isFunctionHot(const Function *F); + // \brief Returns true if F is unlikley executed. + static bool isFunctionUnlikely(const Function *F); inline std::vector &getDetailedSummary(); void computeDetailedSummary(); /// \brief A vector of useful cutoff values for detailed summary. -- cgit v1.2.3