[llvm] r241231 - [Statepoints][NFC] Add Statepoint::getGCResult.

Sanjoy Das sanjoy at playingwithpointers.com
Wed Jul 1 19:53:34 PDT 2015


Author: sanjoy
Date: Wed Jul  1 21:53:34 2015
New Revision: 241231

URL: http://llvm.org/viewvc/llvm-project?rev=241231&view=rev
Log:
[Statepoints][NFC] Add Statepoint::getGCResult.

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

Modified:
    llvm/trunk/include/llvm/IR/Statepoint.h

Modified: llvm/trunk/include/llvm/IR/Statepoint.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Statepoint.h?rev=241231&r1=241230&r2=241231&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Statepoint.h (original)
+++ llvm/trunk/include/llvm/IR/Statepoint.h Wed Jul  1 21:53:34 2015
@@ -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





More information about the llvm-commits mailing list