diff options
| author | Eric Christopher <echristo@apple.com> | 2010-04-01 22:54:42 +0000 | 
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2010-04-01 22:54:42 +0000 | 
| commit | 1d8f83d0a00e912c55ec0974eba6122666cc6fa1 (patch) | |
| tree | 5472afae0575df6c097d8e34f08a07b84ffcf916 /lib/VMCore | |
| parent | c8e77640a53823b233f3f7a5c2be12aef9ebc69e (diff) | |
| download | external_llvm-1d8f83d0a00e912c55ec0974eba6122666cc6fa1.zip external_llvm-1d8f83d0a00e912c55ec0974eba6122666cc6fa1.tar.gz external_llvm-1d8f83d0a00e912c55ec0974eba6122666cc6fa1.tar.bz2 | |
Revert r100143.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
| -rw-r--r-- | lib/VMCore/Pass.cpp | 18 | ||||
| -rw-r--r-- | lib/VMCore/PassManager.cpp | 83 | ||||
| -rw-r--r-- | lib/VMCore/PrintModulePass.cpp | 12 | 
3 files changed, 5 insertions, 108 deletions
| diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 6093750..a782e5a 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -18,7 +18,6 @@  #include "llvm/Module.h"  #include "llvm/ADT/STLExtras.h"  #include "llvm/ADT/StringMap.h" -#include "llvm/Assembly/PrintModulePass.h"  #include "llvm/Support/Debug.h"  #include "llvm/Support/ManagedStatic.h"  #include "llvm/Support/PassNameParser.h" @@ -43,11 +42,6 @@ Pass::~Pass() {  // Force out-of-line virtual method.  ModulePass::~ModulePass() { } -Pass *ModulePass::createPrinterPass(raw_ostream &O, -                                    const std::string &Banner) const { -  return createPrintModulePass(&O, false, Banner); -} -  PassManagerType ModulePass::getPotentialPassManagerType() const {    return PMT_ModulePassManager;  } @@ -119,11 +113,6 @@ void ImmutablePass::initializePass() {  // FunctionPass Implementation  // -Pass *FunctionPass::createPrinterPass(raw_ostream &O, -                                      const std::string &Banner) const { -  return createPrintFunctionPass(Banner, &O); -} -  // run - On a module, we run this pass by initializing, runOnFunction'ing once  // for every function in the module, then by finalizing.  // @@ -166,13 +155,6 @@ PassManagerType FunctionPass::getPotentialPassManagerType() const {  // BasicBlockPass Implementation  // -Pass *BasicBlockPass::createPrinterPass(raw_ostream &O, -                                        const std::string &Banner) const { -   -  llvm_unreachable("BasicBlockPass printing unsupported."); -  return 0; -} -  // To run this pass on a function, we simply call runOnBasicBlock once for each  // function.  // diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 6ca35ac0..6774cec 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -13,7 +13,6 @@  #include "llvm/PassManagers.h" -#include "llvm/Assembly/PrintModulePass.h"  #include "llvm/Assembly/Writer.h"  #include "llvm/Support/CommandLine.h"  #include "llvm/Support/Debug.h" @@ -21,7 +20,6 @@  #include "llvm/Module.h"  #include "llvm/Support/ErrorHandling.h"  #include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/PassNameParser.h"  #include "llvm/Support/raw_ostream.h"  #include "llvm/System/Mutex.h"  #include "llvm/System/Threading.h" @@ -57,57 +55,6 @@ PassDebugging("debug-pass", cl::Hidden,    clEnumVal(Executions, "print pass name before it is executed"),    clEnumVal(Details   , "print pass details when it is executed"),                               clEnumValEnd)); - -typedef llvm::cl::list<const llvm::PassInfo *, bool, PassNameParser> -PassOptionList; - -// Print IR out before/after specified passes. -static PassOptionList -PrintBefore("print-before", -            llvm::cl::desc("Print IR before specified passes")); - -static PassOptionList -PrintAfter("print-after", -           llvm::cl::desc("Print IR after specified passes")); - -static cl::opt<bool> -PrintBeforeAll("print-before-all", -               llvm::cl::desc("Print IR before each pass"), -               cl::init(false)); -static cl::opt<bool> -PrintAfterAll("print-after-all", -              llvm::cl::desc("Print IR after each pass"), -              cl::init(false)); - -/// This is a helper to determine whether to print IR before or -/// after a pass. - -static bool ShouldPrintBeforeOrAfterPass(Pass *P, -                                         PassOptionList &PassesToPrint) { -  for (unsigned i = 0, ie = PassesToPrint.size(); i < ie; ++i) { -    const llvm::PassInfo *PassInf = PassesToPrint[i]; -    if (PassInf && P->getPassInfo()) -      if (PassInf->getPassArgument() == -          P->getPassInfo()->getPassArgument()) { -        return true; -      } -  } -  return false; -} -   - -/// This is a utility to check whether a pass should have IR dumped -/// before it. -static bool ShouldPrintBeforePass(Pass *P) { -  return PrintBeforeAll || ShouldPrintBeforeOrAfterPass(P, PrintBefore); -} - -/// This is a utility to check whether a pass should have IR dumped -/// after it. -static bool ShouldPrintAfterPass(Pass *P) { -  return PrintAfterAll || ShouldPrintBeforeOrAfterPass(P, PrintAfter); -} -  } // End of llvm namespace  /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions @@ -235,11 +182,6 @@ public:      schedulePass(P);    } -  /// createPrinterPass - Get a function printer pass.  -  Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { -    return createPrintFunctionPass(Banner, &O); -  } -    // Prepare for running an on the fly pass, freeing memory if needed    // from a previous run.    void releaseMemoryOnTheFly(); @@ -310,11 +252,6 @@ public:      }    } -  /// createPrinterPass - Get a module printer pass.  -  Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { -    return createPrintModulePass(&O, false, Banner); -  } -    /// run - Execute all of the passes scheduled for execution.  Keep track of    /// whether any of the passes modifies the module, and if so, return true.    bool runOnModule(Module &M); @@ -394,11 +331,6 @@ public:      schedulePass(P);    } -  /// createPrinterPass - Get a module printer pass.  -  Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const { -    return createPrintModulePass(&O, false, Banner); -  } -    /// run - Execute all of the passes scheduled for execution.  Keep track of    /// whether any of the passes modifies the module, and if so, return true.    bool run(Module &M); @@ -1276,14 +1208,7 @@ FunctionPassManager::~FunctionPassManager() {  /// there is no need to delete the pass. (TODO delete passes.)  /// This implies that all passes MUST be allocated with 'new'.  void FunctionPassManager::add(Pass *P) {  -  if (ShouldPrintBeforePass(P)) -    add(P->createPrinterPass(dbgs(), std::string("*** IR Dump Before ") -                             + P->getPassName() + " ***"));    FPM->add(P); - -  if (ShouldPrintAfterPass(P)) -    add(P->createPrinterPass(dbgs(), std::string("*** IR Dump After ") -                             + P->getPassName() + " ***"));  }  /// run - Execute all of the passes scheduled for execution.  Keep @@ -1594,15 +1519,7 @@ PassManager::~PassManager() {  /// will be destroyed as well, so there is no need to delete the pass.  This  /// implies that all passes MUST be allocated with 'new'.  void PassManager::add(Pass *P) { -  if (ShouldPrintBeforePass(P)) -    add(P->createPrinterPass(dbgs(), std::string("*** IR Dump Before ") -                             + P->getPassName() + " ***")); -    PM->add(P); - -  if (ShouldPrintAfterPass(P)) -    add(P->createPrinterPass(dbgs(), std::string("*** IR Dump After ") -                             + P->getPassName() + " ***"));  }  /// run - Execute all of the passes scheduled for execution.  Keep track of diff --git a/lib/VMCore/PrintModulePass.cpp b/lib/VMCore/PrintModulePass.cpp index 2d69dce..f0f6e7a 100644 --- a/lib/VMCore/PrintModulePass.cpp +++ b/lib/VMCore/PrintModulePass.cpp @@ -23,22 +23,21 @@ using namespace llvm;  namespace {    class PrintModulePass : public ModulePass { -    std::string Banner;      raw_ostream *Out;       // raw_ostream to print on      bool DeleteStream;      // Delete the ostream in our dtor?    public:      static char ID;      PrintModulePass() : ModulePass(&ID), Out(&dbgs()),         DeleteStream(false) {} -    PrintModulePass(const std::string &B, raw_ostream *o, bool DS) -        : ModulePass(&ID), Banner(B), Out(o), DeleteStream(DS) {} +    PrintModulePass(raw_ostream *o, bool DS) +      : ModulePass(&ID), Out(o), DeleteStream(DS) {}      ~PrintModulePass() {        if (DeleteStream) delete Out;      }      bool runOnModule(Module &M) { -      (*Out) << Banner << M; +      (*Out) << M;        return false;      } @@ -86,9 +85,8 @@ Y("print-function","Print function to stderr");  /// createPrintModulePass - Create and return a pass that writes the  /// module to the specified raw_ostream.  ModulePass *llvm::createPrintModulePass(llvm::raw_ostream *OS,  -                                        bool DeleteStream, -                                        const std::string &Banner) { -  return new PrintModulePass(Banner, OS, DeleteStream); +                                        bool DeleteStream) { +  return new PrintModulePass(OS, DeleteStream);  }  /// createPrintFunctionPass - Create and return a pass that prints | 
