The TargetData is not used for the isPowerOfTwo determination. It has never
[oota-llvm.git] / include / llvm / PassManagers.h
index 3acbf0e2c07484ec7c0b25ae64cfa1b085204be7..fac792824fc41c30304b66682102c38fbf5a90dc 100644 (file)
 #ifndef LLVM_PASSMANAGERS_H
 #define LLVM_PASSMANAGERS_H
 
-#include "llvm/Pass.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/DenseMap.h"
-#include <vector>
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Pass.h"
 #include <map>
+#include <vector>
 
 //===----------------------------------------------------------------------===//
 // Overview:
@@ -168,7 +168,7 @@ class PMTopLevelManager {
 protected:
   explicit PMTopLevelManager(PMDataManager *PMDM);
 
-  virtual unsigned getNumContainedManagers() const {
+  unsigned getNumContainedManagers() const {
     return (unsigned)PassManagers.size();
   }
 
@@ -263,7 +263,7 @@ private:
 class PMDataManager {
 public:
 
-  explicit PMDataManager() : TPM(NULL), PassVectorSize(0), Depth(0) {
+  explicit PMDataManager() : TPM(NULL), Depth(0) {
     initializeAnalysisInfo();
   }
 
@@ -343,8 +343,8 @@ public:
   void dumpRequiredSet(const Pass *P) const;
   void dumpPreservedSet(const Pass *P) const;
 
-  virtual unsigned getNumContainedPasses() const {
-    return PassVectorSize;
+  unsigned getNumContainedPasses() const {
+    return (unsigned)PassVector.size();
   }
 
   virtual PassManagerType getPassManagerType() const {
@@ -369,16 +369,14 @@ protected:
   // Top level manager.
   PMTopLevelManager *TPM;
 
+  // Collection of pass that are managed by this manager
+  SmallVector<Pass *, 16> PassVector;
+
   // Collection of Analysis provided by Parent pass manager and
   // used by current pass manager. At at time there can not be more
   // then PMT_Last active pass mangers.
   std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
 
-  // Collection of pass that are managed by this manager
-  SmallVector<Pass *, 16> PassVector;
-
-  // Cache the size of PassVector
-  unsigned PassVectorSize;
 
   /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
   /// or higher is specified.
@@ -422,10 +420,20 @@ public:
   /// cleanup - After running all passes, clean up pass manager cache.
   void cleanup();
 
+  /// doInitialization - Overrides ModulePass doInitialization for global
+  /// initialization tasks
+  ///
+  using ModulePass::doInitialization;
+
   /// doInitialization - Run all of the initializers for the function passes.
   ///
   bool doInitialization(Module &M);
 
+  /// doFinalization - Overrides ModulePass doFinalization for global
+  /// finalization tasks
+  /// 
+  using ModulePass::doFinalization;
+  
   /// doFinalization - Run all of the finalizers for the function passes.
   ///
   bool doFinalization(Module &M);
@@ -446,7 +454,7 @@ public:
   }
 
   FunctionPass *getContainedPass(unsigned N) {
-    assert ( N < PassVectorSize && "Pass number out of range!");
+    assert ( N < PassVector.size() && "Pass number out of range!");
     FunctionPass *FP = static_cast<FunctionPass *>(PassVector[N]);
     return FP;
   }