[llvm] 74671d5 - Sink first bit of functionality from Statepoint to GCStatepointInst
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 18:32:39 PDT 2020
Author: Philip Reames
Date: 2020-05-27T18:32:28-07:00
New Revision: 74671d5c1491dc9e252a8a10c9065b2f8cc99fba
URL: https://github.com/llvm/llvm-project/commit/74671d5c1491dc9e252a8a10c9065b2f8cc99fba
DIFF: https://github.com/llvm/llvm-project/commit/74671d5c1491dc9e252a8a10c9065b2f8cc99fba.diff
LOG: Sink first bit of functionality from Statepoint to GCStatepointInst
Starting with the obvious stuff. I initially tried to include the inline operand sequences too, but managed to get code which confused *me*. Since several parts of those are being entirely removed in the near future, I may defer that portion until the cleanup is done.
Added:
Modified:
llvm/include/llvm/IR/Statepoint.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index f9eeddba778a..34eb1126b373 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -83,6 +83,38 @@ class GCStatepointInst : public CallBase {
static bool classof(const Value *V) {
return isa<CallBase>(V) && classof(cast<CallBase>(V));
}
+
+ enum {
+ IDPos = 0,
+ NumPatchBytesPos = 1,
+ CalledFunctionPos = 2,
+ NumCallArgsPos = 3,
+ FlagsPos = 4,
+ CallArgsBeginPos = 5,
+ };
+
+ /// Return the ID associated with this statepoint.
+ uint64_t getID() const {
+ return cast<ConstantInt>(getArgOperand(IDPos))->getZExtValue();
+ }
+
+ /// Return the number of patchable bytes associated with this statepoint.
+ uint32_t getNumPatchBytes() const {
+ const Value *NumPatchBytesVal = getArgOperand(NumPatchBytesPos);
+ uint64_t NumPatchBytes =
+ cast<ConstantInt>(NumPatchBytesVal)->getZExtValue();
+ assert(isInt<32>(NumPatchBytes) && "should fit in 32 bits!");
+ return NumPatchBytes;
+ }
+
+ /// Number of arguments to be passed to the actual callee.
+ int getNumCallArgs() const {
+ return cast<ConstantInt>(getArgOperand(NumCallArgsPos))->getZExtValue();
+ }
+
+ uint64_t getFlags() const {
+ return cast<ConstantInt>(getArgOperand(FlagsPos))->getZExtValue();
+ }
};
/// A wrapper around a GC intrinsic call, this provides most of the actual
@@ -107,12 +139,8 @@ class StatepointBase {
using arg_iterator = typename CallTy::const_op_iterator;
enum {
- IDPos = 0,
- NumPatchBytesPos = 1,
- CalledFunctionPos = 2,
- NumCallArgsPos = 3,
- FlagsPos = 4,
- CallArgsBeginPos = 5,
+ CalledFunctionPos = GCStatepointInst::CalledFunctionPos,
+ CallArgsBeginPos = GCStatepointInst::CallArgsBeginPos,
};
void *operator new(size_t, unsigned) = delete;
@@ -129,25 +157,12 @@ class StatepointBase {
return StatepointCall;
}
- uint64_t getFlags() const {
- return cast<ConstantInt>(getCall()->getArgOperand(FlagsPos))
- ->getZExtValue();
- }
+ // 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(); }
- /// Return the ID associated with this statepoint.
- uint64_t getID() const {
- const Value *IDVal = getCall()->getArgOperand(IDPos);
- return cast<ConstantInt>(IDVal)->getZExtValue();
- }
-
- /// Return the number of patchable bytes associated with this statepoint.
- uint32_t getNumPatchBytes() const {
- const Value *NumPatchBytesVal = getCall()->getArgOperand(NumPatchBytesPos);
- uint64_t NumPatchBytes =
- cast<ConstantInt>(NumPatchBytesVal)->getZExtValue();
- assert(isInt<32>(NumPatchBytes) && "should fit in 32 bits!");
- return NumPatchBytes;
- }
/// Return the value actually being called or invoked.
ValueTy *getCalledValue() const {
@@ -180,12 +195,6 @@ class StatepointBase {
return FTy->getReturnType();
}
- /// Number of arguments to be passed to the actual callee.
- int getNumCallArgs() const {
- const Value *NumCallArgsVal = getCall()->getArgOperand(NumCallArgsPos);
- return cast<ConstantInt>(NumCallArgsVal)->getZExtValue();
- }
-
size_t arg_size() const { return getNumCallArgs(); }
arg_iterator arg_begin() const {
assert(CallArgsBeginPos <= (int)getCall()->arg_size());
More information about the llvm-commits
mailing list