Special case aliases in GlobalValue::getAlignment.
[oota-llvm.git] / include / llvm / IR / LLVMContext.h
index 5c698f81de40e0db3e7f8ee7ed693206d6427d97..d0ed850d8349f8f876f606b43e31b9c4b9fcb7a9 100644 (file)
 
 namespace llvm {
 
-class LLVMContextImpl;
-class StringRef;
-class Twine;
+class BasicBlock;
+class DebugLoc;
+class DiagnosticInfo;
+class Function;
 class Instruction;
+class LLVMContextImpl;
 class Module;
-class SMDiagnostic;
-class DiagnosticInfo;
+class Pass;
+struct PassRunListener;
 template <typename T> class SmallVectorImpl;
-class Function;
-class DebugLoc;
+class SMDiagnostic;
+class StringRef;
+class Twine;
 
 /// This is an important class for using LLVM in a threaded context.  It
 /// (opaquely) owns and manages the core "global" data of LLVM's core
@@ -80,7 +83,7 @@ public:
   /// LLVMContext doesn't take ownership or interpret either of these
   /// pointers.
   void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
-                                     void *DiagContext = 0);
+                                     void *DiagContext = nullptr);
 
   /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
   /// setInlineAsmDiagnosticHandler.
@@ -98,7 +101,7 @@ public:
   /// LLVMContext doesn't take ownership or interpret either of these
   /// pointers.
   void setDiagnosticHandler(DiagnosticHandlerTy DiagHandler,
-                            void *DiagContext = 0);
+                            void *DiagContext = nullptr);
 
   /// getDiagnosticHandler - Return the diagnostic handler set by
   /// setDiagnosticHandler.
@@ -136,6 +139,16 @@ public:
   void emitOptimizationRemark(const char *PassName, const Function &Fn,
                               const DebugLoc &DLoc, const Twine &Msg);
 
+  /// \brief Notify that we finished running a pass.
+  void notifyPassRun(Pass *P, Module *M, Function *F = nullptr,
+                     BasicBlock *BB = nullptr);
+  /// \brief Register the given PassRunListener to receive notifyPassRun()
+  /// callbacks whenever a pass ran. The context will take ownership of the
+  /// listener and free it when the context is destroyed.
+  void addRunListener(PassRunListener *L);
+  /// \brief Unregister a PassRunListener so that it no longer receives
+  /// notifyPassRun() callbacks. Remove and free the listener from the context.
+  void removeRunListener(PassRunListener *L);
 private:
   LLVMContext(LLVMContext&) LLVM_DELETED_FUNCTION;
   void operator=(LLVMContext&) LLVM_DELETED_FUNCTION;