summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/SampleProf.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2015-11-17 19:04:46 +0000
committerDiego Novillo <dnovillo@google.com>2015-11-17 19:04:46 +0000
commitba920be4a220c53cc30ec29df3b721b85c1fb8b6 (patch)
tree04310907c8da37568525d823633ae78394029640 /llvm/lib/ProfileData/SampleProf.cpp
parentff43d69ddfa9c3422639ed6112a5a947c553f9d3 (diff)
downloadbcm5719-llvm-ba920be4a220c53cc30ec29df3b721b85c1fb8b6.tar.gz
bcm5719-llvm-ba920be4a220c53cc30ec29df3b721b85c1fb8b6.zip
SamplePGO - Move debug/dump function bodies out of header files. NFC.
No point polluting the header declarations with debugging code. llvm-svn: 253361
Diffstat (limited to 'llvm/lib/ProfileData/SampleProf.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProf.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index b3ee61a7b97..3d75d230fb6 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -57,6 +57,33 @@ const std::error_category &llvm::sampleprof_category() {
return *ErrorCategory;
}
+void LineLocation::print(raw_ostream &OS) const {
+ OS << LineOffset;
+ if (Discriminator > 0)
+ OS << "." << Discriminator;
+}
+
+raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
+ const LineLocation &Loc) {
+ Loc.print(OS);
+ return OS;
+}
+
+void LineLocation::dump() const { print(dbgs()); }
+
+void CallsiteLocation::print(raw_ostream &OS) const {
+ LineLocation::print(OS);
+ OS << ": inlined callee: " << CalleeName;
+}
+
+void CallsiteLocation::dump() const { print(dbgs()); }
+
+inline raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
+ const CallsiteLocation &Loc) {
+ Loc.print(OS);
+ return OS;
+}
+
/// \brief Print the sample record to the stream \p OS indented by \p Indent.
void SampleRecord::print(raw_ostream &OS, unsigned Indent) const {
OS << NumSamples;
@@ -68,6 +95,14 @@ void SampleRecord::print(raw_ostream &OS, unsigned Indent) const {
OS << "\n";
}
+void SampleRecord::dump() const { print(dbgs(), 0); }
+
+raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
+ const SampleRecord &Sample) {
+ Sample.print(OS, 0);
+ return OS;
+}
+
/// \brief Print the samples collected for a function on stream \p OS.
void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const {
OS << TotalSamples << ", " << TotalHeadSamples << ", " << BodySamples.size()
@@ -84,3 +119,11 @@ void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const {
CS.second.print(OS, Indent + 2);
}
}
+
+raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
+ const FunctionSamples &FS) {
+ FS.print(OS);
+ return OS;
+}
+
+void FunctionSamples::dump(void) const { print(dbgs(), 0); }
OpenPOWER on IntegriCloud