Split resolveCycles(bool AllowTemps) into two interfaces and document
[oota-llvm.git] / include / llvm / IR / Metadata.h
index 4a8557d074f058c41b2a33fb3838d9c29df38030..df8ce354bb7fdfba62a3d51d7502b3a39c503ab7 100644 (file)
@@ -915,11 +915,21 @@ public:
   /// \brief Resolve cycles.
   ///
   /// Once all forward declarations have been resolved, force cycles to be
-  /// resolved. If \p AllowTemps is true, then any temporary metadata
-  /// is ignored, otherwise it asserts when encountering temporary metadata.
+  /// resolved. This interface is used when there are no more temporaries,
+  /// and thus unresolved nodes are part of cycles and no longer need RAUW
+  /// support.
   ///
   /// \pre No operands (or operands' operands, etc.) have \a isTemporary().
-  void resolveCycles(bool AllowTemps = false);
+  void resolveCycles() { resolveRecursivelyImpl(/* AllowTemps */ false); }
+
+  /// \brief Resolve cycles while ignoring temporaries.
+  ///
+  /// This drops RAUW support for any temporaries, which can no longer
+  /// be uniqued.
+  ///
+  void resolveNonTemporaries() {
+    resolveRecursivelyImpl(/* AllowTemps */ true);
+  }
 
   /// \brief Replace a temporary node with a permanent one.
   ///
@@ -977,6 +987,11 @@ private:
   void decrementUnresolvedOperandCount();
   unsigned countUnresolvedOperands();
 
+  /// Resolve cycles recursively. If \p AllowTemps is true, then any temporary
+  /// metadata is ignored, otherwise it asserts when encountering temporary
+  /// metadata.
+  void resolveRecursivelyImpl(bool AllowTemps);
+
   /// \brief Mutate this to be "uniqued".
   ///
   /// Mutate this so that \a isUniqued().