2010-07-20 18:53:25 +00:00
|
|
|
//===- llvm/PassRegistry.h - Pass Information Registry ----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines PassRegistry, a class that is used in the initialization
|
|
|
|
// and registration of passes. At initialization, passes are registered with
|
|
|
|
// the PassRegistry, which is later provided to the PassManager for dependency
|
|
|
|
// resolution and similar tasks.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_PASSREGISTRY_H
|
|
|
|
#define LLVM_PASSREGISTRY_H
|
|
|
|
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
#include "llvm/System/DataTypes.h"
|
|
|
|
#include "llvm/System/Mutex.h"
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
2010-07-20 23:41:56 +00:00
|
|
|
#include <vector>
|
2010-07-20 18:53:25 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2010-07-20 23:41:56 +00:00
|
|
|
class PassInfo;
|
|
|
|
struct PassRegistrationListener;
|
|
|
|
|
2010-07-20 18:53:25 +00:00
|
|
|
class PassRegistry {
|
|
|
|
/// Guards the contents of this class.
|
|
|
|
mutable sys::SmartMutex<true> Lock;
|
|
|
|
|
|
|
|
/// PassInfoMap - Keep track of the PassInfo object for each registered pass.
|
|
|
|
typedef std::map<intptr_t, const PassInfo*> MapType;
|
|
|
|
MapType PassInfoMap;
|
|
|
|
|
|
|
|
typedef StringMap<const PassInfo*> StringMapType;
|
|
|
|
StringMapType PassInfoStringMap;
|
|
|
|
|
|
|
|
/// AnalysisGroupInfo - Keep track of information for each analysis group.
|
|
|
|
struct AnalysisGroupInfo {
|
|
|
|
std::set<const PassInfo *> Implementations;
|
|
|
|
};
|
|
|
|
std::map<const PassInfo*, AnalysisGroupInfo> AnalysisGroupInfoMap;
|
2010-07-20 23:41:56 +00:00
|
|
|
|
|
|
|
std::vector<PassRegistrationListener*> Listeners;
|
2010-07-20 18:53:25 +00:00
|
|
|
|
|
|
|
public:
|
2010-07-20 21:22:24 +00:00
|
|
|
static PassRegistry *getPassRegistry();
|
|
|
|
|
2010-07-20 18:53:25 +00:00
|
|
|
const PassInfo *getPassInfo(intptr_t TI) const;
|
|
|
|
const PassInfo *getPassInfo(StringRef Arg) const;
|
|
|
|
|
|
|
|
void registerPass(const PassInfo &PI);
|
|
|
|
void unregisterPass(const PassInfo &PI);
|
|
|
|
|
|
|
|
/// Analysis Group Mechanisms.
|
2010-07-21 17:52:45 +00:00
|
|
|
void registerAnalysisGroup(intptr_t InterfaceID, intptr_t PassID,
|
|
|
|
PassInfo& Registeree, bool isDefault);
|
2010-07-20 18:53:25 +00:00
|
|
|
|
|
|
|
void enumerateWith(PassRegistrationListener *L);
|
2010-07-20 23:41:56 +00:00
|
|
|
void addRegistrationListener(PassRegistrationListener* L);
|
|
|
|
void removeRegistrationListener(PassRegistrationListener *L);
|
2010-07-20 18:53:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|