summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
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
commit7cefdb81c5fd6d1263c9f8b66261515329883319 (patch)
treeba0126ef0497467af69d6826a3df76d16883ee4f /llvm/lib/ProfileData
parent476c0afc014b6d1e8b7c5725495c42a30f60bb44 (diff)
downloadbcm5719-llvm-7cefdb81c5fd6d1263c9f8b66261515329883319.tar.gz
bcm5719-llvm-7cefdb81c5fd6d1263c9f8b66261515329883319.zip
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 llvm-svn: 270143
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp5
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp13
-rw-r--r--llvm/lib/ProfileData/ProfileSummaryBuilder.cpp15
-rw-r--r--llvm/lib/ProfileData/SampleProfReader.cpp6
-rw-r--r--llvm/lib/ProfileData/SampleProfWriter.cpp6
5 files changed, 23 insertions, 22 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 33535fd8eb6..8ffdc5b8091 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -602,13 +602,14 @@ IndexedInstrProfReader::readSummary(IndexedInstrProf::ProfVersion Version,
Ent.NumBlocks);
}
// initialize InstrProfSummary using the SummaryData from disk.
- this->Summary = llvm::make_unique<InstrProfSummary>(
+ this->Summary = llvm::make_unique<ProfileSummary>(
+ ProfileSummary::PSK_Instr, DetailedSummary,
SummaryData->get(Summary::TotalBlockCount),
SummaryData->get(Summary::MaxBlockCount),
SummaryData->get(Summary::MaxInternalBlockCount),
SummaryData->get(Summary::MaxFunctionCount),
SummaryData->get(Summary::TotalNumBlocks),
- SummaryData->get(Summary::TotalNumFunctions), DetailedSummary);
+ SummaryData->get(Summary::TotalNumFunctions));
return Cur + SummarySize;
} else {
// For older version of profile data, we need to compute on the fly:
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index 1036a10ed8a..e9543ceb91f 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -195,17 +195,16 @@ bool InstrProfWriter::shouldEncodeData(const ProfilingData &PD) {
}
static void setSummary(IndexedInstrProf::Summary *TheSummary,
- InstrProfSummary &PS) {
+ ProfileSummary &PS) {
using namespace IndexedInstrProf;
std::vector<ProfileSummaryEntry> &Res = PS.getDetailedSummary();
TheSummary->NumSummaryFields = Summary::NumKinds;
TheSummary->NumCutoffEntries = Res.size();
TheSummary->set(Summary::MaxFunctionCount, PS.getMaxFunctionCount());
- TheSummary->set(Summary::MaxBlockCount, PS.getMaxBlockCount());
- TheSummary->set(Summary::MaxInternalBlockCount,
- PS.getMaxInternalBlockCount());
+ TheSummary->set(Summary::MaxBlockCount, PS.getMaxCount());
+ TheSummary->set(Summary::MaxInternalBlockCount, PS.getMaxInternalCount());
TheSummary->set(Summary::TotalBlockCount, PS.getTotalCount());
- TheSummary->set(Summary::TotalNumBlocks, PS.getNumBlocks());
+ TheSummary->set(Summary::TotalNumBlocks, PS.getNumCounts());
TheSummary->set(Summary::TotalNumFunctions, PS.getNumFunctions());
for (unsigned I = 0; I < Res.size(); I++)
TheSummary->setEntry(I, Res[I]);
@@ -260,8 +259,8 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) {
IndexedInstrProf::allocSummary(SummarySize);
// Compute the Summary and copy the data to the data
// structure to be serialized out (to disk or buffer).
- InstrProfSummary *IPS = ISB.getSummary();
- setSummary(TheSummary.get(), *IPS);
+ ProfileSummary *PS = ISB.getSummary();
+ setSummary(TheSummary.get(), *PS);
InfoObj->SummaryBuilder = 0;
// Now do the final patch:
diff --git a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp
index 3d32722ab63..ee40d68a1a6 100644
--- a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp
+++ b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp
@@ -86,17 +86,18 @@ void ProfileSummaryBuilder::computeDetailedSummary() {
}
}
-SampleProfileSummary *SampleProfileSummaryBuilder::getSummary() {
+ProfileSummary *SampleProfileSummaryBuilder::getSummary() {
computeDetailedSummary();
- return new SampleProfileSummary(TotalCount, MaxCount, MaxFunctionCount,
- NumCounts, NumFunctions, DetailedSummary);
+ return new ProfileSummary(ProfileSummary::PSK_Sample, DetailedSummary,
+ TotalCount, MaxCount, 0, MaxFunctionCount,
+ NumCounts, NumFunctions);
}
-InstrProfSummary *InstrProfSummaryBuilder::getSummary() {
+ProfileSummary *InstrProfSummaryBuilder::getSummary() {
computeDetailedSummary();
- return new InstrProfSummary(TotalCount, MaxCount, MaxInternalBlockCount,
- MaxFunctionCount, NumCounts, NumFunctions,
- DetailedSummary);
+ return new ProfileSummary(ProfileSummary::PSK_Instr, DetailedSummary,
+ TotalCount, MaxCount, MaxInternalBlockCount,
+ MaxFunctionCount, NumCounts, NumFunctions);
}
void InstrProfSummaryBuilder::addEntryCount(uint64_t Count) {
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 14023bbd509..bd5aacc96f0 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -470,9 +470,9 @@ std::error_code SampleProfileReaderBinary::readSummary() {
if (EC != sampleprof_error::success)
return EC;
}
- Summary = llvm::make_unique<SampleProfileSummary>(
- *TotalCount, *MaxBlockCount, *MaxFunctionCount, *NumBlocks, *NumFunctions,
- Entries);
+ Summary = llvm::make_unique<ProfileSummary>(
+ ProfileSummary::PSK_Sample, Entries, *TotalCount, *MaxBlockCount, 0,
+ *MaxFunctionCount, *NumBlocks, *NumFunctions);
return sampleprof_error::success;
}
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index 56e836c69cd..9c58f9ed3b4 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -138,10 +138,10 @@ std::error_code SampleProfileWriterBinary::writeHeader(
std::error_code SampleProfileWriterBinary::writeSummary() {
auto &OS = *OutputStream;
- encodeULEB128(Summary->getTotalSamples(), OS);
- encodeULEB128(Summary->getMaxSamplesPerLine(), OS);
+ encodeULEB128(Summary->getTotalCount(), OS);
+ encodeULEB128(Summary->getMaxCount(), OS);
encodeULEB128(Summary->getMaxFunctionCount(), OS);
- encodeULEB128(Summary->getNumLinesWithSamples(), OS);
+ encodeULEB128(Summary->getNumCounts(), OS);
encodeULEB128(Summary->getNumFunctions(), OS);
std::vector<ProfileSummaryEntry> &Entries = Summary->getDetailedSummary();
encodeULEB128(Entries.size(), OS);
OpenPOWER on IntegriCloud