[Statepoints][NFC] Add Statepoint::getGCResult.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 2 Jul 2015 02:53:34 +0000 (02:53 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 2 Jul 2015 02:53:34 +0000 (02:53 +0000)
Summary:
Introduce a simple accessor to get the gc_result hanging off of a
statepoint.

(I don't think this change needs review, this was uploaded to
phabricator to provide context for later dependent changes.)

Differential Revision: http://reviews.llvm.org/D10627

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241231 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Statepoint.h

index f5f562308edc766417eca16290d3d94d9a4f251a..4e6fb4171a3827acbc649714269ad5f466041c94 100644 (file)
@@ -200,6 +200,17 @@ public:
   /// path of invoke.
   std::vector<GCRelocateOperands> getRelocates();
 
+  /// Get the experimental_gc_result call tied to this statepoint.  Can be
+  /// nullptr if there isn't a gc_result tied to this statepoint.  Guaranteed to
+  /// be a CallInst if non-null.
+  InstructionTy *getGCResult() {
+    for (auto *U : getCallSite().getInstruction()->users())
+      if (isGCResult(U))
+        return cast<CallInst>(U);
+
+    return nullptr;
+  }
+
 #ifndef NDEBUG
   /// Asserts if this statepoint is malformed.  Common cases for failure
   /// include incorrect length prefixes for variable length sections or