aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-07-20 23:41:56 +0000
committerOwen Anderson <resistor@mac.com>2010-07-20 23:41:56 +0000
commit539673579ec79b75a95ef9daefc6a8b2fc8552f5 (patch)
treec4f78678bea14baa763cce7dd1a2fad6140b7fe0 /include/llvm
parent1154f426d72ea7b2d9de93f9af5874d7d9b5a3d5 (diff)
downloadexternal_llvm-539673579ec79b75a95ef9daefc6a8b2fc8552f5.zip
external_llvm-539673579ec79b75a95ef9daefc6a8b2fc8552f5.tar.gz
external_llvm-539673579ec79b75a95ef9daefc6a8b2fc8552f5.tar.bz2
Move the handling of PassRegistrationListener's to PassRegistry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/PassRegistry.h11
-rw-r--r--include/llvm/PassSupport.h8
2 files changed, 11 insertions, 8 deletions
diff --git a/include/llvm/PassRegistry.h b/include/llvm/PassRegistry.h
index 1f627d8..7b1b6fc 100644
--- a/include/llvm/PassRegistry.h
+++ b/include/llvm/PassRegistry.h
@@ -17,17 +17,18 @@
#ifndef LLVM_PASSREGISTRY_H
#define LLVM_PASSREGISTRY_H
-#include "llvm/PassSupport.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/System/DataTypes.h"
#include "llvm/System/Mutex.h"
#include <map>
#include <set>
-
-using namespace llvm;
+#include <vector>
namespace llvm {
+class PassInfo;
+struct PassRegistrationListener;
+
class PassRegistry {
/// Guards the contents of this class.
mutable sys::SmartMutex<true> Lock;
@@ -44,6 +45,8 @@ class PassRegistry {
std::set<const PassInfo *> Implementations;
};
std::map<const PassInfo*, AnalysisGroupInfo> AnalysisGroupInfoMap;
+
+ std::vector<PassRegistrationListener*> Listeners;
public:
static PassRegistry *getPassRegistry();
@@ -60,6 +63,8 @@ public:
bool isDefault);
void enumerateWith(PassRegistrationListener *L);
+ void addRegistrationListener(PassRegistrationListener* L);
+ void removeRegistrationListener(PassRegistrationListener *L);
};
}
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index b018351..4bbafdb 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -22,6 +22,7 @@
#define LLVM_PASS_SUPPORT_H
#include "Pass.h"
+#include "llvm/PassRegistry.h"
namespace llvm {
@@ -57,7 +58,7 @@ public:
: PassName(name), PassArgument(arg), PassID(pi),
IsCFGOnlyPass(isCFGOnly),
IsAnalysis(is_analysis), IsAnalysisGroup(false), NormalCtor(normal) {
- registerPass();
+ PassRegistry::getPassRegistry()->registerPass(*this);
}
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass. This version is for use by analysis groups; it
@@ -126,10 +127,6 @@ public:
return ItfImpl;
}
-protected:
- void registerPass();
- void unregisterPass();
-
private:
void operator=(const PassInfo &); // do not implement
PassInfo(const PassInfo &); // do not implement
@@ -165,6 +162,7 @@ struct RegisterPass : public PassInfo {
: PassInfo(Name, PassArg, intptr_t(&passName::ID),
PassInfo::NormalCtor_t(callDefaultCtor<passName>),
CFGOnly, is_analysis) {
+
}
};