diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-29 22:37:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-29 22:37:04 +0000 |
commit | cbee990a290293163ff50f338a1f1dc32ddcdb24 (patch) | |
tree | 1598cbc179efdfa833eceb0ee6ceea485cde4086 /lib/VMCore | |
parent | 06887c9a2ad0d30c3cdfeff4d5e268a634c9d1a6 (diff) | |
download | external_llvm-cbee990a290293163ff50f338a1f1dc32ddcdb24.zip external_llvm-cbee990a290293163ff50f338a1f1dc32ddcdb24.tar.gz external_llvm-cbee990a290293163ff50f338a1f1dc32ddcdb24.tar.bz2 |
Fix -debug-pass=Executions, which relied on Function, Module, and BasicBlock
being annotable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Pass.cpp | 35 | ||||
-rw-r--r-- | lib/VMCore/PassManagerT.h | 15 |
2 files changed, 28 insertions, 22 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 982de90..3aa1d13 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -133,22 +133,31 @@ void PMDebug::PrintArgumentInformation(const Pass *P) { } void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, - Pass *P, Annotable *V) { + Pass *P, Module *M) { if (PassDebugging >= Executions) { std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); - if (V) { - std::cerr << "' on "; - - if (dynamic_cast<Module*>(V)) { - std::cerr << "Module\n"; return; - } else if (Function *F = dynamic_cast<Function*>(V)) - std::cerr << "Function '" << F->getName(); - else if (BasicBlock *BB = dynamic_cast<BasicBlock*>(V)) - std::cerr << "BasicBlock '" << BB->getName(); - else if (Value *Val = dynamic_cast<Value*>(V)) - std::cerr << typeid(*Val).name() << " '" << Val->getName(); - } + if (M) std::cerr << "' on Module '" << M->getModuleIdentifier() << "'\n"; + std::cerr << "'...\n"; + } +} + +void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, + Pass *P, Function *F) { + if (PassDebugging >= Executions) { + std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" + << P->getPassName(); + if (F) std::cerr << "' on Function '" << F->getName(); + std::cerr << "'...\n"; + } +} + +void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, + Pass *P, BasicBlock *BB) { + if (PassDebugging >= Executions) { + std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" + << P->getPassName(); + if (BB) std::cerr << "' on BasicBlock '" << BB->getName(); std::cerr << "'...\n"; } } diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h index c5cac1d..5ffaebd 100644 --- a/lib/VMCore/PassManagerT.h +++ b/lib/VMCore/PassManagerT.h @@ -31,8 +31,6 @@ namespace llvm { -class Annotable; - //===----------------------------------------------------------------------===// // Pass debugging information. Often it is useful to find out what pass is // running when a crash occurs in a utility. When this library is compiled with @@ -75,7 +73,9 @@ struct PMDebug { } static void PrintArgumentInformation(const Pass *P); - static void PrintPassInformation(unsigned,const char*,Pass *, Annotable *); + static void PrintPassInformation(unsigned,const char*,Pass *, Module *); + static void PrintPassInformation(unsigned,const char*,Pass *, Function *); + static void PrintPassInformation(unsigned,const char*,Pass *, BasicBlock *); static void PrintAnalysisSetInfo(unsigned,const char*,Pass *P, const std::vector<AnalysisID> &); }; @@ -216,8 +216,7 @@ public: for (unsigned i = 0, e = Passes.size(); i < e; ++i) { PassClass *P = Passes[i]; - PMDebug::PrintPassInformation(getDepth(), "Executing Pass", P, - (Annotable*)M); + PMDebug::PrintPassInformation(getDepth(), "Executing Pass", P, M); // Get information about what analyses the pass uses... AnalysisUsage AnUsage; @@ -259,8 +258,7 @@ public: P->getPassName() + "'"); if (Changed) - PMDebug::PrintPassInformation(getDepth()+1, "Made Modification", P, - (Annotable*)M); + PMDebug::PrintPassInformation(getDepth()+1, "Made Modification", P, M); PMDebug::PrintAnalysisSetInfo(getDepth(), "Preserved", P, AnUsage.getPreservedSet()); @@ -301,8 +299,7 @@ public: std::vector<Pass*> &DeadPass = LastUserOf[P]; for (std::vector<Pass*>::iterator I = DeadPass.begin(),E = DeadPass.end(); I != E; ++I) { - PMDebug::PrintPassInformation(getDepth()+1, "Freeing Pass", *I, - (Annotable*)M); + PMDebug::PrintPassInformation(getDepth()+1, "Freeing Pass", *I, M); (*I)->releaseMemory(); } |