mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
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
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user