1 //===- llvm/PassRegistry.h - Pass Information Registry ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines PassRegistry, a class that is used in the initialization
11 // and registration of passes. At initialization, passes are registered with
12 // the PassRegistry, which is later provided to the PassManager for dependency
13 // resolution and similar tasks.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_PASSREGISTRY_H
18 #define LLVM_PASSREGISTRY_H
20 #include "llvm/PassSupport.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/System/DataTypes.h"
23 #include "llvm/System/Mutex.h"
32 /// Guards the contents of this class.
33 mutable sys::SmartMutex<true> Lock;
35 /// PassInfoMap - Keep track of the PassInfo object for each registered pass.
36 typedef std::map<intptr_t, const PassInfo*> MapType;
39 typedef StringMap<const PassInfo*> StringMapType;
40 StringMapType PassInfoStringMap;
42 /// AnalysisGroupInfo - Keep track of information for each analysis group.
43 struct AnalysisGroupInfo {
44 std::set<const PassInfo *> Implementations;
46 std::map<const PassInfo*, AnalysisGroupInfo> AnalysisGroupInfoMap;
49 const PassInfo *getPassInfo(intptr_t TI) const;
50 const PassInfo *getPassInfo(StringRef Arg) const;
52 void registerPass(const PassInfo &PI);
53 void unregisterPass(const PassInfo &PI);
55 /// Analysis Group Mechanisms.
56 void registerAnalysisGroup(PassInfo *InterfaceInfo,
57 const PassInfo *ImplementationInfo,
60 void enumerateWith(PassRegistrationListener *L);