[ThinLTO] Metadata linking for imported functions
[oota-llvm.git] / include / llvm / IR / GVMaterializer.h
index 1d6c9157f0b8a13aceec7d6f9566b859409c0e99..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;
 
@@ -56,6 +58,14 @@ public:
   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;
 };