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 | b56749c3b7bd3867d5a500b9882decd957244620 (patch) | |
tree | e20a9070e3aa16ad2092503b4f51f7f5bdc48857 /lib | |
parent | d55b5fe9920554cebf5976316915bb07165734b4 (diff) | |
download | llvm-b56749c3b7bd3867d5a500b9882decd957244620.tar.gz llvm-b56749c3b7bd3867d5a500b9882decd957244620.tar.bz2 llvm-b56749c3b7bd3867d5a500b9882decd957244620.tar.xz |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/IR/PassManager.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/IR/PassManager.cpp b/lib/IR/PassManager.cpp index 30b46b01c1..70533fef58 100644 --- a/lib/IR/PassManager.cpp +++ b/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; } |