[llvm] r305847 - [Statepoint] Add helper functions for GCRelocate and GCResult

Anna Thomas via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 13:54:57 PDT 2017


Author: annat
Date: Tue Jun 20 15:54:57 2017
New Revision: 305847

URL: http://llvm.org/viewvc/llvm-project?rev=305847&view=rev
Log:
[Statepoint] Add helper functions for GCRelocate and GCResult

These functions isGCRelocate and isGCResult are
similar to isStatepoint(const Value*).

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

Modified: llvm/trunk/include/llvm/IR/Statepoint.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Statepoint.h?rev=305847&r1=305846&r2=305847&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Statepoint.h (original)
+++ llvm/trunk/include/llvm/IR/Statepoint.h Tue Jun 20 15:54:57 2017
@@ -62,7 +62,10 @@ bool isStatepoint(const Value *V);
 bool isStatepoint(const Value &V);
 
 bool isGCRelocate(ImmutableCallSite CS);
+bool isGCRelocate(const Value *V);
+
 bool isGCResult(ImmutableCallSite CS);
+bool isGCResult(const Value *V);
 
 /// Analogous to CallSiteBase, this provides most of the actual
 /// functionality for Statepoint and ImmutableStatepoint.  It is

Modified: llvm/trunk/lib/IR/Statepoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Statepoint.cpp?rev=305847&r1=305846&r2=305847&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Statepoint.cpp (original)
+++ llvm/trunk/lib/IR/Statepoint.cpp Tue Jun 20 15:54:57 2017
@@ -44,10 +44,22 @@ bool llvm::isGCRelocate(ImmutableCallSit
   return CS.getInstruction() && isa<GCRelocateInst>(CS.getInstruction());
 }
 
+bool llvm::isGCRelocate(const Value *V) {
+  if (auto CS = ImmutableCallSite(V))
+    return isGCRelocate(CS);
+  return false;
+}
+
 bool llvm::isGCResult(ImmutableCallSite CS) {
   return CS.getInstruction() && isa<GCResultInst>(CS.getInstruction());
 }
 
+bool llvm::isGCResult(const Value *V) {
+  if (auto CS = ImmutableCallSite(V))
+    return isGCResult(CS);
+  return false;
+}
+
 bool llvm::isStatepointDirectiveAttr(Attribute Attr) {
   return Attr.hasAttribute("statepoint-id") ||
          Attr.hasAttribute("statepoint-num-patch-bytes");




More information about the llvm-commits mailing list