[Statepoints] Initial support for relocating vectors of pointers
[oota-llvm.git] / include / llvm / IR / ModuleSlotTracker.h
index 995467edf36dc5f4deebad9ebc888284940c1ff9..49730a66bdf64ad4b3cd62b3b5cc7cbb2337c81d 100644 (file)
@@ -17,6 +17,7 @@ namespace llvm {
 class Module;
 class Function;
 class SlotTracker;
+class Value;
 
 /// Manage lifetime of a slot tracker for printing IR.
 ///
@@ -41,8 +42,13 @@ public:
 
   /// Construct a slot tracker from a module.
   ///
-  /// If \a M is \c nullptr, uses a null slot tracker.
-  explicit ModuleSlotTracker(const Module *M);
+  /// If \a M is \c nullptr, uses a null slot tracker.  Otherwise, initializes
+  /// a slot tracker, and initializes all metadata slots.  \c
+  /// ShouldInitializeAllMetadata defaults to true because this is expected to
+  /// be shared between multiple callers, and otherwise MDNode references will
+  /// not match up.
+  explicit ModuleSlotTracker(const Module *M,
+                             bool ShouldInitializeAllMetadata = true);
 
   /// Destructor to clean up storage.
   ~ModuleSlotTracker();
@@ -56,6 +62,13 @@ public:
   /// Purge the currently incorporated function and incorporate \c F.  If \c F
   /// is currently incorporated, this is a no-op.
   void incorporateFunction(const Function &F);
+
+  /// Return the slot number of the specified local value.
+  ///
+  /// A function that defines this value should be incorporated prior to calling
+  /// this method.
+  /// Return -1 if the value is not in the function's SlotTracker.
+  int getLocalSlot(const Value *V);
 };
 
 } // end namespace llvm