summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ProfileInfoLoader.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-11 05:54:25 +0000
committerChris Lattner <sabre@nondot.org>2004-02-11 05:54:25 +0000
commitbc44aa61c41277e85f1daec2740a7a12ed8e62b6 (patch)
tree077fa3f3dfb33661700b19131c17f03378a1ce56 /include/llvm/Analysis/ProfileInfoLoader.h
parent5f55aaf0f052834cf27f19e9181d5f96413107a2 (diff)
downloadllvm-bc44aa61c41277e85f1daec2740a7a12ed8e62b6.tar.gz
llvm-bc44aa61c41277e85f1daec2740a7a12ed8e62b6.tar.bz2
llvm-bc44aa61c41277e85f1daec2740a7a12ed8e62b6.tar.xz
Factor this code out of llvm-prof
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ProfileInfoLoader.h')
-rw-r--r--include/llvm/Analysis/ProfileInfoLoader.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ProfileInfoLoader.h b/include/llvm/Analysis/ProfileInfoLoader.h
new file mode 100644
index 0000000000..b669401422
--- /dev/null
+++ b/include/llvm/Analysis/ProfileInfoLoader.h
@@ -0,0 +1,65 @@
+//===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// The ProfileInfoLoader class is used to load and represent profiling
+// information read in from the dump file. If conversions between formats are
+// needed, it can also do this.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_PROFILEINFOLOADER_H
+#define LLVM_ANALYSIS_PROFILEINFOLOADER_H
+
+#include <vector>
+#include <string>
+#include <utility>
+
+namespace llvm {
+
+class Module;
+class Function;
+class BasicBlock;
+
+class ProfileInfoLoader {
+ Module &M;
+ std::vector<std::string> CommandLines;
+ std::vector<unsigned> FunctionCounts;
+ std::vector<unsigned> BlockCounts;
+public:
+ // ProfileInfoLoader ctor - Read the specified profiling data file, exiting
+ // the program if the file is invalid or broken.
+ ProfileInfoLoader(const char *ToolName, const std::string &Filename,
+ Module &M);
+
+ unsigned getNumExecutions() const { return CommandLines.size(); }
+ const std::string &getExecution(unsigned i) const { return CommandLines[i]; }
+
+ // getFunctionCounts - This method is used by consumers of function counting
+ // information. If we do not directly have function count information, we
+ // compute it from other, more refined, types of profile information.
+ //
+ void getFunctionCounts(std::vector<std::pair<Function*, unsigned> > &Counts);
+
+ // hasAccurateBlockCounts - Return true if we can synthesize accurate block
+ // frequency information from whatever we have.
+ //
+ bool hasAccurateBlockCounts() const {
+ return !BlockCounts.empty();
+ }
+
+ // getBlockCounts - This method is used by consumers of block counting
+ // information. If we do not directly have block count information, we
+ // compute it from other, more refined, types of profile information.
+ //
+ void getBlockCounts(std::vector<std::pair<BasicBlock*, unsigned> > &Counts);
+};
+
+} // End llvm namespace
+
+#endif