[llvm-commits] [llvm] r91319 - in /llvm/trunk: include/llvm/Pass.h lib/VMCore/Pass.cpp

Dan Gohman gohman at apple.com
Mon Dec 14 11:43:17 PST 2009


Author: djg
Date: Mon Dec 14 13:43:09 2009
New Revision: 91319

URL: http://llvm.org/viewvc/llvm-project?rev=91319&view=rev
Log:
Move several function bodies which are rarely inlined out of line.

Modified:
    llvm/trunk/include/llvm/Pass.h
    llvm/trunk/lib/VMCore/Pass.cpp

Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=91319&r1=91318&r2=91319&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Mon Dec 14 13:43:09 2009
@@ -111,12 +111,10 @@
   virtual void assignPassManager(PMStack &, 
                                  PassManagerType = PMT_Unknown) {}
   /// Check if available pass managers are suitable for this pass or not.
-  virtual void preparePassManager(PMStack &) {}
+  virtual void preparePassManager(PMStack &);
   
   ///  Return what kind of Pass Manager can manage this pass.
-  virtual PassManagerType getPotentialPassManagerType() const {
-    return PMT_Unknown; 
-  }
+  virtual PassManagerType getPotentialPassManagerType() const;
 
   // Access AnalysisResolver
   inline void setResolver(AnalysisResolver *AR) { 
@@ -132,9 +130,7 @@
   /// particular analysis result to this function, it can then use the
   /// getAnalysis<AnalysisType>() function, below.
   ///
-  virtual void getAnalysisUsage(AnalysisUsage &) const {
-    // By default, no analysis results are used, all are invalidated.
-  }
+  virtual void getAnalysisUsage(AnalysisUsage &) const;
 
   /// releaseMemory() - This member can be implemented by a pass if it wants to
   /// be able to release its memory when it is no longer needed.  The default
@@ -147,11 +143,11 @@
   /// Optionally implement this function to release pass memory when it is no
   /// longer used.
   ///
-  virtual void releaseMemory() {}
+  virtual void releaseMemory();
 
   /// verifyAnalysis() - This member can be implemented by a analysis pass to
   /// check state of analysis information. 
-  virtual void verifyAnalysis() const {}
+  virtual void verifyAnalysis() const;
 
   // dumpPassStructure - Implement the -debug-passes=PassStructure option
   virtual void dumpPassStructure(unsigned Offset = 0);
@@ -221,9 +217,7 @@
                                  PassManagerType T = PMT_ModulePassManager);
 
   ///  Return what kind of Pass Manager can manage this pass.
-  virtual PassManagerType getPotentialPassManagerType() const {
-    return PMT_ModulePassManager;
-  }
+  virtual PassManagerType getPotentialPassManagerType() const;
 
   explicit ModulePass(intptr_t pid) : Pass(pid) {}
   explicit ModulePass(const void *pid) : Pass(pid) {}
@@ -245,7 +239,7 @@
   /// and if it does, the overloaded version of initializePass may get access to
   /// these passes with getAnalysis<>.
   ///
-  virtual void initializePass() {}
+  virtual void initializePass();
 
   /// ImmutablePasses are never run.
   ///
@@ -276,7 +270,7 @@
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
-  virtual bool doInitialization(Module &) { return false; }
+  virtual bool doInitialization(Module &);
   
   /// runOnFunction - Virtual method overriden by subclasses to do the
   /// per-function processing of the pass.
@@ -286,7 +280,7 @@
   /// doFinalization - Virtual method overriden by subclasses to do any post
   /// processing needed after all passes have run.
   ///
-  virtual bool doFinalization(Module &) { return false; }
+  virtual bool doFinalization(Module &);
 
   /// runOnModule - On a module, we run this pass by initializing,
   /// ronOnFunction'ing once for every function in the module, then by
@@ -303,9 +297,7 @@
                                  PassManagerType T = PMT_FunctionPassManager);
 
   ///  Return what kind of Pass Manager can manage this pass.
-  virtual PassManagerType getPotentialPassManagerType() const {
-    return PMT_FunctionPassManager;
-  }
+  virtual PassManagerType getPotentialPassManagerType() const;
 };
 
 
