[llvm] b9983c1 - [Statepoint] Start the process of removing old interfaces

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 20:00:59 PDT 2020


Author: Philip Reames
Date: 2020-06-03T20:00:52-07:00
New Revision: b9983c18fc3e42e5824a7e37a01f57120a64c018

URL: https://github.com/llvm/llvm-project/commit/b9983c18fc3e42e5824a7e37a01f57120a64c018
DIFF: https://github.com/llvm/llvm-project/commit/b9983c18fc3e42e5824a7e37a01f57120a64c018.diff

LOG: [Statepoint] Start the process of removing old interfaces

We introduced the GCStatepointInst class and have migrated almost all users of Statepoint/ImmutableStatepoint to the new API.  Given downstream consumers have had a week to migrate, remove code which is now dead.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index 2a0094c39077..0ef9f01b0e26 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -55,16 +55,6 @@ enum class StatepointFlags {
 class GCRelocateInst;
 class GCResultInst;
 
-bool isStatepoint(const CallBase *Call);
-bool isStatepoint(const Value *V);
-bool isStatepoint(const Value &V);
-
-bool isGCRelocate(const CallBase *Call);
-bool isGCRelocate(const Value *V);
-
-bool isGCResult(const CallBase *Call);
-bool isGCResult(const Value *V);
-
 /// Represents a gc.statepoint intrinsic call.  This extends directly from
 /// CallBase as the IntrinsicInst only supports calls and gc.statepoint is
 /// invokable.
@@ -248,32 +238,6 @@ class StatepointBase {
     return StatepointCall;
   }
 
-  // Deprecated shims (update all callers to remove)
-  uint64_t getFlags() const { return getCall()->getFlags(); }
-  uint64_t getID() const { return getCall()->getID(); }
-  uint32_t getNumPatchBytes() const { return getCall()->getNumPatchBytes(); }
-  int getNumCallArgs() const { return getCall()->getNumCallArgs(); }
-  ValueTy *getCalledValue() const {
-    return getCall()->getActualCalledOperand();
-  }
-  Type *getActualReturnType() const { return getCall()->getActualReturnType(); }
-  FunTy *getCalledFunction() const {
-    return getCall()->getActualCalledFunction();
-  }
-
-  
-  // FIXME: Migrate users of this to `getCall` and remove it.
-  InstructionTy *getInstruction() const { return getCall(); }
-
-  /// Return the caller function for this statepoint.
-  FunTy *getCaller() const { return getCall()->getCaller(); }
-
-  /// Determine if the statepoint cannot unwind.
-  bool doesNotThrow() const {
-    Function *F = getCalledFunction();
-    return getCall()->doesNotThrow() || (F ? F->doesNotThrow() : false);
-  }
-
   size_t arg_size() const { return getCall()->actual_arg_size(); }
   arg_iterator arg_begin() const { return getCall()->actual_arg_begin(); }
   arg_iterator arg_end() const { return getCall()->actual_arg_end(); }
@@ -281,18 +245,6 @@ class StatepointBase {
     return getCall()->actual_args();
   }
 
-  ValueTy *getArgument(unsigned Index) {
-    assert(Index < arg_size() && "out of bounds!");
-    return *(arg_begin() + Index);
-  }
-
-  /// Return true if the call or the callee has the given attribute.
-  bool paramHasAttr(unsigned i, Attribute::AttrKind A) const {
-    Function *F = getCalledFunction();
-    return getCall()->paramHasAttr(i + CallArgsBeginPos, A) ||
-           (F ? F->getAttributes().hasAttribute(i, A) : false);
-  }
-
   /// Number of GC transition args.
   int getNumTotalGCTransitionArgs() const {
     const Value *NumGCTransitionArgs = *arg_end();
@@ -348,21 +300,11 @@ class StatepointBase {
     return getCall()->gc_args();
   }
 
-  std::vector<const GCRelocateInst *> getRelocates() const {
-    return getCall()->getGCRelocates();
-  }
-  const GCResultInst *getGCResult() const {
-    return getCall()->getGCResult();
-  }
-
 #ifndef NDEBUG
   /// Asserts if this statepoint is malformed.  Common cases for failure
   /// include incorrect length prefixes for variable length sections or
   /// illegal values for parameters.
   void verify() {
-    assert(getNumCallArgs() >= 0 &&
-           "number of arguments to actually callee can't be negative");
-
     // The internal asserts in the iterator accessors do the rest.
     (void)arg_begin();
     (void)arg_end();
@@ -377,7 +319,7 @@ class StatepointBase {
 };
 
 /// A specialization of it's base class for read only access
-/// to a gc.statepoint.
+/// to a gc.statepoint.  DEPRECATED.  Use GCStatepointInst instead!
 class ImmutableStatepoint
     : public StatepointBase<const Function, const Instruction, const Value,
                             const GCStatepointInst> {
@@ -389,17 +331,6 @@ class ImmutableStatepoint
   explicit ImmutableStatepoint(const CallBase *Call) : Base(Call) {}
 };
 
-/// A specialization of it's base class for read-write access
-/// to a gc.statepoint.
-class Statepoint
-    : public StatepointBase<Function, Instruction, Value, GCStatepointInst> {
-  using Base = StatepointBase<Function, Instruction, Value, GCStatepointInst>;
-
-public:
-  explicit Statepoint(Instruction *I) : Base(I) {}
-  explicit Statepoint(CallBase *Call) : Base(Call) {}
-};
-
 /// Common base class for representing values projected from a statepoint.
 /// Currently, the only projections available are gc.result and gc.relocate.
 class GCProjectionInst : public IntrinsicInst {

diff  --git a/llvm/lib/IR/Statepoint.cpp b/llvm/lib/IR/Statepoint.cpp
index 53b0d1e0aa35..bbfbbe489bae 100644
--- a/llvm/lib/IR/Statepoint.cpp
+++ b/llvm/lib/IR/Statepoint.cpp
@@ -17,36 +17,6 @@
 
 using namespace llvm;
 
-bool llvm::isStatepoint(const CallBase *Call) {
-  return isa<GCStatepointInst>(Call);
-}
-
-bool llvm::isStatepoint(const Value *V) {
-  return isa<GCStatepointInst>(V);
-}
-
-bool llvm::isStatepoint(const Value &V) {
-  return isStatepoint(&V);
-}
-
-bool llvm::isGCRelocate(const CallBase *Call) {
-  return isa<GCRelocateInst>(Call);
-}
-
-bool llvm::isGCRelocate(const Value *V) {
-  if (auto *Call = dyn_cast<CallBase>(V))
-    return isGCRelocate(Call);
-  return false;
-}
-
-bool llvm::isGCResult(const CallBase *Call) { return isa<GCResultInst>(Call); }
-
-bool llvm::isGCResult(const Value *V) {
-  if (auto *Call = dyn_cast<CallBase>(V))
-    return isGCResult(Call);
-  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