LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PassRegistry.h
Go to the documentation of this file.
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/StringRef.h"
22 #include "llvm-c/Core.h"
23 
24 namespace llvm {
25 
26 class PassInfo;
27 struct PassRegistrationListener;
28 
29 /// PassRegistry - This class manages the registration and intitialization of
30 /// the pass subsystem as application startup, and assists the PassManager
31 /// in resolving pass dependencies.
32 /// NOTE: PassRegistry is NOT thread-safe. If you want to use LLVM on multiple
33 /// threads simultaneously, you will need to use a separate PassRegistry on
34 /// each thread.
35 class PassRegistry {
36  mutable void *pImpl;
37  void *getImpl() const;
38 
39 public:
40  PassRegistry() : pImpl(0) { }
41  ~PassRegistry();
42 
43  /// getPassRegistry - Access the global registry object, which is
44  /// automatically initialized at application launch and destroyed by
45  /// llvm_shutdown.
46  static PassRegistry *getPassRegistry();
47 
48  /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
49  /// type identifier (&MyPass::ID).
50  const PassInfo *getPassInfo(const void *TI) const;
51 
52  /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
53  /// argument string.
54  const PassInfo *getPassInfo(StringRef Arg) const;
55 
56  /// registerPass - Register a pass (by means of its PassInfo) with the
57  /// registry. Required in order to use the pass with a PassManager.
58  void registerPass(const PassInfo &PI, bool ShouldFree = false);
59 
60  /// registerPass - Unregister a pass (by means of its PassInfo) with the
61  /// registry.
62  void unregisterPass(const PassInfo &PI);
63 
64  /// registerAnalysisGroup - Register an analysis group (or a pass implementing
65  // an analysis group) with the registry. Like registerPass, this is required
66  // in order for a PassManager to be able to use this group/pass.
67  void registerAnalysisGroup(const void *InterfaceID, const void *PassID,
68  PassInfo& Registeree, bool isDefault,
69  bool ShouldFree = false);
70 
71  /// enumerateWith - Enumerate the registered passes, calling the provided
72  /// PassRegistrationListener's passEnumerate() callback on each of them.
74 
75  /// addRegistrationListener - Register the given PassRegistrationListener
76  /// to receive passRegistered() callbacks whenever a new pass is registered.
78 
79  /// removeRegistrationListener - Unregister a PassRegistrationListener so that
80  /// it no longer receives passRegistered() callbacks.
82 };
83 
84 // Create wrappers for C Binding types (see CBindingWrapping.h).
86 
87 }
88 
89 #endif
void registerAnalysisGroup(const void *InterfaceID, const void *PassID, PassInfo &Registeree, bool isDefault, bool ShouldFree=false)
registerAnalysisGroup - Register an analysis group (or a pass implementing
static PassRegistry * getPassRegistry()
void enumerateWith(PassRegistrationListener *L)
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref)
void removeRegistrationListener(PassRegistrationListener *L)
void unregisterPass(const PassInfo &PI)
void addRegistrationListener(PassRegistrationListener *L)
struct LLVMOpaquePassRegistry * LLVMPassRegistryRef
Definition: Core.h:128
const PassInfo * getPassInfo(const void *TI) const
void registerPass(const PassInfo &PI, bool ShouldFree=false)