aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-04-28 18:19:25 +0000
committerJuergen Ributzka <juergen@apple.com>2014-04-28 18:19:25 +0000
commit4989255432a7954ce8c3937a3561595891edf83d (patch)
tree3708381fd96f0ffcca677eb497a7bb1745af51a8 /llvm/lib/IR/LegacyPassManager.cpp
parent4482dcd0721794fc7560b6b5022e47a69df901c2 (diff)
downloadllvm-4989255432a7954ce8c3937a3561595891edf83d.zip
llvm-4989255432a7954ce8c3937a3561595891edf83d.tar.gz
llvm-4989255432a7954ce8c3937a3561595891edf83d.tar.bz2
[PM] Add pass run listeners to the pass manager.
This commit provides the necessary C/C++ APIs and infastructure to enable fine- grain progress report and safe suspension points after each pass in the pass manager. Clients can provide a callback function to the pass manager to call after each pass. This can be used in a variety of ways (progress report, dumping of IR between passes, safe suspension of threads, etc). The run listener list is maintained in the LLVMContext, which allows a multi- threaded client to be only informed for it's own thread. This of course assumes that the client created a LLVMContext for each thread. This fixes <rdar://problem/16728690> llvm-svn: 207430
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
-rw-r--r--llvm/lib/IR/LegacyPassManager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index b6d75b4..aea29fd 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -16,6 +16,7 @@
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/LegacyPassManagers.h"
#include "llvm/IR/LegacyPassNameParser.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
@@ -1313,6 +1314,8 @@ bool BBPassManager::runOnFunction(Function &F) {
TimeRegion PassTimer(getPassTimer(BP));
LocalChanged |= BP->runOnBasicBlock(*I);
+
+ F.getContext().notifyPassRun(BP, F.getParent(), &F, &*I);
}
Changed |= LocalChanged;
@@ -1551,6 +1554,8 @@ bool FPPassManager::runOnFunction(Function &F) {
removeNotPreservedAnalysis(FP);
recordAvailableAnalysis(FP);
removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
+
+ F.getContext().notifyPassRun(FP, F.getParent(), &F);
}
return Changed;
}
@@ -1630,6 +1635,8 @@ MPPassManager::runOnModule(Module &M) {
removeNotPreservedAnalysis(MP);
recordAvailableAnalysis(MP);
removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
+
+ M.getContext().notifyPassRun(MP, &M);
}
// Finalize module passes