@@ -328,12 +320,12 @@
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
-  virtual bool doInitialization(Module &) { return false; }
+  virtual bool doInitialization(Module &);
 
   /// doInitialization - Virtual method overridden by BasicBlockPass subclasses
   /// to do any necessary per-function initialization.
   ///
-  virtual bool doInitialization(Function &) { return false; }
+  virtual bool doInitialization(Function &);
 
   /// runOnBasicBlock - Virtual method overriden by subclasses to do the
   /// per-basicblock processing of the pass.
@@ -343,12 +335,12 @@
   /// doFinalization - Virtual method overriden by BasicBlockPass subclasses to
   /// do any post processing needed after all passes have run.
   ///
-  virtual bool doFinalization(Function &) { return false; }
+  virtual bool doFinalization(Function &);
 
   /// doFinalization - Virtual method overriden by subclasses to do any post
   /// processing needed after all passes have run.
   ///
-  virtual bool doFinalization(Module &) { return false; }
+  virtual bool doFinalization(Module &);
 
 
   // To run this pass on a function, we simply call runOnBasicBlock once for
@@ -360,9 +352,7 @@
                                  PassManagerType T = PMT_BasicBlockPassManager);
 
   ///  Return what kind of Pass Manager can manage this pass.
-  virtual PassManagerType getPotentialPassManagerType() const {
-    return PMT_BasicBlockPassManager; 
-  }
+  virtual PassManagerType getPotentialPassManagerType() const;
 };
 
 /// If the user specifies the -time-passes argument on an LLVM tool command line

Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=91319&r1=91318&r2=91319&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Mon Dec 14 13:43:09 2009
@@ -41,6 +41,10 @@
 // Force out-of-line virtual method.
 ModulePass::~ModulePass() { }
 
+PassManagerType ModulePass::getPotentialPassManagerType() const {
+  return PMT_ModulePassManager;
+}
+
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
   return Resolver->getAnalysisIfAvailable(AnalysisID, true) != 0;
 }
@@ -60,6 +64,27 @@
   return "Unnamed pass: implement Pass::getPassName()";
 }
 
+void Pass::preparePassManager(PMStack &) {
+  // By default, don't do anything.
+}
+
+PassManagerType Pass::getPotentialPassManagerType() const {
+  // Default implementation.
+  return PMT_Unknown; 
+}
+
+void Pass::getAnalysisUsage(AnalysisUsage &) const {
+  // By default, no analysis results are used, all are invalidated.
+}
+
+void Pass::releaseMemory() {
+  // By default, don't do anything.
+}
+
+void Pass::verifyAnalysis() const {
+  // By default, don't do anything.
+}
+
 // 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 necessary to
 // implement this method.
@@ -79,6 +104,10 @@
 // Force out-of-line virtual method.
 ImmutablePass::~ImmutablePass() { }
 
+void ImmutablePass::initializePass() {
+  // By default, don't do anything.
+}
+
 //===----------------------------------------------------------------------===//
 // FunctionPass Implementation
 //
@@ -107,6 +136,20 @@
   return Changed | doFinalization(*F.getParent());
 }
 
+bool FunctionPass::doInitialization(Module &) {
+  // By default, don't do anything.
+  return false;
+}
+
+bool FunctionPass::doFinalization(Module &) {
+  // By default, don't do anything.
+  return false;
+}
+
+PassManagerType FunctionPass::getPotentialPassManagerType() const {
+  return PMT_FunctionPassManager;
+}
+
 //===----------------------------------------------------------------------===//
 // BasicBlockPass Implementation
 //
@@ -121,6 +164,30 @@
   return Changed | doFinalization(F);
 }
 
+bool BasicBlockPass::doInitialization(Module &) {
+  // By default, don't do anything.
+  return false;
+}
+
+bool BasicBlockPass::doInitialization(Function &) {
+  // By default, don't do anything.
+  return false;
+}
+
+bool BasicBlockPass::doFinalization(Function &) {
+  // By default, don't do anything.
+  return false;
+}
+
+bool BasicBlockPass::doFinalization(Module &) {
+  // By default, don't do anything.
+  return false;
+}
+
+PassManagerType BasicBlockPass::getPotentialPassManagerType() const {
+  return PMT_BasicBlockPassManager; 
+}
+
 //===----------------------------------------------------------------------===//
 // Pass Registration mechanism
 //





More information about the llvm-commits mailing list