]> granicus.if.org Git - llvm/commitdiff
[Statepoint] Add helper functions for GCRelocate and GCResult
authorAnna Thomas <anna@azul.com>
Tue, 20 Jun 2017 20:54:57 +0000 (20:54 +0000)
committerAnna Thomas <anna@azul.com>
Tue, 20 Jun 2017 20:54:57 +0000 (20:54 +0000)
These functions isGCRelocate and isGCResult are
similar to isStatepoint(const Value*).

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

include/llvm/IR/Statepoint.h
lib/IR/Statepoint.cpp

index 265e7eb348bfb68fda5e67e34830c3fb58c5c51c..630f30667272acb5baee7312fe4c16803fcc49ca 100644 (file)
@@ -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
index 8c3f0f208cc67ae591cb4e8511b41995e95c9ed6..18efee2177c343591e578f6ebca6371c7a8a7f13 100644 (file)
@@ -44,10 +44,22 @@ bool llvm::isGCRelocate(ImmutableCallSite CS) {
   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");