summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-05-15 17:49:20 +0000
committerJuergen Ributzka <juergen@apple.com>2014-05-15 17:49:20 +0000
commit218bad2bc5292bec2a46d59e0f85d4c9fde05bf4 (patch)
tree5f08c8f8b084eef58e5627434499657006d527ee /lib/IR
parentfd76d8a72dac035a4e1963bc6fe635a3b688cfcd (diff)
downloadllvm-218bad2bc5292bec2a46d59e0f85d4c9fde05bf4.tar.gz
llvm-218bad2bc5292bec2a46d59e0f85d4c9fde05bf4.tar.bz2
llvm-218bad2bc5292bec2a46d59e0f85d4c9fde05bf4.tar.xz
Revert "[PM] Add pass run listeners to the pass manager."
Revert the current implementation and C API. New implementation and C APIs are in the works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Core.cpp30
-rw-r--r--lib/IR/LLVMContext.cpp20
-rw-r--r--lib/IR/LLVMContextImpl.cpp26
-rw-r--r--lib/IR/LLVMContextImpl.h16
-rw-r--r--lib/IR/LegacyPassManager.cpp7
-rw-r--r--lib/IR/Pass.cpp13
6 files changed, 1 insertions, 111 deletions
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp
index e3a445800c..b1b0abb9ef 100644
--- a/lib/IR/Core.cpp
+++ b/lib/IR/Core.cpp
@@ -27,7 +27,6 @@
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/Pass.h"
#include "llvm/PassManager.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -45,21 +44,6 @@ using namespace llvm;
#define DEBUG_TYPE "ir"
-namespace {
-struct LLVMPassRunListener : PassRunListener {
- LLVMPassRunListenerHandlerTy Callback;
-
- LLVMPassRunListener(LLVMContext *Context, LLVMPassRunListenerHandlerTy Fn)
- : PassRunListener(Context), Callback(Fn) {}
- void passRun(LLVMContext *C, Pass *P, Module *M, Function *F,
- BasicBlock *BB) override {
- Callback(wrap(C), wrap(P), wrap(M), wrap(F), wrap(BB));
- }
-};
-// Create wrappers for C Binding types (see CBindingWrapping.h).
-DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMPassRunListener, LLVMPassRunListenerRef)
-} // end anonymous namespace
-
void llvm::initializeCore(PassRegistry &Registry) {
initializeDominatorTreeWrapperPassPass(Registry);
initializePrintModulePassWrapperPass(Registry);
@@ -150,15 +134,7 @@ LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI){
return severity;
}
-LLVMPassRunListenerRef LLVMAddPassRunListener(LLVMContextRef Context,
- LLVMPassRunListenerHandlerTy Fn) {
- return wrap(new LLVMPassRunListener(unwrap(Context), Fn));
-}
-void LLVMRemovePassRunListener(LLVMContextRef Context,
- LLVMPassRunListenerRef Listener) {
- unwrap(Context)->removeRunListener(unwrap(Listener));
-}
/*===-- Operations on modules ---------------------------------------------===*/
@@ -2671,12 +2647,6 @@ void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf) {
delete unwrap(MemBuf);
}
-/*===-- Pass -------------------------------------------------------------===*/
-
-const char *LLVMGetPassName(LLVMPassRef P) {
- return unwrap(P)->getPassName();
-}
-
/*===-- Pass Registry -----------------------------------------------------===*/
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void) {
diff --git a/lib/IR/LLVMContext.cpp b/lib/IR/LLVMContext.cpp
index b2d3bc9061..588e1217bd 100644
--- a/lib/IR/LLVMContext.cpp
+++ b/lib/IR/LLVMContext.cpp
@@ -214,23 +214,3 @@ void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef> &Names) const {
E = pImpl->CustomMDKindNames.end(); I != E; ++I)
Names[I->second] = I->first();
}
-
-//===----------------------------------------------------------------------===//
-// Pass Run Listeners
-//===----------------------------------------------------------------------===//
-/// Notify that we finished running a pass.
-void LLVMContext::notifyPassRun(Pass *P, Module *M, Function *F, BasicBlock *BB)
-{
- pImpl->notifyPassRun(this, P, M, F, BB);
-}
-/// Register the given PassRunListener to receive notifyPassRun() callbacks
-/// whenever a pass ran. The context will take ownership of the listener and
-/// free it when the context is destroyed.
-void LLVMContext::addRunListener(PassRunListener *L) {
- pImpl->addRunListener(L);
-}
-/// Unregister a PassRunListener so that it no longer receives notifyPassRun()
-/// callbacks. Remove and free the listener from the context.
-void LLVMContext::removeRunListener(PassRunListener *L) {
- pImpl->removeRunListener(L);
-}
diff --git a/lib/IR/LLVMContextImpl.cpp b/lib/IR/LLVMContextImpl.cpp
index 2bccd2a091..78a3c2d304 100644
--- a/lib/IR/LLVMContextImpl.cpp
+++ b/lib/IR/LLVMContextImpl.cpp
@@ -15,32 +15,11 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Module.h"
-#include "llvm/PassSupport.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Regex.h"
#include <algorithm>
using namespace llvm;
-/// Notify that we finished running a pass.
-void LLVMContextImpl::notifyPassRun(LLVMContext *C, Pass *P, Module *M,
- Function *F, BasicBlock *BB) {
- for (auto const &L : RunListeners)
- L->passRun(C, P, M, F, BB);
-}
-/// Register the given PassRunListener to receive notifyPassRun()
-/// callbacks whenever a pass ran.
-void LLVMContextImpl::addRunListener(PassRunListener *L) {
- RunListeners.push_back(L);
-}
-/// Unregister a PassRunListener so that it no longer receives
-/// notifyPassRun() callbacks.
-void LLVMContextImpl::removeRunListener(PassRunListener *L) {
- auto I = std::find(RunListeners.begin(), RunListeners.end(), L);
- assert(I != RunListeners.end() && "RunListener not registered!");
- delete *I;
- RunListeners.erase(I);
-}
-
LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
: TheTrueVal(nullptr), TheFalseVal(nullptr),
VoidTy(C, Type::VoidTyID),
@@ -199,11 +178,6 @@ LLVMContextImpl::~LLVMContextImpl() {
// Destroy MDStrings.
DeleteContainerSeconds(MDStringCache);
-
- // Destroy all run listeners.
- for (auto &L : RunListeners)
- delete L;
- RunListeners.clear();
}
// ConstantsContext anchors
diff --git a/lib/IR/LLVMContextImpl.h b/lib/IR/LLVMContextImpl.h
index 5e4919cdf0..a6a65e6cac 100644
--- a/lib/IR/LLVMContextImpl.h
+++ b/lib/IR/LLVMContextImpl.h
@@ -40,7 +40,6 @@ class ConstantFP;
class LLVMContext;
class Type;
class Value;
-struct PassRunListener;
struct DenseMapAPIntKeyInfo {
struct KeyTy {
@@ -369,26 +368,13 @@ public:
typedef DenseMap<const Function *, ReturnInst *> PrefixDataMapTy;
PrefixDataMapTy PrefixDataMap;
- /// \brief List of listeners to notify about a pass run.
- SmallVector<PassRunListener *, 4> RunListeners;
-
/// \brief Return true if the given pass name should emit optimization
/// remarks.
bool optimizationRemarksEnabledFor(const char *PassName) const;
int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
-
- /// \brief Notify that we finished running a pass.
- void notifyPassRun(LLVMContext *, Pass *, Module *, Function *, BasicBlock *);
- /// \brief Register the given PassRunListener to receive notifyPassRun()
- /// callbacks whenever a pass ran. The context will take ownership of the
- /// listener and free it when the context is destroyed.
- void addRunListener(PassRunListener *);
- /// \brief Unregister a PassRunListener so that it no longer receives
- /// notifyPassRun() callbacks. Remove and free the listener from the context.
- void removeRunListener(PassRunListener *);
-
+
LLVMContextImpl(LLVMContext &C);
~LLVMContextImpl();
};
diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp
index aea29fdc5b..b6d75b483f 100644
--- a/lib/IR/LegacyPassManager.cpp
+++ b/lib/IR/LegacyPassManager.cpp
@@ -16,7 +16,6 @@
#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"
@@ -1314,8 +1313,6 @@ bool BBPassManager::runOnFunction(Function &F) {
TimeRegion PassTimer(getPassTimer(BP));
LocalChanged |= BP->runOnBasicBlock(*I);
-
- F.getContext().notifyPassRun(BP, F.getParent(), &F, &*I);
}
Changed |= LocalChanged;
@@ -1554,8 +1551,6 @@ 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;
}
@@ -1635,8 +1630,6 @@ MPPassManager::runOnModule(Module &M) {
removeNotPreservedAnalysis(MP);
recordAvailableAnalysis(MP);
removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
-
- M.getContext().notifyPassRun(MP, &M);
}
// Finalize module passes
diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp
index 58ae821db2..bb55d2af7c 100644
--- a/lib/IR/Pass.cpp
+++ b/lib/IR/Pass.cpp
@@ -17,7 +17,6 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LegacyPassNameParser.h"
-#include "llvm/IR/LLVMContext.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -243,18 +242,6 @@ void PassRegistrationListener::enumeratePasses() {
PassRegistry::getPassRegistry()->enumerateWith(this);
}
-//===----------------------------------------------------------------------===//
-// PassRunListener implementation
-//
-
-// PassRunListener ctor - Add the current object to the list of
-// PassRunListeners...
-PassRunListener::PassRunListener(LLVMContext *C) {
- C->addRunListener(this);
-}
-
-PassRunListener::~PassRunListener() {}
-
PassNameParser::~PassNameParser() {}
//===----------------------------------------------------------------------===//