summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEaswaran Raman <eraman@google.com>2016-05-19 21:53:28 +0000
committerEaswaran Raman <eraman@google.com>2016-05-19 21:53:28 +0000
commit30c760d8010f68b5bfaf005883c380d60ecaf33a (patch)
tree7ba34e6cb43db9d577a2d04b18cbf648903be9c8 /include
parente40864cee2059cf804fc49bdc7c9b46d9f55cad5 (diff)
Remove specializations of ProfileSummary
This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class. Differential Revision: http://reviews.llvm.org/D20390 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/ProfileSummary.h69
-rw-r--r--include/llvm/ProfileData/InstrProfReader.h4
-rw-r--r--include/llvm/ProfileData/ProfileCommon.h4
-rw-r--r--include/llvm/ProfileData/SampleProfReader.h4
-rw-r--r--include/llvm/ProfileData/SampleProfWriter.h2
5 files changed, 19 insertions, 64 deletions
diff --git a/include/llvm/IR/ProfileSummary.h b/include/llvm/IR/ProfileSummary.h
index 5da87f3b5fe..ea774631eb4 100644
--- a/include/llvm/IR/ProfileSummary.h
+++ b/include/llvm/IR/ProfileSummary.h
@@ -50,29 +50,23 @@ public:
private:
const Kind PSK;
static const char *KindStr[2];
-
-protected:
SummaryEntryVector DetailedSummary;
- uint64_t TotalCount, MaxCount, MaxFunctionCount;
+ uint64_t TotalCount, MaxCount, MaxInternalCount, MaxFunctionCount;
uint32_t NumCounts, NumFunctions;
- ProfileSummary(Kind K, SummaryEntryVector DetailedSummary,
- uint64_t TotalCount, uint64_t MaxCount,
- uint64_t MaxFunctionCount, uint32_t NumCounts,
- uint32_t NumFunctions)
- : PSK(K), DetailedSummary(DetailedSummary), TotalCount(TotalCount),
- MaxCount(MaxCount), MaxFunctionCount(MaxFunctionCount),
- NumCounts(NumCounts), NumFunctions(NumFunctions) {}
- ~ProfileSummary() = default;
- /// \brief Return metadata specific to the profile format.
- /// Derived classes implement this method to return a vector of Metadata.
- virtual std::vector<Metadata *> getFormatSpecificMD(LLVMContext &Context) = 0;
/// \brief Return detailed summary as metadata.
Metadata *getDetailedSummaryMD(LLVMContext &Context);
public:
static const int Scale = 1000000;
+ ProfileSummary(Kind K, SummaryEntryVector DetailedSummary,
+ uint64_t TotalCount, uint64_t MaxCount,
+ uint64_t MaxInternalCount, uint64_t MaxFunctionCount,
+ uint32_t NumCounts, uint32_t NumFunctions)
+ : PSK(K), DetailedSummary(DetailedSummary), TotalCount(TotalCount),
+ MaxCount(MaxCount), MaxInternalCount(MaxInternalCount),
+ MaxFunctionCount(MaxFunctionCount), NumCounts(NumCounts),
+ NumFunctions(NumFunctions) {}
Kind getKind() const { return PSK; }
- const char *getKindStr() const { return KindStr[PSK]; }
/// \brief Return summary information as metadata.
Metadata *getMD(LLVMContext &Context);
/// \brief Construct profile summary from metdata.
@@ -80,49 +74,10 @@ public:
SummaryEntryVector &getDetailedSummary() { return DetailedSummary; }
uint32_t getNumFunctions() { return NumFunctions; }
uint64_t getMaxFunctionCount() { return MaxFunctionCount; }
-};
-
-class InstrProfSummary final : public ProfileSummary {
- uint64_t MaxInternalBlockCount;
-
-protected:
- std::vector<Metadata *> getFormatSpecificMD(LLVMContext &Context) override;
-
-public:
- InstrProfSummary(uint64_t TotalCount, uint64_t MaxBlockCount,
- uint64_t MaxInternalBlockCount, uint64_t MaxFunctionCount,
- uint32_t NumBlocks, uint32_t NumFunctions,
- SummaryEntryVector Summary)
- : ProfileSummary(PSK_Instr, Summary, TotalCount, MaxBlockCount,
- MaxFunctionCount, NumBlocks, NumFunctions),
- MaxInternalBlockCount(MaxInternalBlockCount) {}
- static bool classof(const ProfileSummary *PS) {
- return PS->getKind() == PSK_Instr;
- }
- uint32_t getNumBlocks() { return NumCounts; }
+ uint32_t getNumCounts() { return NumCounts; }
uint64_t getTotalCount() { return TotalCount; }
- uint64_t getMaxBlockCount() { return MaxCount; }
- uint64_t getMaxInternalBlockCount() { return MaxInternalBlockCount; }
-};
-
-class SampleProfileSummary final : public ProfileSummary {
-protected:
- std::vector<Metadata *> getFormatSpecificMD(LLVMContext &Context) override;
-
-public:
- uint32_t getNumLinesWithSamples() { return NumCounts; }
- uint64_t getTotalSamples() { return TotalCount; }
- uint64_t getMaxSamplesPerLine() { return MaxCount; }
- SampleProfileSummary(uint64_t TotalSamples, uint64_t MaxSamplesPerLine,
- uint64_t MaxFunctionCount, int32_t NumLinesWithSamples,
- uint32_t NumFunctions,
- SummaryEntryVector DetailedSummary)
- : ProfileSummary(PSK_Sample, DetailedSummary, TotalSamples,
- MaxSamplesPerLine, MaxFunctionCount, NumLinesWithSamples,
- NumFunctions) {}
- static bool classof(const ProfileSummary *PS) {
- return PS->getKind() == PSK_Sample;
- }
+ uint64_t getMaxCount() { return MaxCount; }
+ uint64_t getMaxInternalCount() { return MaxInternalCount; }
};
} // end namespace llvm
diff --git a/include/llvm/ProfileData/InstrProfReader.h b/include/llvm/ProfileData/InstrProfReader.h
index 4e9e618324a..4c2e5fc913c 100644
--- a/include/llvm/ProfileData/InstrProfReader.h
+++ b/include/llvm/ProfileData/InstrProfReader.h
@@ -364,7 +364,7 @@ private:
/// The index into the profile data.
std::unique_ptr<InstrProfReaderIndexBase> Index;
/// Profile summary data.
- std::unique_ptr<InstrProfSummary> Summary;
+ std::unique_ptr<ProfileSummary> Summary;
IndexedInstrProfReader(const IndexedInstrProfReader &) = delete;
IndexedInstrProfReader &operator=(const IndexedInstrProfReader &) = delete;
@@ -417,7 +417,7 @@ public:
// to be used by llvm-profdata (for dumping). Avoid using this when
// the client is the compiler.
InstrProfSymtab &getSymtab() override;
- InstrProfSummary &getSummary() { return *(Summary.get()); }
+ ProfileSummary &getSummary() { return *(Summary.get()); }
};
} // end namespace llvm
diff --git a/include/llvm/ProfileData/ProfileCommon.h b/include/llvm/ProfileData/ProfileCommon.h
index 79eee91c3d7..f5b940554c8 100644
--- a/include/llvm/ProfileData/ProfileCommon.h
+++ b/include/llvm/ProfileData/ProfileCommon.h
@@ -74,7 +74,7 @@ public:
InstrProfSummaryBuilder(std::vector<uint32_t> Cutoffs)
: ProfileSummaryBuilder(Cutoffs), MaxInternalBlockCount(0) {}
void addRecord(const InstrProfRecord &);
- InstrProfSummary *getSummary();
+ ProfileSummary *getSummary();
};
class SampleProfileSummaryBuilder final : public ProfileSummaryBuilder {
@@ -83,7 +83,7 @@ public:
void addRecord(const sampleprof::FunctionSamples &FS);
SampleProfileSummaryBuilder(std::vector<uint32_t> Cutoffs)
: ProfileSummaryBuilder(Cutoffs) {}
- SampleProfileSummary *getSummary();
+ ProfileSummary *getSummary();
};
// This is called when a count is seen in the profile.
diff --git a/include/llvm/ProfileData/SampleProfReader.h b/include/llvm/ProfileData/SampleProfReader.h
index 716f672fc2d..dacf6d06c13 100644
--- a/include/llvm/ProfileData/SampleProfReader.h
+++ b/include/llvm/ProfileData/SampleProfReader.h
@@ -296,7 +296,7 @@ public:
create(std::unique_ptr<MemoryBuffer> &B, LLVMContext &C);
/// \brief Return the profile summary.
- SampleProfileSummary &getSummary() { return *(Summary.get()); }
+ ProfileSummary &getSummary() { return *(Summary.get()); }
protected:
/// \brief Map every function to its associated profile.
@@ -313,7 +313,7 @@ protected:
std::unique_ptr<MemoryBuffer> Buffer;
/// \brief Profile summary information.
- std::unique_ptr<SampleProfileSummary> Summary;
+ std::unique_ptr<ProfileSummary> Summary;
/// \brief Compute summary for this profile.
void computeSummary();
diff --git a/include/llvm/ProfileData/SampleProfWriter.h b/include/llvm/ProfileData/SampleProfWriter.h
index b605d459890..f6f2e2702e3 100644
--- a/include/llvm/ProfileData/SampleProfWriter.h
+++ b/include/llvm/ProfileData/SampleProfWriter.h
@@ -76,7 +76,7 @@ protected:
std::unique_ptr<raw_ostream> OutputStream;
/// \brief Profile summary.
- std::unique_ptr<SampleProfileSummary> Summary;
+ std::unique_ptr<ProfileSummary> Summary;
/// \brief Compute summary for this profile.
void computeSummary(const StringMap<FunctionSamples> &ProfileMap);