summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/StackMaps.h26
-rw-r--r--llvm/include/llvm/IR/IRBuilder.h12
-rw-r--r--llvm/include/llvm/IR/Intrinsics.td3
-rw-r--r--llvm/include/llvm/IR/Statepoint.h27
4 files changed, 42 insertions, 26 deletions
diff --git a/llvm/include/llvm/CodeGen/StackMaps.h b/llvm/include/llvm/CodeGen/StackMaps.h
index c6d097b916f..46a773f74aa 100644
--- a/llvm/include/llvm/CodeGen/StackMaps.h
+++ b/llvm/include/llvm/CodeGen/StackMaps.h
@@ -85,8 +85,8 @@ public:
/// MI-level Statepoint operands
///
/// Statepoint operands take the form:
-/// <num call arguments>, <call target>, [call arguments],
-/// <StackMaps::ConstantOp>, <calling convention>,
+/// <id>, <num patch bytes >, <num call arguments>, <call target>,
+/// [call arguments], <StackMaps::ConstantOp>, <calling convention>,
/// <StackMaps::ConstantOp>, <statepoint flags>,
/// <StackMaps::ConstantOp>, <num other args>, [other args],
/// [gc values]
@@ -94,10 +94,7 @@ class StatepointOpers {
private:
// These values are aboolute offsets into the operands of the statepoint
// instruction.
- enum {
- NCallArgsPos = 0,
- CallTargetPos = 1
- };
+ enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
// These values are relative offests from the start of the statepoint meta
// arguments (i.e. the end of the call arguments).
@@ -114,20 +111,15 @@ public:
/// Get starting index of non call related arguments
/// (calling convention, statepoint flags, vm state and gc state).
unsigned getVarIdx() const {
- return MI->getOperand(NCallArgsPos).getImm() + 2;
+ return MI->getOperand(NCallArgsPos).getImm() + MetaEnd;
}
- /// Returns the index of the operand containing the number of non-gc non-call
- /// arguments.
- unsigned getNumVMSArgsIdx() const {
- return getVarIdx() + NumVMSArgsOffset;
- }
+ /// Return the ID for the given statepoint.
+ uint64_t getID() const { return MI->getOperand(IDPos).getImm(); }
- /// Returns the number of non-gc non-call arguments attached to the
- /// statepoint. Note that this is the number of arguments, not the number of
- /// operands required to represent those arguments.
- unsigned getNumVMSArgs() const {
- return MI->getOperand(getNumVMSArgsIdx()).getImm();
+ /// Return the number of patchable bytes the given statepoint should emit.
+ uint32_t getNumPatchBytes() const {
+ return MI->getOperand(NBytesPos).getImm();
}
/// Returns the target of the underlying call.
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 7224496c204..e78c63c51d7 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -447,7 +447,8 @@ public:
/// \brief Create a call to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- CallInst *CreateGCStatepointCall(Value *ActualCallee,
+ CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ Value *ActualCallee,
ArrayRef<Value *> CallArgs,
ArrayRef<Value *> DeoptArgs,
ArrayRef<Value *> GCArgs,
@@ -456,7 +457,8 @@ public:
// \brief Conveninence function for the common case when CallArgs are filled
// in using makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
// .get()'ed to get the Value pointer.
- CallInst *CreateGCStatepointCall(Value *ActualCallee, ArrayRef<Use> CallArgs,
+ CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ Value *ActualCallee, ArrayRef<Use> CallArgs,
ArrayRef<Value *> DeoptArgs,
ArrayRef<Value *> GCArgs,
const Twine &Name = "");
@@ -464,7 +466,8 @@ public:
/// brief Create an invoke to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
InvokeInst *
- CreateGCStatepointInvoke(Value *ActualInvokee, BasicBlock *NormalDest,
+ CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
+ Value *ActualInvokee, BasicBlock *NormalDest,
BasicBlock *UnwindDest, ArrayRef<Value *> InvokeArgs,
ArrayRef<Value *> DeoptArgs,
ArrayRef<Value *> GCArgs, const Twine &Name = "");
@@ -473,7 +476,8 @@ public:
// makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be .get()'ed to
// get the Value *.
InvokeInst *
- CreateGCStatepointInvoke(Value *ActualInvokee, BasicBlock *NormalDest,
+ CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
+ Value *ActualInvokee, BasicBlock *NormalDest,
BasicBlock *UnwindDest, ArrayRef<Use> InvokeArgs,
ArrayRef<Value *> DeoptArgs,
ArrayRef<Value *> GCArgs, const Twine &Name = "");
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index d778fbede0b..1442b64762f 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -528,7 +528,8 @@ def int_experimental_patchpoint_i64 : Intrinsic<[llvm_i64_ty],
// These are documented in docs/Statepoint.rst
def int_experimental_gc_statepoint : Intrinsic<[llvm_i32_ty],
- [llvm_anyptr_ty, llvm_i32_ty,
+ [llvm_i64_ty, llvm_i32_ty,
+ llvm_anyptr_ty, llvm_i32_ty,
llvm_i32_ty, llvm_vararg_ty]>;
def int_experimental_gc_result : Intrinsic<[llvm_any_ty], [llvm_i32_ty]>;
diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index 57ae90f6d15..cd09618e3ee 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -74,16 +74,35 @@ public:
typedef typename CallSiteTy::arg_iterator arg_iterator;
enum {
- ActualCalleePos = 0,
- NumCallArgsPos = 1,
- CallArgsBeginPos = 3,
+ IDPos = 0,
+ NumPatchBytesPos = 1,
+ ActualCalleePos = 2,
+ NumCallArgsPos = 3,
+ FlagsPos = 4,
+ CallArgsBeginPos = 5,
};
/// Return the underlying CallSite.
CallSiteTy getCallSite() { return StatepointCS; }
uint64_t getFlags() const {
- return cast<ConstantInt>(StatepointCS.getArgument(2))->getZExtValue();
+ return cast<ConstantInt>(StatepointCS.getArgument(FlagsPos))
+ ->getZExtValue();
+ }
+
+ /// Return the ID associated with this statepoint.
+ uint64_t getID() {
+ const Value *IDVal = StatepointCS.getArgument(IDPos);
+ return cast<ConstantInt>(IDVal)->getZExtValue();
+ }
+
+ /// Return the number of patchable bytes associated with this statepoint.
+ uint32_t getNumPatchBytes() {
+ const Value *NumPatchBytesVal = StatepointCS.getArgument(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.
OpenPOWER on IntegriCloud