diff options
author | Easwaran Raman <eraman@google.com> | 2016-05-19 21:07:12 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@google.com> | 2016-05-19 21:07:12 +0000 |
commit | e5a17e3f1d1d620d0793f36f54654951a4440f99 (patch) | |
tree | 29453f82d5ec2e7a668a9bbceb7d8bc300ce0e73 /llvm/lib/ProfileData/InstrProfWriter.cpp | |
parent | b1d37199ccfad5654d587cb9a81bcfde613315b4 (diff) | |
download | llvm-e5a17e3f1d1d620d0793f36f54654951a4440f99.zip llvm-e5a17e3f1d1d620d0793f36f54654951a4440f99.tar.gz llvm-e5a17e3f1d1d620d0793f36f54654951a4440f99.tar.bz2 |
Move ProfileSummary to IR.
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData.
Differential Revision: http://reviews.llvm.org/D20314
llvm-svn: 270136
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfWriter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 9b01dac..1036a10 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -84,7 +84,7 @@ public: typedef uint64_t offset_type; support::endianness ValueProfDataEndianness; - InstrProfSummary *TheProfileSummary; + InstrProfSummaryBuilder *SummaryBuilder; InstrProfRecordWriterTrait() : ValueProfDataEndianness(support::little) {} static hash_value_type ComputeHash(key_type_ref K) { @@ -123,7 +123,7 @@ public: endian::Writer<little> LE(Out); for (const auto &ProfileData : *V) { const InstrProfRecord &ProfRecord = ProfileData.second; - TheProfileSummary->addRecord(ProfRecord); + SummaryBuilder->addRecord(ProfRecord); LE.write<uint64_t>(ProfileData.first); // Function hash LE.write<uint64_t>(ProfRecord.Counts.size()); @@ -215,8 +215,8 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) { OnDiskChainedHashTableGenerator<InstrProfRecordWriterTrait> Generator; using namespace IndexedInstrProf; - InstrProfSummary PS(ProfileSummary::DefaultCutoffs); - InfoObj->TheProfileSummary = &PS; + InstrProfSummaryBuilder ISB(ProfileSummaryBuilder::DefaultCutoffs); + InfoObj->SummaryBuilder = &ISB; // Populate the hash table generator. for (const auto &I : FunctionData) @@ -245,7 +245,7 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) { OS.write(0); // Reserve space to write profile summary data. - uint32_t NumEntries = ProfileSummary::DefaultCutoffs.size(); + uint32_t NumEntries = ProfileSummaryBuilder::DefaultCutoffs.size(); uint32_t SummarySize = Summary::getSize(Summary::NumKinds, NumEntries); // Remember the summary offset. uint64_t SummaryOffset = OS.tell(); @@ -260,8 +260,9 @@ 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). - setSummary(TheSummary.get(), PS); - InfoObj->TheProfileSummary = 0; + InstrProfSummary *IPS = ISB.getSummary(); + setSummary(TheSummary.get(), *IPS); + InfoObj->SummaryBuilder = 0; // Now do the final patch: PatchItem PatchItems[] = { |