diff lib/IR/Statepoint.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
line wrap: on
line diff
--- a/lib/IR/Statepoint.cpp	Sun Dec 23 19:23:36 2018 +0900
+++ b/lib/IR/Statepoint.cpp	Wed Aug 14 19:46:37 2019 +0900
@@ -1,9 +1,8 @@
 //===-- IR/Statepoint.cpp -- gc.statepoint utilities ---  -----------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
@@ -18,21 +17,15 @@
 
 using namespace llvm;
 
-static const Function *getCalledFunction(ImmutableCallSite CS) {
-  if (!CS.getInstruction())
-    return nullptr;
-  return CS.getCalledFunction();
-}
-
-bool llvm::isStatepoint(ImmutableCallSite CS) {
-  if (auto *F = getCalledFunction(CS))
+bool llvm::isStatepoint(const CallBase *Call) {
+  if (auto *F = Call->getCalledFunction())
     return F->getIntrinsicID() == Intrinsic::experimental_gc_statepoint;
   return false;
 }
 
 bool llvm::isStatepoint(const Value *V) {
-  if (auto CS = ImmutableCallSite(V))
-    return isStatepoint(CS);
+  if (auto *Call = dyn_cast<CallBase>(V))
+    return isStatepoint(Call);
   return false;
 }
 
@@ -40,23 +33,21 @@
   return isStatepoint(&V);
 }
 
-bool llvm::isGCRelocate(ImmutableCallSite CS) {
-  return CS.getInstruction() && isa<GCRelocateInst>(CS.getInstruction());
+bool llvm::isGCRelocate(const CallBase *Call) {
+  return isa<GCRelocateInst>(Call);
 }
 
 bool llvm::isGCRelocate(const Value *V) {
-  if (auto CS = ImmutableCallSite(V))
-    return isGCRelocate(CS);
+  if (auto *Call = dyn_cast<CallBase>(V))
+    return isGCRelocate(Call);
   return false;
 }
 
-bool llvm::isGCResult(ImmutableCallSite CS) {
-  return CS.getInstruction() && isa<GCResultInst>(CS.getInstruction());
-}
+bool llvm::isGCResult(const CallBase *Call) { return isa<GCResultInst>(Call); }
 
 bool llvm::isGCResult(const Value *V) {
-  if (auto CS = ImmutableCallSite(V))
-    return isGCResult(CS);
+  if (auto *Call = dyn_cast<CallBase>(V))
+    return isGCResult(Call);
   return false;
 }