[ThinLTO] Metadata linking for imported functions
[oota-llvm.git] / include / llvm / IR / GVMaterializer.h
index 6f57dc2a98a6abf2722cb51e2515dac3a165b3bf..992a8c8fc6f15bb5495a0253d8088eab9a74361d 100644 (file)
 #ifndef LLVM_IR_GVMATERIALIZER_H
 #define LLVM_IR_GVMATERIALIZER_H
 
+#include "llvm/ADT/DenseMap.h"
 #include <system_error>
 #include <vector>
 
 namespace llvm {
 class Function;
 class GlobalValue;
+class Metadata;
 class Module;
 class StructType;
 
@@ -47,11 +49,22 @@ public:
   /// lazily. If the Materializer doesn't support this capability, this method
   /// is a noop.
   ///
-  virtual void Dematerialize(GlobalValue *) {}
+  virtual void dematerialize(GlobalValue *) {}
 
   /// Make sure the entire Module has been completely read.
   ///
-  virtual std::error_code MaterializeModule(Module *M) = 0;
+  virtual std::error_code materializeModule(Module *M) = 0;
+
+  virtual std::error_code materializeMetadata() = 0;
+  virtual void setStripDebugInfo() = 0;
+
+  /// Client should define this interface if the mapping between metadata
+  /// values and value ids needs to be preserved, e.g. across materializer
+  /// instantiations. If OnlyTempMD is true, only those that have remained
+  /// temporary metadata are recorded in the map.
+  virtual void
+  saveMDValueList(DenseMap<const Metadata *, unsigned> &MDValueToValIDMap,
+                  bool OnlyTempMD) {}
 
   virtual std::vector<StructType *> getIdentifiedStructTypes() const = 0;
 };