Add doxygen comments for PassRegistry.
[oota-llvm.git] / include / llvm / PassRegistry.h
1 //===- llvm/PassRegistry.h - Pass Information Registry ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines PassRegistry, a class that is used in the initialization
11 // and registration of passes.  At application startup, passes are registered
12 // with the PassRegistry, which is later provided to the PassManager for 
13 // dependency resolution and similar tasks.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_PASSREGISTRY_H
18 #define LLVM_PASSREGISTRY_H
19
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/System/DataTypes.h"
22
23 namespace llvm {
24
25 class PassInfo;
26 struct PassRegistrationListener;
27
28 /// PassRegistry - This class manages the registration and intitialization of
29 /// the pass subsystem as application startup, and assists the PassManager
30 /// in resolving pass dependencies.
31 /// NOTE: PassRegistry is NOT thread-safe.  If you want to use LLVM on multiple
32 /// threads simultaneously, you will need to use a separate PassRegistry on
33 /// each thread.
34 class PassRegistry {
35   mutable void *pImpl;
36   void *getImpl() const;
37    
38 public:
39   /// getPassRegistry - Access the global registry object, which is 
40   /// automatically initialized at application launch and destroyed by
41   /// llvm_shutdown.
42   static PassRegistry *getPassRegistry();
43   
44   /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
45   /// type identifier (&MyPass::ID).
46   const PassInfo *getPassInfo(const void *TI) const;
47   
48   /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
49   /// argument string.
50   const PassInfo *getPassInfo(StringRef Arg) const;
51   
52   /// registerPass - Register a pass (by means of its PassInfo) with the 
53   /// registry.  Required in order to use the pass with a PassManager.
54   void registerPass(const PassInfo &PI);
55   
56   /// registerPass - Unregister a pass (by means of its PassInfo) with the 
57   /// registry.
58   void unregisterPass(const PassInfo &PI);
59   
60   /// registerAnalysisGroup - Register an analysis group (or a pass implementing
61   // an analysis group) with the registry.  Like registerPass, this is required 
62   // in order for a PassManager to be able to use this group/pass.
63   void registerAnalysisGroup(const void *InterfaceID, const void *PassID,
64                              PassInfo& Registeree, bool isDefault);
65   
66   /// enumerateWith - Enumerate the registered passes, calling the provided
67   /// PassRegistrationListener's passEnumerate() callback on each of them.
68   void enumerateWith(PassRegistrationListener *L);
69   
70   /// addRegistrationListener - Register the given PassRegistrationListener
71   /// to receive passRegistered() callbacks whenever a new pass is registered.
72   void addRegistrationListener(PassRegistrationListener *L);
73   
74   /// removeRegistrationListener - Unregister a PassRegistrationListener so that
75   /// it no longer receives passRegistered() callbacks.
76   void removeRegistrationListener(PassRegistrationListener *L);
77 };
78
79 }
80
81 #endif