Make the release build work
[oota-llvm.git] / lib / VMCore / Pass.cpp
index a139a25e4d6fa7ca1ef7ea2ee5d0e955eb9a8e4b..9596f5234e26594ed68d870b3383b4b6fbb9b2c4 100644 (file)
@@ -8,7 +8,8 @@
 
 #include "llvm/PassManager.h"
 #include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
+#include "llvm/BasicBlock.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 
@@ -26,7 +27,6 @@ void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) {
 // debugging on, a command line option (--debug-pass) is enabled that causes the
 // pass name to be printed before it executes.
 //
-#ifndef NDEBUG
 #include "Support/CommandLine.h"
 #include <typeinfo>
 #include <iostream>
@@ -51,15 +51,15 @@ void PMDebug::PrintPassStructure(Pass *P) {
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
                                    Pass *P, Value *V) {
   if (PassDebugging >= PassExecutions) {
-    std::cerr << std::string(Depth*2, ' ') << Action << " '" 
+    std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" 
               << typeid(*P).name();
     if (V) {
       std::cerr << "' on ";
       switch (V->getValueType()) {
       case Value::ModuleVal:
         std::cerr << "Module\n"; return;
-      case Value::MethodVal:
-        std::cerr << "Method '" << V->getName(); break;
+      case Value::FunctionVal:
+        std::cerr << "Function '" << V->getName(); break;
       case Value::BasicBlockVal:
         std::cerr << "BasicBlock '" << V->getName(); break;
       default:
@@ -71,9 +71,9 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
 }
 
 void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
-                                   const Pass::AnalysisSet &Set) {
+                                   Pass *P, const Pass::AnalysisSet &Set) {
   if (PassDebugging >= PassDetails && !Set.empty()) {
-    std::cerr << std::string(Depth*2+2, ' ') << Msg << " Analyses:";
+    std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
     for (unsigned i = 0; i < Set.size(); ++i) {
       Pass *P = Set[i].createPass();   // Good thing this is just debug code...
       std::cerr << "  " << typeid(*P).name();
@@ -87,16 +87,15 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
 void Pass::dumpPassStructure(unsigned Offset = 0) {
   std::cerr << std::string(Offset*2, ' ') << typeid(*this).name() << "\n";
 }
-#endif
 
 
 //===----------------------------------------------------------------------===//
 // Pass Implementation
 //
 
-void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Destroyed,
-                            AnalysisSet &Provided) {
-  PM->addPass(this, Destroyed, Provided);
+void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Required,
+                            AnalysisSet &Destroyed, AnalysisSet &Provided) {
+  PM->addPass(this, Required, Destroyed, Provided);
 }
 
 //===----------------------------------------------------------------------===//
@@ -118,23 +117,23 @@ bool MethodPass::run(Module *M) {
 
 // run - On a method, we simply initialize, run the method, then finalize.
 //
-bool MethodPass::run(Method *M) {
-  if (M->isExternal()) return false;  // Passes are not run on external methods!
+bool MethodPass::run(Function *F) {
+  if (F->isExternal()) return false;  // Passes are not run on external methods!
 
-  return doInitialization(M->getParent()) | runOnMethod(M)
-       | doFinalization(M->getParent());
+  return doInitialization(F->getParent()) | runOnMethod(F)
+       | doFinalization(F->getParent());
 }
 
 void MethodPass::addToPassManager(PassManagerT<Module> *PM,
-                                  AnalysisSet &Destroyed,
+                                  AnalysisSet &Required, AnalysisSet &Destroyed,
                                   AnalysisSet &Provided) {
-  PM->addPass(this, Destroyed, Provided);
+  PM->addPass(this, Required, Destroyed, Provided);
 }
 
-void MethodPass::addToPassManager(PassManagerT<Method> *PM,
-                                  AnalysisSet &Destroyed,
+void MethodPass::addToPassManager(PassManagerT<Function> *PM,
+                                  AnalysisSet &Required, AnalysisSet &Destroyed,
                                   AnalysisSet &Provided) {
-  PM->addPass(this, Destroyed, Provided);
+  PM->addPass(this, Required, Destroyed, Provided);
 }
 
 //===----------------------------------------------------------------------===//
@@ -144,9 +143,9 @@ void MethodPass::addToPassManager(PassManagerT<Method> *PM,
 // To run this pass on a method, we simply call runOnBasicBlock once for each
 // method.
 //
-bool BasicBlockPass::runOnMethod(Method *M) {
+bool BasicBlockPass::runOnMethod(Function *F) {
   bool Changed = false;
-  for (Method::iterator I = M->begin(), E = M->end(); I != E; ++I)
+  for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
     Changed |= runOnBasicBlock(*I);
   return Changed;
 }
@@ -159,15 +158,17 @@ bool BasicBlockPass::run(BasicBlock *BB) {
   return doInitialization(M) | runOnBasicBlock(BB) | doFinalization(M);
 }
 
-void BasicBlockPass::addToPassManager(PassManagerT<Method> *PM,
+void BasicBlockPass::addToPassManager(PassManagerT<Function> *PM,
+                                      AnalysisSet &Required,
                                       AnalysisSet &Destroyed,
                                       AnalysisSet &Provided) {
-  PM->addPass(this, Destroyed, Provided);
+  PM->addPass(this, Required, Destroyed, Provided);
 }
 
 void BasicBlockPass::addToPassManager(PassManagerT<BasicBlock> *PM,
+                                      AnalysisSet &Required,
                                       AnalysisSet &Destroyed,
                                       AnalysisSet &Provided) {
-  PM->addPass(this, Destroyed, Provided);
+  PM->addPass(this, Required, Destroyed, Provided);
 }