diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-01-11 11:52:05 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-01-11 11:52:05 +0000 |
commit | a13f27cc3405c71e8e8b702e8f3ce19a2fa73cb5 (patch) | |
tree | 4d9263ce13f5b6fca798eebfd9d637c178bbd3e8 /llvm/lib | |
parent | d7693d8444982118af05f6f8971ecb2908215b30 (diff) | |
download | bcm5719-llvm-a13f27cc3405c71e8e8b702e8f3ce19a2fa73cb5.tar.gz bcm5719-llvm-a13f27cc3405c71e8e8b702e8f3ce19a2fa73cb5.zip |
[PM] Add names to passes under the new pass manager, and a debug output
mode that can be used to debug the execution of everything.
No support for analyses here, that will come later. This already helps
show parts of the opt commandline integration that isn't working. Tests
of that will start using it as the bugs are fixed.
llvm-svn: 199004
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/PassManager.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp index 30b46b01c1d..70533fef587 100644 --- a/llvm/lib/IR/PassManager.cpp +++ b/llvm/lib/IR/PassManager.cpp @@ -7,19 +7,36 @@ // //===----------------------------------------------------------------------===// -#include "llvm/IR/PassManager.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/IR/PassManager.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" using namespace llvm; +static cl::opt<bool> +DebugPM("debug-pass-manager", cl::Hidden, + cl::desc("Print pass management debugging information")); + PreservedAnalyses ModulePassManager::run(Module *M, ModuleAnalysisManager *AM) { PreservedAnalyses PA = PreservedAnalyses::all(); + + if (DebugPM) + dbgs() << "Starting module pass manager run.\n"; + for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) { + if (DebugPM) + dbgs() << "Running module pass: " << Passes[Idx]->name() << "\n"; + PreservedAnalyses PassPA = Passes[Idx]->run(M, AM); if (AM) AM->invalidate(M, PassPA); PA.intersect(llvm_move(PassPA)); } + + if (DebugPM) + dbgs() << "Finished module pass manager run.\n"; + return PA; } @@ -61,12 +78,23 @@ void ModuleAnalysisManager::invalidateImpl(Module *M, PreservedAnalyses FunctionPassManager::run(Function *F, FunctionAnalysisManager *AM) { PreservedAnalyses PA = PreservedAnalyses::all(); + + if (DebugPM) + dbgs() << "Starting function pass manager run.\n"; + for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) { + if (DebugPM) + dbgs() << "Running function pass: " << Passes[Idx]->name() << "\n"; + PreservedAnalyses PassPA = Passes[Idx]->run(F, AM); if (AM) AM->invalidate(F, PassPA); PA.intersect(llvm_move(PassPA)); } + + if (DebugPM) + dbgs() << "Finished function pass manager run.\n"; + return PA; } |