summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-26 20:04:59 +0000
committerChris Lattner <sabre@nondot.org>2002-02-26 20:04:59 +0000
commitd209550828b761f81b2660939dcc0c0c92c32c79 (patch)
tree78d69d676922639ef6d703fe5db0cf63b741621e
parentd7291473cfc64fb63d03cf3ae9c90fc7ffe755b7 (diff)
downloadbcm5719-llvm-d209550828b761f81b2660939dcc0c0c92c32c79.tar.gz
bcm5719-llvm-d209550828b761f81b2660939dcc0c0c92c32c79.zip
Move ProfilePaths class into ProfilePaths library, only expose a creation function
llvm-svn: 1812
-rw-r--r--llvm/include/llvm/Transforms/Instrumentation/ProfilePaths.h14
-rw-r--r--llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp37
-rw-r--r--llvm/tools/opt/opt.cpp4
3 files changed, 29 insertions, 26 deletions
diff --git a/llvm/include/llvm/Transforms/Instrumentation/ProfilePaths.h b/llvm/include/llvm/Transforms/Instrumentation/ProfilePaths.h
index de9d37c4e88..4004c7fd95f 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/ProfilePaths.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/ProfilePaths.h
@@ -27,17 +27,11 @@
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
#define LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
-#include "llvm/Pass.h"
+class Pass;
-class ProfilePaths: public MethodPass {
- public:
- bool runOnMethod(Method *M);
-
- // getAnalysisUsageInfo - transform cfg to have just one exit node
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided);
-};
+// createProfilePathsPass - Create a new pass to add path profiling
+//
+Pass *createProfilePathsPass();
#endif
diff --git a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index 03a3e4bcca7..1be6458fea2 100644
--- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
@@ -32,10 +32,32 @@
#include "llvm/ConstantVals.h"
#include "llvm/DerivedTypes.h"
#include "llvm/iMemory.h"
+#include "llvm/Pass.h"
#include "Graph.h"
using std::vector;
+class ProfilePaths: public MethodPass {
+ public:
+ bool runOnMethod(Method *M);
+
+ // Before this pass, make sure that there is only one
+ // entry and only one exit node for the method in the CFG of the method
+ //
+ void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided) {
+ Requires.push_back(UnifyMethodExitNodes::ID);
+ }
+};
+
+// createProfilePathsPass - Create a new pass to add path profiling
+//
+Pass *createProfilePathsPass() {
+ return new ProfilePaths();
+}
+
+
static Node *findBB(std::set<Node *> &st, BasicBlock *BB){
for(std::set<Node *>::iterator si=st.begin(); si!=st.end(); ++si){
if(((*si)->getElement())==BB){
@@ -145,18 +167,3 @@ bool ProfilePaths::runOnMethod(Method *M){
return true; // Always modifies method
}
-
-//Before this pass, make sure that there is only one
-//entry and only one exit node for the method in the CFG of the method
-void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
- Requires.push_back(UnifyMethodExitNodes::ID);
-}
-
-
-
-
-
-
-
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 34eff8f2ff4..2b2447b155b 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -100,9 +100,11 @@ struct {
{ trace , New<InsertTraceCode, bool, true, bool, true> },
{ tracem , New<InsertTraceCode, bool, false, bool, true> },
- { paths , New<ProfilePaths> },
+ { paths , createProfilePathsPass },
+
{ print , NewPrintMethodPass },
{ verify , createVerifierPass },
+
{ raiseallocs, New<RaiseAllocations> },
{ cleangcc , New<CleanupGCCOutput> },
{ globaldce , New<GlobalDCE> },
OpenPOWER on IntegriCloud