Add a convenience method to copy wrapping, exact, and fast-math flags (NFC).
[oota-llvm.git] / include / llvm / PassRegistry.h
index 5d89c492218d8e7dab03ab2e62bd6c59baa9cd52..1558c51bde481f7dd4644f5dc6b2c4d8a2021558 100644 (file)
 #ifndef LLVM_PASSREGISTRY_H
 #define LLVM_PASSREGISTRY_H
 
+#include "llvm-c/Core.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/PassInfo.h"
+#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/RWMutex.h"
+#include <vector>
 
 namespace llvm {
 
@@ -31,11 +39,26 @@ struct PassRegistrationListener;
 /// threads simultaneously, you will need to use a separate PassRegistry on
 /// each thread.
 class PassRegistry {
-  mutable void *pImpl;
-  void *getImpl() const;
+  mutable sys::SmartRWMutex<true> Lock;
+
+  /// PassInfoMap - Keep track of the PassInfo object for each registered pass.
+  typedef DenseMap<const void*, const PassInfo*> MapType;
+  MapType PassInfoMap;
+  
+  typedef StringMap<const PassInfo*> StringMapType;
+  StringMapType PassInfoStringMap;
+  
+  /// AnalysisGroupInfo - Keep track of information for each analysis group.
+  struct AnalysisGroupInfo {
+    SmallPtrSet<const PassInfo *, 8> Implementations;
+  };
+  DenseMap<const PassInfo*, AnalysisGroupInfo> AnalysisGroupInfoMap;
+  
+  std::vector<std::unique_ptr<const PassInfo>> ToFree;
+  std::vector<PassRegistrationListener*> Listeners;
    
 public:
-  PassRegistry() : pImpl(0) { }
+  PassRegistry() { }
   ~PassRegistry();
   
   /// getPassRegistry - Access the global registry object, which is 
@@ -79,6 +102,9 @@ public:
   void removeRegistrationListener(PassRegistrationListener *L);
 };
 
+// Create wrappers for C Binding types (see CBindingWrapping.h).
+DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef)
+
 }
 
 #endif