Move ProfilePaths class into ProfilePaths library, only expose a creation function
authorChris Lattner <sabre@nondot.org>
Tue, 26 Feb 2002 20:04:59 +0000 (20:04 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 26 Feb 2002 20:04:59 +0000 (20:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1812 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/Instrumentation/ProfilePaths.h
lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
tools/opt/opt.cpp

index de9d37c4e885f257ed1e1bdfd5b3635480bedfbb..4004c7fd95fb5c8ed1cbbb65e3ce7d159c9cd01c 100644 (file)
 #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
     
index 03a3e4bcca7780ebf1ad733f49c4826c6f8617ca..1be6458fea2c3100719d0b97aa2d9e28781e9952 100644 (file)
 #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);
-}
-
-
-
-
-
-
-
index 34eff8f2ff4f59409013521f4ba63c0844e8b476..2b2447b155be2b1947c72aacc4bdf0a63198145f 100644 (file)
@@ -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> },