From: Anna Thomas Date: Tue, 20 Jun 2017 20:54:57 +0000 (+0000) Subject: [Statepoint] Add helper functions for GCRelocate and GCResult X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=076f819db23c236d1ad196d276bdf2662859584b;p=llvm [Statepoint] Add helper functions for GCRelocate and GCResult 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 --- diff --git a/include/llvm/IR/Statepoint.h b/include/llvm/IR/Statepoint.h index 265e7eb348b..630f3066727 100644 --- a/include/llvm/IR/Statepoint.h +++ b/include/llvm/IR/Statepoint.h @@ -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 diff --git a/lib/IR/Statepoint.cpp b/lib/IR/Statepoint.cpp index 8c3f0f208cc..18efee2177c 100644 --- a/lib/IR/Statepoint.cpp +++ b/lib/IR/Statepoint.cpp @@ -44,10 +44,22 @@ bool llvm::isGCRelocate(ImmutableCallSite CS) { return CS.getInstruction() && isa(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(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");