'Pass' should now not be derived from by clients. Instead, they should derive
authorChris Lattner <sabre@nondot.org>
Mon, 20 Sep 2004 04:48:05 +0000 (04:48 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Sep 2004 04:48:05 +0000 (04:48 +0000)
from ModulePass.  Instead of implementing Pass::run, then should implement
ModulePass::runOnModule.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16436 91177308-0d34-0410-b5e6-96231b3b80d8

64 files changed:
include/llvm/Analysis/CallGraph.h
include/llvm/Analysis/DataStructure/DataStructure.h
include/llvm/Analysis/FindUnsafePointerTypes.h
include/llvm/Analysis/FindUsedTypes.h
include/llvm/Assembly/PrintModulePass.h
include/llvm/Bytecode/WriteBytecodePass.h
include/llvm/CallGraphSCCPass.h
include/llvm/Pass.h
include/llvm/PassManager.h
lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/CompleteBottomUp.cpp
lib/Analysis/DataStructure/DataStructureAA.cpp
lib/Analysis/DataStructure/DataStructureOpt.cpp
lib/Analysis/DataStructure/IPModRef.cpp
lib/Analysis/DataStructure/IPModRef.h
lib/Analysis/DataStructure/Local.cpp
lib/Analysis/DataStructure/MemoryDepAnalysis.cpp
lib/Analysis/DataStructure/MemoryDepAnalysis.h
lib/Analysis/DataStructure/Parallelize.cpp
lib/Analysis/DataStructure/PgmDependenceGraph.h
lib/Analysis/DataStructure/Steensgaard.cpp
lib/Analysis/DataStructure/TopDownClosure.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/CallGraphSCCPass.cpp
lib/Analysis/IPA/FindUnsafePointerTypes.cpp
lib/Analysis/IPA/FindUsedTypes.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp
lib/Target/SparcV9/EmitBytecodeToAssembly.cpp
lib/Target/SparcV9/InternalGlobalMapper.cpp
lib/Target/SparcV9/MappingInfo.cpp
lib/Target/SparcV9/MappingInfo.h
lib/Target/SparcV9/SparcV9Internals.h
lib/Target/SparcV9/SparcV9StackSlots.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/ConstantMerge.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
lib/Transforms/IPO/DeadTypeElimination.cpp
lib/Transforms/IPO/ExtractFunction.cpp
lib/Transforms/IPO/FunctionResolution.cpp
lib/Transforms/IPO/GlobalDCE.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/IPO/IPConstantPropagation.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/Internalize.cpp
lib/Transforms/IPO/LoopExtractor.cpp
lib/Transforms/IPO/LowerSetJmp.cpp
lib/Transforms/IPO/PruneEH.cpp
lib/Transforms/IPO/RaiseAllocations.cpp
lib/Transforms/Instrumentation/BlockProfiling.cpp
lib/Transforms/Instrumentation/EdgeProfiling.cpp
lib/Transforms/Instrumentation/EmitFunctions.cpp
lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
lib/VMCore/PassManagerT.h
tools/analyze/AnalysisWrappers.cpp
tools/analyze/GraphPrinters.cpp
tools/analyze/analyze.cpp
tools/bugpoint/ExtractFunction.cpp
tools/opt/AnalysisWrappers.cpp
tools/opt/GraphPrinters.cpp

index 8f2c30238907e73e9e69a52c2889e3090ca862ba..446ea500d468c1a41626d836a08f23dcfa946321 100644 (file)
@@ -64,7 +64,7 @@ class CallGraphNode;
 //===----------------------------------------------------------------------===//
 // CallGraph class definition
 //
-class CallGraph : public Pass {
+class CallGraph : public ModulePass {
   Module *Mod;              // The module this call graph represents
 
   typedef std::map<const Function *, CallGraphNode *> FunctionMapTy;
@@ -150,8 +150,8 @@ public:
   CallGraph() : Root(0), CallsExternalNode(0) {}
   ~CallGraph() { destroy(); }
 
-  // run - Compute the call graph for the specified module.
-  virtual bool run(Module &M);
+  // runOnModule - Compute the call graph for the specified module.
+  virtual bool runOnModule(Module &M);
 
   // getAnalysisUsage - This obviously provides a call graph
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
index 9351ed4c988b53964cb9078041b2f8b24dd0283c..34575a2db8ab075872620ac082c561dad10935ba 100644 (file)
@@ -40,14 +40,14 @@ namespace DataStructureAnalysis {
 // FIXME: This should be a Function pass that can be USED by a Pass, and would
 // be automatically preserved.  Until we can do that, this is a Pass.
 //
-class LocalDataStructures : public Pass {
+class LocalDataStructures : public ModulePass {
   // DSInfo, one graph for each function
   hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
 public:
   ~LocalDataStructures() { releaseMemory(); }
 
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   bool hasGraph(const Function &F) const {
     return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -86,7 +86,7 @@ public:
 /// data structure graphs for all of the functions in the program.  This pass
 /// only performs a "Bottom Up" propagation (hence the name).
 ///
-class BUDataStructures : public Pass {
+class BUDataStructures : public ModulePass {
 protected:
   // DSInfo, one graph for each function
   hash_map<Function*, DSGraph*> DSInfo;
@@ -95,7 +95,7 @@ protected:
 public:
   ~BUDataStructures() { releaseMemory(); }
 
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   bool hasGraph(const Function &F) const {
     return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -149,7 +149,7 @@ private:
 /// for each function using the closed graphs for the callers computed
 /// by the bottom-up pass.
 ///
-class TDDataStructures : public Pass {
+class TDDataStructures : public ModulePass {
   // DSInfo, one graph for each function
   hash_map<Function*, DSGraph*> DSInfo;
   hash_set<Function*> ArgsRemainIncomplete;
@@ -157,7 +157,7 @@ class TDDataStructures : public Pass {
 public:
   ~TDDataStructures() { releaseMyMemory(); }
 
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   bool hasGraph(const Function &F) const {
     return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
@@ -207,7 +207,7 @@ private:
 /// allocation.
 ///
 struct CompleteBUDataStructures : public BUDataStructures {
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   bool hasGraph(const Function &F) const {
     return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
index a2306021f943a71daae8bb1069ff0a877424e5ff..2d453f087a6c127bf228737322d2c126d63a58f9 100644 (file)
@@ -31,7 +31,7 @@ namespace llvm {
 
 class PointerType;
 
-struct FindUnsafePointerTypes : public Pass {
+struct FindUnsafePointerTypes : public ModulePass {
   // UnsafeTypes - Set of types that are not safe to transform.
   std::set<PointerType*> UnsafeTypes;
 public:
@@ -44,7 +44,7 @@ public:
   /// values of various types.  If they are deemed to be 'unsafe' note that the
   /// type is not safe to transform.
   ///
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   /// print - Loop over the results of the analysis, printing out unsafe types.
   ///
index 69471791ab04738f8de6ddd9a394f6f8e07a51a8..143d6ce031098394ff690babb856615b424f6a03 100644 (file)
@@ -21,7 +21,7 @@ namespace llvm {
 
 class Type;
 
-class FindUsedTypes : public Pass {
+class FindUsedTypes : public ModulePass {
   std::set<const Type *> UsedTypes;
 public:
   /// getTypes - After the pass has been run, return the set containing all of
@@ -47,7 +47,7 @@ private:
 
 public:
   /// run - This incorporates all types used by the specified module
-  bool run(Module &M);
+  bool runOnModule(Module &M);
 
   /// getAnalysisUsage - We do not modify anything.
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
index fc7e6f48a5740015ea0361b4ddf4db84cccfd61b..102701fde273840238d89e19f57f0747ef46ed1e 100644 (file)
@@ -24,7 +24,7 @@
 
 namespace llvm {
 
-class PrintModulePass : public Pass {
+class PrintModulePass : public ModulePass {
   std::ostream *Out;      // ostream to print on
   bool DeleteStream;      // Delete the ostream in our dtor?
 public:
@@ -37,7 +37,7 @@ public:
     if (DeleteStream) delete Out;
   }
   
-  bool run(Module &M) {
+  bool runOnModule(Module &M) {
     (*Out) << M << std::flush;
     return false;
   }
index b8863e6b476cc300312f47e732230d52ba89e045..5b6325d521eaecb0d27672c9d8a1ad58b8d67306 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace llvm {
 
-class WriteBytecodePass : public Pass {
+class WriteBytecodePass : public ModulePass {
   std::ostream *Out;           // ostream to print on
   bool DeleteStream;
 public:
@@ -34,7 +34,7 @@ public:
     if (DeleteStream) delete Out;
   }
   
-  bool run(Module &M) {
+  bool runOnModule(Module &M) {
     WriteBytecodeToFile(&M, *Out);    
     return false;
   }
index b7fba387ea5308c2cc0b4af43afc47fc8d3aa43c..389a80c9e361a256a43f56d781fbf28f803bf564 100644 (file)
@@ -28,7 +28,7 @@ namespace llvm {
 class CallGraphNode;
 class CallGraph;
 
-struct CallGraphSCCPass : public Pass {
+struct CallGraphSCCPass : public ModulePass {
 
   /// doInitialization - This method is called before the SCC's of the program
   /// has been processed, allowing the pass to do initialization as necessary.
@@ -52,7 +52,7 @@ struct CallGraphSCCPass : public Pass {
   /// run - Run this pass, returning true if a modification was made to the
   /// module argument.  This is implemented in terms of the runOnSCC method.
   ///
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
 
   /// getAnalysisUsage - For this class, we declare that we require and preserve
index 08496c5d2e7c3bfa0c69cc64cfc6d66ed0196bdb..77f630c31641c3855d1f770a39ba123762ae5f21 100644 (file)
@@ -84,10 +84,10 @@ public:
   ///
   const PassInfo *getPassInfo() const;
 
-  /// run - Run this pass, returning true if a modification was made to the
+  /// runPass - Run this pass, returning true if a modification was made to the
   /// module argument.  This should be implemented by all concrete subclasses.
   ///
-  virtual bool run(Module &M) = 0;
+  virtual bool runPass(Module &M) = 0;
 
   /// print - Print out the internal state of the pass.  This is called by
   /// Analyze to print out the contents of an analysis.  Otherwise it is not
@@ -200,13 +200,27 @@ private:
   friend class PassManagerT<Module>;
   friend class PassManagerT<Function>;
   friend class PassManagerT<BasicBlock>;
-  virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
 };
 
 inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
   P.print(OS, 0); return OS;
 }
 
+//===----------------------------------------------------------------------===//
+/// ModulePass class - This class is used to implement unstructured
+/// interprocedural optimizations and analyses.  ModulePass's may do anything
+/// they want to the program.
+///
+struct ModulePass : public Pass {
+
+  /// runOnModule - Virtual method overriden by subclasses to process the module
+  /// being operated on.
+  virtual bool runOnModule(Module &M) = 0;
+
+  bool runPass(Module &M) { return runOnModule(M); }
+
+  virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
+};
 
 
 //===----------------------------------------------------------------------===//
@@ -214,7 +228,7 @@ inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
 /// not need to be run.  This is useful for things like target information and
 /// "basic" versions of AnalysisGroups.
 ///
-struct ImmutablePass : public Pass {
+struct ImmutablePass : public ModulePass {
   /// initializePass - This method may be overriden by immutable passes to allow
   /// them to perform various initialization actions they require.  This is
   /// primarily because an ImmutablePass can "require" another ImmutablePass,
@@ -225,14 +239,13 @@ struct ImmutablePass : public Pass {
 
   /// ImmutablePasses are never run.
   ///
-  virtual bool run(Module &M) { return false; }
+  virtual bool runOnModule(Module &M) { return false; }
 
 private:
   friend class PassManagerT<Module>;
   virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU);
 };
 
-
 //===----------------------------------------------------------------------===//
 /// FunctionPass class - This class is used to implement most global
 /// optimizations.  Optimizations should subclass this class if they meet the
@@ -242,7 +255,7 @@ private:
 ///  2. Optimizing a function does not cause the addition or removal of any
 ///     functions in the module
 ///
-struct FunctionPass : public Pass {
+struct FunctionPass : public ModulePass {
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
@@ -258,10 +271,11 @@ struct FunctionPass : public Pass {
   ///
   virtual bool doFinalization(Module &M) { return false; }
 
-  /// run - On a module, we run this pass by initializing, ronOnFunction'ing
-  /// once for every function in the module, then by finalizing.
+  /// runOnModule - On a module, we run this pass by initializing,
+  /// ronOnFunction'ing once for every function in the module, then by
+  /// finalizing.
   ///
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   /// run - On a function, we simply initialize, run the function, then
   /// finalize.
@@ -323,7 +337,7 @@ struct BasicBlockPass : public FunctionPass {
   /// To run directly on the basic block, we initialize, runOnBasicBlock, then
   /// finalize.
   ///
-  bool run(BasicBlock &BB);
+  bool runPass(BasicBlock &BB);
 
 private:
   friend class PassManagerT<Function>;
index b1d369b925d5ff5014d7d844386ec0e14423f9f6..1b77c875d915ceb63892d0053a0883dfa8d209d5 100644 (file)
@@ -20,6 +20,7 @@
 namespace llvm {
 
 class Pass;
+class ModulePass;
 class Module;
 class ModuleProvider;
 template<class UnitType> class PassManagerT;
index 09fd6b9e0e46e288e61d2ae129844d1fbe09a551..b17941fdecead7e9fa76bd53fe56b1d9a7bf6a45 100644 (file)
@@ -18,7 +18,7 @@
 using namespace llvm;
 
 namespace {
-  class AliasAnalysisCounter : public Pass, public AliasAnalysis {
+  class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
     unsigned No, May, Must;
     unsigned NoMR, JustRef, JustMod, MR;
     const char *Name;
@@ -64,7 +64,7 @@ namespace {
       }
     }
 
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);
       Name = dynamic_cast<Pass*>(&getAnalysis<AliasAnalysis>())->getPassName();
       return false;
index 4bc6fafcf63d21ecd431849222221769894a62bd..bf4b01cfc1e9159f16386c7a5564fa1d10f359ef 100644 (file)
@@ -35,7 +35,7 @@ using namespace DS;
 // run - Calculate the bottom up data structure graphs for each function in the
 // program.
 //
-bool BUDataStructures::run(Module &M) {
+bool BUDataStructures::runOnModule(Module &M) {
   LocalDataStructures &LocalDSA = getAnalysis<LocalDataStructures>();
   GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph());
   GlobalsGraph->setPrintAuxCalls();
index b2a0f4ba9b8e355c883e8b6d6a75f2eda0e73811..ee111e9d8fe887c225339bfb7ab2400f385335b0 100644 (file)
@@ -32,7 +32,7 @@ namespace {
 // run - Calculate the bottom up data structure graphs for each function in the
 // program.
 //
-bool CompleteBUDataStructures::run(Module &M) {
+bool CompleteBUDataStructures::runOnModule(Module &M) {
   BUDataStructures &BU = getAnalysis<BUDataStructures>();
   GlobalsGraph = new DSGraph(BU.getGlobalsGraph());
   GlobalsGraph->setPrintAuxCalls();
index 3cff79526f70f7e06ff22503b3e80e9afb6290c1..6444cc8aeb0c0bf49a1188588f8098b3d787dfd8 100644 (file)
@@ -19,7 +19,7 @@
 using namespace llvm;
 
 namespace {
-  class DSAA : public Pass, public AliasAnalysis {
+  class DSAA : public ModulePass, public AliasAnalysis {
     TDDataStructures *TD;
     BUDataStructures *BU;
   public:
@@ -32,7 +32,7 @@ namespace {
     // run - Build up the result graph, representing the pointer graph for the
     // program.
     //
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);
       TD = &getAnalysis<TDDataStructures>();
       BU = &getAnalysis<BUDataStructures>();
index f7a1ed9af3f8c660e37902c15db464d9a962f611..1996aea67d6a4f74a883898da91dd38f8d01f713 100644 (file)
@@ -25,10 +25,10 @@ namespace {
   Statistic<>
   NumGlobalsIsolated("ds-opt", "Number of globals with references dropped");
 
-  class DSOpt : public Pass {
+  class DSOpt : public ModulePass {
     TDDataStructures *TD;
   public:
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       TD = &getAnalysis<TDDataStructures>();
       bool Changed = OptimizeGlobals(M);
       return Changed;
index ccc15f74e499937f479ced2d1e6ac9b5a123ab44..6793b0ecdb436735b95c372abc07367b91bc26d0 100644 (file)
@@ -374,7 +374,7 @@ void IPModRef::releaseMemory()
 // NO real interprocedural work because all that has been done the
 // data structure analysis.
 // 
-bool IPModRef::run(Module &theModule)
+bool IPModRef::runOnModule(Module &theModule)
 {
   M = &theModule;
 
index 4a825dbea3a514a5a7993dfe7ada3f3545c54acf..f8ac15c1bed943d9368d13eab6d929219bf67277 100644 (file)
@@ -183,7 +183,7 @@ public:
 /// from an arbitrary callsite, or during an execution of a single call-site
 /// within the function.
 ///
-class IPModRef : public Pass {
+class IPModRef : public ModulePass {
   std::map<const Function*, FunctionModRefInfo*> funcToModRefInfoMap;
   Module* M;
 
@@ -197,7 +197,7 @@ public:
   /// This initializes the module reference, and then computes IPModRef
   /// results immediately if demand-driven analysis was *not* specified.
   /// 
-  virtual bool run(Module &M);
+  virtual bool runOnModule(Module &M);
 
   /// getFunctionModRefInfo - Retrieve the Mod/Ref information for a single
   /// function
index b21f2f10243c07cc275abba541503c7b425da455..070d03738d92125271a5f00ec8267d3556be9e27 100644 (file)
@@ -1023,7 +1023,7 @@ void GraphBuilder::mergeInGlobalInitializer(GlobalVariable *GV) {
 }
 
 
-bool LocalDataStructures::run(Module &M) {
+bool LocalDataStructures::runOnModule(Module &M) {
   GlobalsGraph = new DSGraph(getAnalysis<TargetData>());
 
   const TargetData &TD = getAnalysis<TargetData>();
index 49b6425930d486596b40735cd7515ed1fa248050..f6c54fb5bbf3266a8d9cdad96623ab3bc5b6b5de 100644 (file)
@@ -457,7 +457,7 @@ bool MemoryDepAnalysis::runOnFunction(Function &F) {
 // Driver function to compute dependence graphs for every function.
 // This is temporary and will go away once this is a FunctionPass.
 // 
-bool MemoryDepAnalysis::run(Module& M)
+bool MemoryDepAnalysis::runOnModule(Module& M)
 {
   for (Module::iterator FI = M.begin(), FE = M.end(); FI != FE; ++FI)
     if (! FI->isExternal())
index 570a03b679df9481451232bd8d881bd8f0661c2e..ed21e5f687a00ce4f0232fd21ecc190d1851d28c 100644 (file)
@@ -40,7 +40,7 @@ class FunctionModRefInfo;
 /// allowed to use a FunctionPass such as this one.
 ///---------------------------------------------------------------------------
 
-class MemoryDepAnalysis : public Pass {
+class MemoryDepAnalysis : public ModulePass {
   /// The following map and depGraph pointer are temporary until this class
   /// becomes a FunctionPass instead of a module Pass.
   hash_map<Function*, DependenceGraph*> funcMap;
@@ -63,7 +63,7 @@ public:
 
   /// Driver function to compute dependence graphs for every function.
   ///
-  bool run(Module &M);
+  bool runOnModule(Module &M);
 
   /// getGraph - Retrieve the dependence graph for a function.
   /// This is temporary and will go away once this is a FunctionPass.
index 3dcb05ee064da23877e035a0ed94f3de3f89ff57..2bb6c7ff46c5b33d466eb498ceb9cc9cb59e1518 100644 (file)
@@ -388,11 +388,11 @@ void FindParallelCalls::visitCallInst(CallInst& CI) {
 //---------------------------------------------------------------------------- 
 
 namespace {
-  class Parallelize: public Pass {
+  class Parallelize : public ModulePass {
   public:
     /// Driver functions to transform a program
     ///
-    bool run(Module& M);
+    bool runOnModule(Module& M);
 
     /// getAnalysisUsage - Modifies extensively so preserve nothing.
     /// Uses the DependenceGraph and the Top-down DS Graph (only to find
@@ -409,7 +409,7 @@ namespace {
 }
 
 
-bool Parallelize::run(Module& M) {
+bool Parallelize::runOnModule(Module& M) {
   hash_set<Function*> parallelFunctions;
   hash_set<Function*> safeParallelFunctions;
   hash_set<const GlobalValue*> indirectlyCalled;
index ec6f927a7e625b0385fc20a74075ac49e0090959..d7774943bd93c6dd8c37257f0413616d2c7db89d 100644 (file)
@@ -200,7 +200,7 @@ public:
 /// allowed to use a FunctionPass such as this one.
 ///---------------------------------------------------------------------------
 
-class PgmDependenceGraph: public Pass {
+class PgmDependenceGraph: public ModulePass {
 
   /// Information about the function being analyzed.
   /// 
@@ -253,7 +253,7 @@ public:
 
   /// Driver function to compute dependence graphs for every function.
   /// 
-  bool run(Module& M) { return true; }
+  bool runOnModule(Module& M) { return true; }
 
   /// getGraph() -- Retrieve the pgm dependence graph for a function.
   /// This is temporary and will go away once this is a FunctionPass.
index deeb8b34509e6887b229f522ef8c9929d8f4d537..b0718a18b9773db03057d14dec050f0535b25283 100644 (file)
@@ -22,7 +22,7 @@
 using namespace llvm;
 
 namespace {
-  class Steens : public Pass, public AliasAnalysis {
+  class Steens : public ModulePass, public AliasAnalysis {
     DSGraph *ResultGraph;
     DSGraph *GlobalsGraph;  // FIXME: Eliminate globals graph stuff from DNE
   public:
@@ -39,7 +39,7 @@ namespace {
     // run - Build up the result graph, representing the pointer graph for the
     // program.
     //
-    bool run(Module &M);
+    bool runOnModule(Module &M);
 
     virtual void releaseMyMemory() { delete ResultGraph; ResultGraph = 0; }
 
@@ -103,7 +103,7 @@ void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
 /// run - Build up the result graph, representing the pointer graph for the
 /// program.
 ///
-bool Steens::run(Module &M) {
+bool Steens::runOnModule(Module &M) {
   InitializeAliasAnalysis(this);
   assert(ResultGraph == 0 && "Result graph already allocated!");
   LocalDataStructures &LDS = getAnalysis<LocalDataStructures>();
index 1d861e8216ea39a92e989a2db3b86df9bcb56513..6271980737a02562031e0044b1e8f48d3bebea49 100644 (file)
@@ -51,7 +51,7 @@ void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N,
 // run - Calculate the top down data structure graphs for each function in the
 // program.
 //
-bool TDDataStructures::run(Module &M) {
+bool TDDataStructures::runOnModule(Module &M) {
   BUDataStructures &BU = getAnalysis<BUDataStructures>();
   GlobalsGraph = new DSGraph(BU.getGlobalsGraph());
   GlobalsGraph->setPrintAuxCalls();
index 7901c91abb3bfc449b6c86453af588780fd2dec3..9ade25e1eed3478e26414f4ac820e7833569f1f2 100644 (file)
@@ -75,7 +75,7 @@ namespace {
   Statistic<>
   NumIndirectCallees("anders-aa", "Number of indirect callees found");
 
-  class Andersens : public Pass, public AliasAnalysis,
+  class Andersens : public ModulePass, public AliasAnalysis,
                     private InstVisitor<Andersens> {
     /// Node class - This class is used to represent a memory object in the
     /// program, and is the primitive used to build the points-to graph.
@@ -193,7 +193,7 @@ namespace {
     };
     
   public:
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);
       IdentifyObjects(M);
       CollectConstraints(M);
index dbf5b9f95bdd959ccb31152ee54e059e2ff43734..a6d2836121e21db9660e5a3f516afa3afe588090 100644 (file)
@@ -100,7 +100,7 @@ void CallGraph::addToCallGraph(Function *F) {
     }
 }
 
-bool CallGraph::run(Module &M) {
+bool CallGraph::runOnModule(Module &M) {
   destroy();
 
   Mod = &M;
index f7d7ab126a3ffac68152b82052a0c7554e0f330e..8eb1c120b0cc24523c6cf788da069d5a68f6a5e5 100644 (file)
@@ -28,7 +28,7 @@ void CallGraphSCCPass::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addPreserved<CallGraph>();
 }
 
-bool CallGraphSCCPass::run(Module &M) {
+bool CallGraphSCCPass::runOnModule(Module &M) {
   CallGraph &CG = getAnalysis<CallGraph>();
   bool Changed = doInitialization(CG);
   for (scc_iterator<CallGraph*> I = scc_begin(&CG), E = scc_end(&CG);
index 23ee99aa59c6676099704cfc734832eca2efd80d..c0d0a628501863fd859c2e563eb21bc91ab05048 100644 (file)
@@ -58,7 +58,7 @@ static inline bool isSafeInstruction(const Instruction &I) {
 }
 
 
-bool FindUnsafePointerTypes::run(Module &Mod) {
+bool FindUnsafePointerTypes::runOnModule(Module &Mod) {
   for (Module::iterator FI = Mod.begin(), E = Mod.end();
        FI != E; ++FI) {
     const Function *F = FI;  // We don't need/want write access
index 1f127fe82d478871c298a715af30d675c34f437c..cb6b05ca4ec6758618dc4f7e1d78445db3ba45aa 100644 (file)
@@ -58,7 +58,7 @@ void FindUsedTypes::IncorporateValue(const Value *V) {
 
 // run - This incorporates all types used by the specified module
 //
-bool FindUsedTypes::run(Module &m) {
+bool FindUsedTypes::runOnModule(Module &m) {
   UsedTypes.clear();  // reset if run multiple times...
 
   // Loop over global variables, incorporating their types
index c1f15ed23855fa429a3d28cc84b5fb087e053324..2c4ad4aa4d6d9cdfeb73f3e21bcf4071925122f8 100644 (file)
@@ -67,7 +67,7 @@ namespace {
   };
 
   /// GlobalsModRef - The actual analysis pass.
-  class GlobalsModRef : public Pass, public AliasAnalysis {
+  class GlobalsModRef : public ModulePass, public AliasAnalysis {
     /// NonAddressTakenGlobals - The globals that do not have their addresses
     /// taken.
     std::set<GlobalValue*> NonAddressTakenGlobals;
@@ -77,7 +77,7 @@ namespace {
     std::map<Function*, FunctionRecord> FunctionInfo;
 
   public:
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);                 // set up super class
       AnalyzeGlobals(M);                          // find non-addr taken globals
       AnalyzeCallGraph(getAnalysis<CallGraph>(), M); // Propagate on CG
index cd3f5753559847674a0c0c0045ff72ce90032236..333e9e06f780d06763f3ee285bfbdd6d5592917b 100644 (file)
@@ -28,7 +28,7 @@ namespace {
                       cl::value_desc("filename"),
                       cl::desc("Profile file loaded by -profile-loader"));
 
-  class LoaderPass : public Pass, public ProfileInfo {
+  class LoaderPass : public ModulePass, public ProfileInfo {
     std::string Filename;
   public:
     LoaderPass(const std::string &filename = "")
@@ -45,7 +45,7 @@ namespace {
     }
 
     /// run - Load the profile information from the specified file.
-    virtual bool run(Module &M);
+    virtual bool runOnModule(Module &M);
   };
  
   RegisterOpt<LoaderPass>
@@ -62,7 +62,7 @@ Pass *llvm::createProfileLoaderPass(const std::string &Filename) {
   return new LoaderPass(Filename);
 }
 
-bool LoaderPass::run(Module &M) {
+bool LoaderPass::runOnModule(Module &M) {
   ProfileInfoLoader PIL("profile-loader", Filename, M);
   EdgeCounts.clear();
   bool PrintedWarning = false;
index 45a771f9dfe20a52647ed4c5785f8eaad7265a13..c26cfee54b1fb535295f21aa4aa0591c6ed5715b 100644 (file)
@@ -47,7 +47,7 @@ namespace {
   /// NameAllUsedStructs - This pass inserts names for any unnamed structure
   /// types that are used by the program.
   ///
-  class CBackendNameAllUsedStructs : public Pass {
+  class CBackendNameAllUsedStructs : public ModulePass {
     void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<FindUsedTypes>();
     }
@@ -56,7 +56,7 @@ namespace {
       return "C backend type canonicalizer";
     }
 
-    virtual bool run(Module &M);
+    virtual bool runOnModule(Module &M);
   };
   
   /// CWriter - This class is the main chunk of code that converts an LLVM
@@ -216,7 +216,7 @@ namespace {
 /// the program, and removes names from structure types that are not used by the
 /// program.
 ///
-bool CBackendNameAllUsedStructs::run(Module &M) {
+bool CBackendNameAllUsedStructs::runOnModule(Module &M) {
   // Get a set of types that are used by the program...
   std::set<const Type *> UT = getAnalysis<FindUsedTypes>().getTypes();
   
index 45a771f9dfe20a52647ed4c5785f8eaad7265a13..c26cfee54b1fb535295f21aa4aa0591c6ed5715b 100644 (file)
@@ -47,7 +47,7 @@ namespace {
   /// NameAllUsedStructs - This pass inserts names for any unnamed structure
   /// types that are used by the program.
   ///
-  class CBackendNameAllUsedStructs : public Pass {
+  class CBackendNameAllUsedStructs : public ModulePass {
     void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<FindUsedTypes>();
     }
@@ -56,7 +56,7 @@ namespace {
       return "C backend type canonicalizer";
     }
 
-    virtual bool run(Module &M);
+    virtual bool runOnModule(Module &M);
   };
   
   /// CWriter - This class is the main chunk of code that converts an LLVM
@@ -216,7 +216,7 @@ namespace {
 /// the program, and removes names from structure types that are not used by the
 /// program.
 ///
-bool CBackendNameAllUsedStructs::run(Module &M) {
+bool CBackendNameAllUsedStructs::runOnModule(Module &M) {
   // Get a set of types that are used by the program...
   std::set<const Type *> UT = getAnalysis<FindUsedTypes>().getTypes();
   
index 0826f76284e7b4ab516c2e9daa56a2a523942012..26332ca30109e6d97a79506b5f7790a217a75bbe 100644 (file)
 #include "llvm/Pass.h"
 #include "llvm/Bytecode/Writer.h"
 #include <iostream>
-
-namespace llvm {
-
-using std::ostream;
+using namespace llvm;
 
 namespace {
 
@@ -87,14 +84,14 @@ namespace {
   }
 
   // SparcV9BytecodeWriter - Write bytecode out to a stream that is sparc'ified
-  class SparcV9BytecodeWriter : public Pass {
+  class SparcV9BytecodeWriter : public ModulePass {
     std::ostream &Out;
   public:
     SparcV9BytecodeWriter(std::ostream &out) : Out(out) {}
 
     const char *getPassName() const { return "Emit Bytecode to SparcV9 Assembly";}
     
-    virtual bool run(Module &M) {
+    virtual bool runOnModule(Module &M) {
       // Write an object containing the bytecode to the SPARC assembly stream
       writePrologue (Out, "LLVM BYTECODE OUTPUT", "LLVMBytecode");
       osparcasmstream OS(Out);
@@ -112,8 +109,7 @@ namespace {
   };
 }  // end anonymous namespace
 
-Pass *createBytecodeAsmPrinterPass(std::ostream &Out) {
+ModulePass *llvm::createBytecodeAsmPrinterPass(std::ostream &Out) {
   return new SparcV9BytecodeWriter(Out);
 }
 
-} // End llvm namespace
index 0cd2faa7c31febc097d10e7b9f1d5d880beb43b6..ef870b224f46320589d97db9634d895a1557464b 100644 (file)
@@ -27,13 +27,13 @@ namespace llvm {
 
 typedef std::vector<Constant *> GVVectorTy;
 
-class InternalGlobalMapper : public Pass {
+class InternalGlobalMapper : public ModulePass {
 public:
-  bool run (Module &M);
+  bool runOnModule(Module &M);
 };
 
-Pass *llvm::createInternalGlobalMapperPass () {
-  return new InternalGlobalMapper ();
+ModulePass *llvm::createInternalGlobalMapperPass() {
+  return new InternalGlobalMapper();
 }
 
 static void maybeAddInternalValueToVector (GVVectorTy &Vector, GlobalValue &GV){
@@ -41,14 +41,14 @@ static void maybeAddInternalValueToVector (GVVectorTy &Vector, GlobalValue &GV){
   // be mangled), then put the GV, casted to sbyte*, in the vector. Otherwise
   // add a null.
   if (GV.hasInternalLinkage () && GV.hasName ())
-    Vector.push_back (ConstantExpr::getCast
-      (&GV, PointerType::get (Type::SByteTy)));
+    Vector.push_back(ConstantExpr::getCast(&GV,
+                                           PointerType::get(Type::SByteTy)));
   else
     Vector.push_back (ConstantPointerNull::get (PointerType::get
                                                 (Type::SByteTy)));
 }
 
-bool InternalGlobalMapper::run (Module &M) {
+bool InternalGlobalMapper::runOnModule(Module &M) {
   GVVectorTy gvvector;
 
   // Populate the vector with internal global values and their names.
index 1a7212c9c09a50f77898e2b7a978b49009176f6f..58f19378aa8c565b6971788caa78490694f1a153 100644 (file)
@@ -78,8 +78,8 @@ namespace {
 /// MappingInfoAsmPrinter Pass object, which uses OUT as its output
 /// stream for assembly output.
 ///
-Pass *getMappingInfoAsmPrinterPass(std::ostream &out){
-  return (new MappingInfoAsmPrinter(out));
+ModulePass *getMappingInfoAsmPrinterPass(std::ostream &out){
+  return new MappingInfoAsmPrinter(out);
 }
 
 /// runOnFunction - Builds up the maps for the given function FI and then
index 346a5f7cb90a9c0922d5cf5def33e4cddb53a4fa..1be2e865e8063905f1ecf86146b94c6feb1468e2 100644 (file)
 
 namespace llvm {
 
-class Pass;
+class ModulePass;
 
-Pass *getMappingInfoAsmPrinterPass(std::ostream &out);
-Pass *createInternalGlobalMapperPass();
+ModulePass *getMappingInfoAsmPrinterPass(std::ostream &out);
+ModulePass *createInternalGlobalMapperPass();
 
 class MappingInfo {
   struct byteVector : public std::vector <unsigned char> {
index 187d984a47e2cd8dfab22560fa56a74554ca0b23..1f6599892c0558d75740a025896489a82ddf3afd 100644 (file)
@@ -28,7 +28,7 @@ namespace llvm {
 
 class LiveRange;
 class SparcV9TargetMachine;
-class Pass;
+class ModulePass;
 
 enum SparcV9InstrSchedClass {
   SPARC_NONE,          /* Instructions with no scheduling restrictions */
@@ -91,7 +91,7 @@ protected:
 /// createStackSlotsPass - External interface to stack-slots pass that enters 2
 /// empty slots at the top of each function stack
 ///
-Pass *createStackSlotsPass(const TargetMachine &TM);
+FunctionPass *createStackSlotsPass(const TargetMachine &TM);
 
 /// Specializes LLVM code for a target machine.
 ///
@@ -111,7 +111,7 @@ FunctionPass* createPrologEpilogInsertionPass();
 
 /// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file.
 ///
-Pass* createBytecodeAsmPrinterPass(std::ostream &Out);
+ModulePass* createBytecodeAsmPrinterPass(std::ostream &Out);
 
 FunctionPass *createSparcV9MachineCodeDestructionPass();
 
index 90aca0d86456a9519b2bdcb6e9fd71ac25a7800e..554a476d50500a52b3fed160344a0d5075f7ac24 100644 (file)
@@ -46,7 +46,7 @@ namespace {
   };
 }
 
-Pass *llvm::createStackSlotsPass(const TargetMachine &Target) {
+FunctionPass *llvm::createStackSlotsPass(const TargetMachine &Target) {
   return new StackSlots(Target);
 }
 
index 7b5def4284d839caa1e40ba93b71e2bb610ebf19..85339bf9a706eaf181e7d45bd44ff1da55241fdf 100644 (file)
@@ -75,7 +75,7 @@ namespace {
                               "Promote 'by reference' arguments to scalars");
 }
 
-Pass *llvm::createArgumentPromotionPass() {
+ModulePass *llvm::createArgumentPromotionPass() {
   return new ArgPromotion();
 }
 
index 9f3c10959cc480e96b1506c3d52d8a5a25c13506..27e1955ab284a7752790067d93ada23a4703b5c6 100644 (file)
@@ -26,19 +26,19 @@ using namespace llvm;
 namespace {
   Statistic<> NumMerged("constmerge", "Number of global constants merged");
 
-  struct ConstantMerge : public Pass {
+  struct ConstantMerge : public ModulePass {
     // run - For this pass, process all of the globals in the module,
     // eliminating duplicate constants.
     //
-    bool run(Module &M);
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<ConstantMerge> X("constmerge","Merge Duplicate Global Constants");
 }
 
-Pass *llvm::createConstantMergePass() { return new ConstantMerge(); }
+ModulePass *llvm::createConstantMergePass() { return new ConstantMerge(); }
 
-bool ConstantMerge::run(Module &M) {
+bool ConstantMerge::runOnModule(Module &M) {
   std::map<Constant*, GlobalVariable*> CMap;
 
   // Replacements - This vector contains a list of replacements to perform.
index cde186c38d8ca06a2dad04f7f3dfd2f81c55f547..e4b7a3ee6120137b792709c12e0abade6efdc73c 100644 (file)
@@ -38,7 +38,7 @@ namespace {
 
   /// DAE - The dead argument elimination pass.
   ///
-  class DAE : public Pass {
+  class DAE : public ModulePass {
     /// Liveness enum - During our initial pass over the program, we determine
     /// that things are either definately alive, definately dead, or in need of
     /// interprocedural analysis (MaybeLive).
@@ -75,7 +75,7 @@ namespace {
     std::multimap<Function*, CallSite> CallSites;
 
   public:
-    bool run(Module &M);
+    bool runOnModule(Module &M);
 
     virtual bool ShouldHackArguments() const { return false; }
 
@@ -106,8 +106,8 @@ namespace {
 /// createDeadArgEliminationPass - This pass removes arguments from functions
 /// which are not used by the body of the function.
 ///
-Pass *llvm::createDeadArgEliminationPass() { return new DAE(); }
-Pass *llvm::createDeadArgHackingPass() { return new DAH(); }
+ModulePass *llvm::createDeadArgEliminationPass() { return new DAE(); }
+ModulePass *llvm::createDeadArgHackingPass() { return new DAH(); }
 
 static inline bool CallPassesValueThoughVararg(Instruction *Call,
                                                const Value *Arg) {
@@ -484,7 +484,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
   F->getParent()->getFunctionList().erase(F);
 }
 
-bool DAE::run(Module &M) {
+bool DAE::runOnModule(Module &M) {
   // First phase: loop through the module, determining which arguments are live.
   // We assume all arguments are dead unless proven otherwise (allowing us to
   // determine that dead arguments passed into recursive functions are dead).
index e2d475daf9fe79cc585fbbb76d2a88d31dd4053c..9b1a919465c508bb0c96d149e635de0d75745ded 100644 (file)
 using namespace llvm;
 
 namespace {
-  struct DTE : public Pass {
+  struct DTE : public ModulePass {
     // doPassInitialization - For this pass, it removes global symbol table
     // entries for primitive types.  These are never used for linking in GCC and
     // they make the output uglier to look at, so we nuke them.
     //
     // Also, initialize instance variables.
     //
-    bool run(Module &M);
+    bool runOnModule(Module &M);
 
     // getAnalysisUsage - This function needs FindUsedTypes to do its job...
     //
@@ -41,7 +41,7 @@ namespace {
   NumKilled("deadtypeelim", "Number of unused typenames removed from symtab");
 }
 
-Pass *llvm::createDeadTypeEliminationPass() {
+ModulePass *llvm::createDeadTypeEliminationPass() {
   return new DTE();
 }
 
@@ -65,7 +65,7 @@ static inline bool ShouldNukeSymtabEntry(const Type *Ty){
 // uglier to look at, so we nuke them.  Also eliminate types that are never used
 // in the entire program as indicated by FindUsedTypes.
 //
-bool DTE::run(Module &M) {
+bool DTE::runOnModule(Module &M) {
   bool Changed = false;
 
   SymbolTable &ST = M.getSymbolTable();
index 41b796035b26165f6b1809b6ea636e258a17bf30..1b92fd1df8de9c0cf80c3af0e1a038bef81f18a3 100644 (file)
@@ -17,7 +17,7 @@
 using namespace llvm;
 
 namespace {
-  class FunctionExtractorPass : public Pass {
+  class FunctionExtractorPass : public ModulePass {
     Function *Named;
     bool deleteFunc;
   public:
@@ -28,7 +28,7 @@ namespace {
     FunctionExtractorPass(Function *F = 0, bool deleteFn = true) 
       : Named(F), deleteFunc(deleteFn) {}
 
-    bool run(Module &M) {
+    bool runOnModule(Module &M) {
       if (Named == 0) {
         Named = M.getMainFunction();
         if (Named == 0) return false;  // No function to extract
@@ -112,6 +112,6 @@ namespace {
   RegisterPass<FunctionExtractorPass> X("extract", "Function Extractor");
 }
 
-Pass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) {
+ModulePass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) {
   return new FunctionExtractorPass(F, deleteFn);
 }
index 006d33cf519249a3f13f95923ab3a58e77be082e..34506621813866a485ce8ef739486ac9d0409f1c 100644 (file)
@@ -35,17 +35,17 @@ namespace {
   Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved");
   Statistic<> NumGlobals("funcresolve", "Number of global variables resolved");
 
-  struct FunctionResolvingPass : public Pass {
+  struct FunctionResolvingPass : public ModulePass {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
     }
 
-    bool run(Module &M);
+    bool runOnModule(Module &M);
   };
   RegisterOpt<FunctionResolvingPass> X("funcresolve", "Resolve Functions");
 }
 
-Pass *llvm::createFunctionResolvingPass() {
+ModulePass *llvm::createFunctionResolvingPass() {
   return new FunctionResolvingPass();
 }
 
@@ -293,7 +293,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
   return false;
 }
 
-bool FunctionResolvingPass::run(Module &M) {
+bool FunctionResolvingPass::runOnModule(Module &M) {
   std::map<std::string, std::vector<GlobalValue*> > Globals;
 
   // Loop over the globals, adding them to the Globals map.  We use a two pass
index ea5201cd232b043a1ccacf5499b28dc6b09a2658..cdf994aeb48226fb25e576f99efd5c6fb2bd0052 100644 (file)
@@ -27,11 +27,11 @@ namespace {
   Statistic<> NumFunctions("globaldce","Number of functions removed");
   Statistic<> NumVariables("globaldce","Number of global variables removed");
 
-  struct GlobalDCE : public Pass {
+  struct GlobalDCE : public ModulePass {
     // run - Do the GlobalDCE pass on the specified module, optionally updating
     // the specified callgraph to reflect the changes.
     //
-    bool run(Module &M);
+    bool runOnModule(Module &M);
 
   private:
     std::set<GlobalValue*> AliveGlobals;
@@ -47,9 +47,9 @@ namespace {
   RegisterOpt<GlobalDCE> X("globaldce", "Dead Global Elimination");
 }
 
-Pass *llvm::createGlobalDCEPass() { return new GlobalDCE(); }
+ModulePass *llvm::createGlobalDCEPass() { return new GlobalDCE(); }
 
-bool GlobalDCE::run(Module &M) {
+bool GlobalDCE::runOnModule(Module &M) {
   bool Changed = false;
   // Loop over the module, adding globals which are obviously necessary.
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
index dd9894cd19f30bfdb83b405e3ccd65f8bb53ad76..f37be86e1e708d2ef69fba27c065e81af60e674e 100644 (file)
@@ -31,14 +31,14 @@ using namespace llvm;
 namespace {
   Statistic<> NumMarked("constify", "Number of globals marked constant");
 
-  struct Constifier : public Pass {
-    bool run(Module &M);
+  struct Constifier : public ModulePass {
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<Constifier> X("constify", "Global Constifier");
 }
 
-Pass *llvm::createGlobalConstifierPass() { return new Constifier(); }
+ModulePass *llvm::createGlobalConstifierPass() { return new Constifier(); }
 
 /// A lot of global constants are stored only in trivially dead setter
 /// functions.  Because we don't want to cycle between globaldce and this pass,
@@ -81,7 +81,7 @@ static bool isStoredThrough(Value *V, std::set<PHINode*> &PHIUsers) {
   return false;
 }
 
-bool Constifier::run(Module &M) {
+bool Constifier::runOnModule(Module &M) {
   bool Changed = false;
   std::set<PHINode*> PHIUsers;
   for (Module::giterator GV = M.gbegin(), E = M.gend(); GV != E; ++GV)
index 74a0a9b699eacd9f54ea20a2af8205edd5710411..64d1df8354abe0bc58a573924d24ef5204a79ce8 100644 (file)
@@ -29,17 +29,17 @@ namespace {
 
   /// IPCP - The interprocedural constant propagation pass
   ///
-  struct IPCP : public Pass {
-    bool run(Module &M);
+  struct IPCP : public ModulePass {
+    bool runOnModule(Module &M);
   private:
     bool processFunction(Function &F);
   };
   RegisterOpt<IPCP> X("ipconstprop", "Interprocedural constant propagation");
 }
 
-Pass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
+ModulePass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
 
-bool IPCP::run(Module &M) {
+bool IPCP::runOnModule(Module &M) {
   bool Changed = false;
   bool LocalChange = true;
 
index 1722fe52e0099563108f19b50aa63c4edc1b88c7..6a43143d87b8657742f893c17081a8e556b6fdac 100644 (file)
@@ -66,7 +66,7 @@ namespace {
   RegisterOpt<SimpleInliner> X("inline", "Function Integration/Inlining");
 }
 
-Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
+ModulePass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
 
 // CountCodeReductionForConstant - Figure out an approximation for how many
 // instructions will be constant folded if the specified value is constant.
index c6b75b1be921e1e18dcf57e1b922052bfd3eb604..5e436aa215900fb01e48b894712bc694bdfe0171 100644 (file)
@@ -39,7 +39,7 @@ namespace {
           cl::desc("A list of symbol names to preserve"),
           cl::CommaSeparated);
  
-  class InternalizePass : public Pass {
+  class InternalizePass : public ModulePass {
     std::set<std::string> ExternalNames;
   public:
     InternalizePass() {
@@ -65,7 +65,7 @@ namespace {
       }
     }
 
-    virtual bool run(Module &M) {
+    virtual bool runOnModule(Module &M) {
       // If no list or file of symbols was specified, check to see if there is a
       // "main" symbol defined in the module.  If so, use it, otherwise do not
       // internalize the module, it must be a library or something.
@@ -117,6 +117,6 @@ namespace {
   RegisterOpt<InternalizePass> X("internalize", "Internalize Global Symbols");
 } // end anonymous namespace
 
-Pass *llvm::createInternalizePass() {
+ModulePass *llvm::createInternalizePass() {
   return new InternalizePass();
 }
index e1ce290526c89c47647b9987d8939a85a3d1e72b..1bdb5c272a65347e3e5c4ab0d76ae436765ce0e3 100644 (file)
@@ -126,7 +126,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
 // createSingleLoopExtractorPass - This pass extracts one natural loop from the
 // program into a function if it can.  This is used by bugpoint.
 //
-Pass *llvm::createSingleLoopExtractorPass() {
+ModulePass *llvm::createSingleLoopExtractorPass() {
   return new SingleLoopExtractor();
 }
 
@@ -135,13 +135,13 @@ namespace {
   /// BlockExtractorPass - This pass is used by bugpoint to extract all blocks
   /// from the module into their own functions except for those specified by the
   /// BlocksToNotExtract list.
-  class BlockExtractorPass : public Pass {
+  class BlockExtractorPass : public ModulePass {
     std::vector<BasicBlock*> BlocksToNotExtract;
   public:
     BlockExtractorPass(std::vector<BasicBlock*> &B) : BlocksToNotExtract(B) {}
     BlockExtractorPass() {}
 
-    bool run(Module &M);
+    bool runOnModule(Module &M);
   };
   RegisterOpt<BlockExtractorPass>
   XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
@@ -150,11 +150,11 @@ namespace {
 // createBlockExtractorPass - This pass extracts all blocks (except those
 // specified in the argument list) from the functions in the module.
 //
-Pass *llvm::createBlockExtractorPass(std::vector<BasicBlock*> &BTNE) {
+ModulePass *llvm::createBlockExtractorPass(std::vector<BasicBlock*> &BTNE) {
   return new BlockExtractorPass(BTNE);
 }
 
-bool BlockExtractorPass::run(Module &M) {
+bool BlockExtractorPass::runOnModule(Module &M) {
   std::set<BasicBlock*> TranslatedBlocksToNotExtract;
   for (unsigned i = 0, e = BlocksToNotExtract.size(); i != e; ++i) {
     BasicBlock *BB = BlocksToNotExtract[i];
index ebd0500cba526317cd7e1cd832e4908d1091409d..4ad89b583c91bf9ea839693e086e0c2830efd772 100644 (file)
@@ -64,7 +64,7 @@ namespace {
   // class because it works on a module as a whole, not a function at a
   // time.
 
-  class LowerSetJmp : public Pass,
+  class LowerSetJmp : public ModulePass,
                       public InstVisitor<LowerSetJmp> {
     // LLVM library functions...
     Function* InitSJMap;        // __llvm_sjljeh_init_setjmpmap
@@ -119,7 +119,7 @@ namespace {
     void visitReturnInst(ReturnInst& RI);
     void visitUnwindInst(UnwindInst& UI);
 
-    bool run(Module& M);
+    bool runOnModule(Module& M);
     bool doInitialization(Module& M);
   };
 
@@ -129,8 +129,7 @@ namespace {
 // run - Run the transformation on the program. We grab the function
 // prototypes for longjmp and setjmp. If they are used in the program,
 // then we can go directly to the places they're at and transform them.
-bool LowerSetJmp::run(Module& M)
-{
+bool LowerSetJmp::runOnModule(Module& M) {
   bool Changed = false;
 
   // These are what the functions are called.
@@ -509,8 +508,7 @@ void LowerSetJmp::visitInvokeInst(InvokeInst& II)
 
 // visitReturnInst - We want to destroy the setjmp map upon exit from the
 // function.
-void LowerSetJmp::visitReturnInst(ReturnInst& RI)
-{
+void LowerSetJmp::visitReturnInst(ReturnInst &RI) {
   Function* Func = RI.getParent()->getParent();
   new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
                "", &RI);
@@ -518,15 +516,13 @@ void LowerSetJmp::visitReturnInst(ReturnInst& RI)
 
 // visitUnwindInst - We want to destroy the setjmp map upon exit from the
 // function.
-void LowerSetJmp::visitUnwindInst(UnwindInst& UI)
-{
+void LowerSetJmp::visitUnwindInst(UnwindInst &UI) {
   Function* Func = UI.getParent()->getParent();
   new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
                "", &UI);
 }
 
-Pass* llvm::createLowerSetJmpPass()
-{
+ModulePass *llvm::createLowerSetJmpPass() {
   return new LowerSetJmp();
 }
 
index 43b9acff731cc86f15e6cf0d188b86ff49f43577..36423c8e3e91c39d1ab5772577846ed7215b1e38 100644 (file)
@@ -38,7 +38,7 @@ namespace {
   RegisterOpt<PruneEH> X("prune-eh", "Remove unused exception handling info");
 }
 
-Pass *llvm::createPruneEHPass() { return new PruneEH(); }
+ModulePass *llvm::createPruneEHPass() { return new PruneEH(); }
 
 
 bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
index 42edb7e05de31fdf3d4ca4bad9e448afe4e0859d..d91d23fd188775bcaf8969cebecb5f03731a01c0 100644 (file)
@@ -28,7 +28,7 @@ namespace {
   // RaiseAllocations - Turn %malloc and %free calls into the appropriate
   // instruction.
   //
-  class RaiseAllocations : public Pass {
+  class RaiseAllocations : public ModulePass {
     Function *MallocFunc;   // Functions in the module we are processing
     Function *FreeFunc;     // Initialized by doPassInitializationVirt
   public:
@@ -41,7 +41,7 @@ namespace {
     
     // run - This method does the actual work of converting instructions over.
     //
-    bool run(Module &M);
+    bool runOnModule(Module &M);
   };
   
   RegisterOpt<RaiseAllocations>
@@ -50,7 +50,7 @@ namespace {
 
 
 // createRaiseAllocationsPass - The interface to this file...
-Pass *llvm::createRaiseAllocationsPass() {
+ModulePass *llvm::createRaiseAllocationsPass() {
   return new RaiseAllocations();
 }
 
@@ -114,7 +114,7 @@ void RaiseAllocations::doInitialization(Module &M) {
 
 // run - Transform calls into instructions...
 //
-bool RaiseAllocations::run(Module &M) {
+bool RaiseAllocations::runOnModule(Module &M) {
   // Find the malloc/free prototypes...
   doInitialization(M);
 
index e357e841cdc7005c478c789b13a8b7d0c323349a..f22f81feeff5d32c23ed57606f65e84646ee5ae0 100644 (file)
 using namespace llvm;
 
 namespace {
-  class FunctionProfiler : public Pass {
-    bool run(Module &M);
+  class FunctionProfiler : public ModulePass {
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<FunctionProfiler> X("insert-function-profiling",
                                "Insert instrumentation for function profiling");
 }
 
-bool FunctionProfiler::run(Module &M) {
+bool FunctionProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
     std::cerr << "WARNING: cannot insert function profiling into a module"
@@ -69,15 +69,15 @@ bool FunctionProfiler::run(Module &M) {
 
 
 namespace {
-  class BlockProfiler : public Pass {
-    bool run(Module &M);
+  class BlockProfiler : public ModulePass {
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<BlockProfiler> Y("insert-block-profiling",
                                "Insert instrumentation for block profiling");
 }
 
-bool BlockProfiler::run(Module &M) {
+bool BlockProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
     std::cerr << "WARNING: cannot insert block profiling into a module"
index c584ca5dfe3b0ac6d060930b1721e1dcd473cae0..89c540c5bcd2b5f6cb500017a5aaa795939224de 100644 (file)
 using namespace llvm;
 
 namespace {
-  class EdgeProfiler : public Pass {
-    bool run(Module &M);
+  class EdgeProfiler : public ModulePass {
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<EdgeProfiler> X("insert-edge-profiling",
                               "Insert instrumentation for edge profiling");
 }
 
-bool EdgeProfiler::run(Module &M) {
+bool EdgeProfiler::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
     std::cerr << "WARNING: cannot insert edge profiling into a module"
index a1c23dab23837e46c630c7969344ff8f78b63b44..92abffb8ead090183c7ee907abb1a8260090643c 100644 (file)
@@ -27,8 +27,8 @@ namespace {
     BLACK
   };
   
-  struct EmitFunctionTable : public Pass {
-    bool run(Module &M);
+  struct EmitFunctionTable : public ModulePass {
+    bool runOnModule(Module &M);
   };
   
   RegisterOpt<EmitFunctionTable>
@@ -64,7 +64,7 @@ static char hasBackEdge(Function *F){
 }
 
 // Per Module pass for inserting function table
-bool EmitFunctionTable::run(Module &M){
+bool EmitFunctionTable::runOnModule(Module &M){
   std::vector<const Type*> vType;
  
   std::vector<Constant *> vConsts;
index 60426c4e5af377541a8f7291389724d31c122b76..746e82221ad157d8888a231e14d5dc7aa61f0a7d 100644 (file)
@@ -25,8 +25,8 @@
 using namespace llvm;
 
 namespace {
-  class TraceBasicBlocks : public Pass {
-    bool run(Module &M);
+  class TraceBasicBlocks : public ModulePass {
+    bool runOnModule(Module &M);
   };
 
   RegisterOpt<TraceBasicBlocks> X("trace-basic-blocks",
@@ -52,7 +52,7 @@ static void InsertInstrumentationCall (BasicBlock *BB,
   Instruction *InstrCall = new CallInst (InstrFn, Args, "", InsertPos);
 }
 
-bool TraceBasicBlocks::run(Module &M) {
+bool TraceBasicBlocks::runOnModule(Module &M) {
   Function *Main = M.getMainFunction();
   if (Main == 0) {
     std::cerr << "WARNING: cannot insert basic-block trace instrumentation"
index 95e0f563c947bc3ca2c79a17dd06c0a5f65741ad..1d8267fe4e71cea48b73debcc1a3b767cd03b830 100644 (file)
@@ -726,9 +726,9 @@ template<> struct PassManagerTraits<Function> : public FunctionPass {
 //
 // This is the top level PassManager implementation that holds generic passes.
 //
-template<> struct PassManagerTraits<Module> : public Pass {
+template<> struct PassManagerTraits<Module> : public ModulePass {
   // PassClass - The type of passes tracked by this PassManager
-  typedef Pass PassClass;
+  typedef ModulePass PassClass;
 
   // SubPassClass - The types of classes that should be collated together
   typedef FunctionPass SubPassClass;
@@ -740,15 +740,15 @@ template<> struct PassManagerTraits<Module> : public Pass {
   typedef AnalysisResolver ParentClass;
 
   // runPass - Specify how the pass should be run on the UnitType
-  static bool runPass(PassClass *P, Module *M) { return P->run(*M); }
+  static bool runPass(PassClass *P, Module *M) { return P->runOnModule(*M); }
 
   // getPMName() - Return the name of the unit the PassManager operates on for
   // debugging.
   const char *getPMName() const { return "Module"; }
   virtual const char *getPassName() const { return "Module Pass Manager"; }
 
-  // run - Implement the PassManager interface...
-  bool run(Module &M) {
+  // runOnModule - Implement the PassManager interface.
+  bool runOnModule(Module &M) {
     return ((PassManagerT<Module>*)this)->runOnUnit(&M);
   }
 };
index a0520d4a4ac991d83f7eab1b3d7229e429e83c0f..46ede0a15342c21dbe08d71f55b80b31f32e9e24 100644 (file)
@@ -28,8 +28,8 @@ namespace {
   /// external functions that are called with constant arguments.  This can be
   /// useful when looking for standard library functions we should constant fold
   /// or handle in alias analyses.
-  struct ExternalFunctionsPassedConstants : public Pass {
-    virtual bool run(Module &M) {
+  struct ExternalFunctionsPassedConstants : public ModulePass {
+    virtual bool runOnModule(Module &M) {
       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
         if (I->isExternal()) {
           bool PrintedFn = false;
index 1176a8df109db62ac28dfae0f484e41d9b40ada7..9fd09c94fd14ab7003341b4606333b3c2d2b76ed 100644 (file)
@@ -58,8 +58,8 @@ namespace llvm {
 
 
 namespace {
-  struct CallGraphPrinter : public Pass {
-    virtual bool run(Module &M) {
+  struct CallGraphPrinter : public ModulePass {
+    virtual bool runOnModule(Module &M) {
       WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>());
       return false;
     }
index 1542a1a068a17f7a8d2921c8e1b75501439030a4..5a0c9508f6b31cb46d4980d4d751ef21656723e9 100644 (file)
 
 using namespace llvm;
 
-struct ModulePassPrinter : public Pass {
+struct ModulePassPrinter : public ModulePass {
   const PassInfo *PassToPrint;
   ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
 
-  virtual bool run(Module &M) {
+  virtual bool runOnModule(Module &M) {
     std::cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
     getAnalysisID<Pass>(PassToPrint).print(std::cout, &M);
     
index cf02ef73a959dc5e46fa33d8d8e8ca8f32af064e..d65736a1ead29d18f574765607b4b21615c59df8 100644 (file)
@@ -211,14 +211,14 @@ namespace {
   /// BlockExtractorPass - This pass is used by bugpoint to extract all blocks
   /// from the module into their own functions except for those specified by the
   /// BlocksToNotExtract list.
-  class BlockExtractorPass : public Pass {
-    bool run(Module &M);
+  class BlockExtractorPass : public ModulePass {
+    bool runOnModule(Module &M);
   };
   RegisterOpt<BlockExtractorPass>
   XX("extract-bbs", "Extract Basic Blocks From Module (for bugpoint use)");
 }
 
-bool BlockExtractorPass::run(Module &M) {
+bool BlockExtractorPass::runOnModule(Module &M) {
   std::set<BasicBlock*> TranslatedBlocksToNotExtract;
   for (unsigned i = 0, e = BlocksToNotExtract.size(); i != e; ++i) {
     BasicBlock *BB = BlocksToNotExtract[i];
index a0520d4a4ac991d83f7eab1b3d7229e429e83c0f..46ede0a15342c21dbe08d71f55b80b31f32e9e24 100644 (file)
@@ -28,8 +28,8 @@ namespace {
   /// external functions that are called with constant arguments.  This can be
   /// useful when looking for standard library functions we should constant fold
   /// or handle in alias analyses.
-  struct ExternalFunctionsPassedConstants : public Pass {
-    virtual bool run(Module &M) {
+  struct ExternalFunctionsPassedConstants : public ModulePass {
+    virtual bool runOnModule(Module &M) {
       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
         if (I->isExternal()) {
           bool PrintedFn = false;
index 1176a8df109db62ac28dfae0f484e41d9b40ada7..9fd09c94fd14ab7003341b4606333b3c2d2b76ed 100644 (file)
@@ -58,8 +58,8 @@ namespace llvm {
 
 
 namespace {
-  struct CallGraphPrinter : public Pass {
-    virtual bool run(Module &M) {
+  struct CallGraphPrinter : public ModulePass {
+    virtual bool runOnModule(Module &M) {
       WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>());
       return false;
     }