From 6756703cc73c7d433f68e9b6545d33724bbf19fc Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Thu, 8 Oct 2015 23:18:33 +0000 Subject: [PATCH] [IRBuilder] Change the `gc.statepoint` creation interface This is to enable me to address review for D13491 -- `Flags` is a bitfield of `StatepointFlags`, not an individual item out of the enum, so it should be represented as an `uint32_t`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249778 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/IRBuilder.h | 5 ++--- lib/IR/IRBuilder.cpp | 31 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h index f8e280d0043..ec7872c0660 100644 --- a/include/llvm/IR/IRBuilder.h +++ b/include/llvm/IR/IRBuilder.h @@ -25,7 +25,6 @@ #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" -#include "llvm/IR/Statepoint.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Operator.h" #include "llvm/IR/ValueHandle.h" @@ -449,7 +448,7 @@ public: /// \brief Create a call to the experimental.gc.statepoint intrinsic to /// start a new statepoint sequence. CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, - Value *ActualCallee, StatepointFlags Flags, + Value *ActualCallee, uint32_t Flags, ArrayRef CallArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, @@ -478,7 +477,7 @@ public: /// start a new statepoint sequence. InvokeInst *CreateGCStatepointInvoke( uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, - BasicBlock *NormalDest, BasicBlock *UnwindDest, StatepointFlags Flags, + BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags, ArrayRef InvokeArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name = ""); diff --git a/lib/IR/IRBuilder.cpp b/lib/IR/IRBuilder.cpp index aac1ed376d8..44741293633 100644 --- a/lib/IR/IRBuilder.cpp +++ b/lib/IR/IRBuilder.cpp @@ -250,15 +250,15 @@ CallInst *IRBuilderBase::CreateMaskedIntrinsic(Intrinsic::ID Id, template static std::vector getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes, - Value *ActualCallee, StatepointFlags Flags, - ArrayRef CallArgs, ArrayRef TransitionArgs, - ArrayRef DeoptArgs, ArrayRef GCArgs) { + Value *ActualCallee, uint32_t Flags, ArrayRef CallArgs, + ArrayRef TransitionArgs, ArrayRef DeoptArgs, + ArrayRef GCArgs) { std::vector Args; Args.push_back(B.getInt64(ID)); Args.push_back(B.getInt32(NumPatchBytes)); Args.push_back(ActualCallee); Args.push_back(B.getInt32(CallArgs.size())); - Args.push_back(B.getInt32((unsigned)Flags)); + Args.push_back(B.getInt32(Flags)); Args.insert(Args.end(), CallArgs.begin(), CallArgs.end()); Args.push_back(B.getInt32(TransitionArgs.size())); Args.insert(Args.end(), TransitionArgs.begin(), TransitionArgs.end()); @@ -272,7 +272,7 @@ getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes, template static CallInst *CreateGCStatepointCallCommon( IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes, - Value *ActualCallee, StatepointFlags Flags, ArrayRef CallArgs, + Value *ActualCallee, uint32_t Flags, ArrayRef CallArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { // Extract out the type of the callee. @@ -298,13 +298,13 @@ CallInst *IRBuilderBase::CreateGCStatepointCall( ArrayRef CallArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointCallCommon( - this, ID, NumPatchBytes, ActualCallee, StatepointFlags::None, CallArgs, - None /* No Transition Args */, DeoptArgs, GCArgs, Name); + this, ID, NumPatchBytes, ActualCallee, uint32_t(StatepointFlags::None), + CallArgs, None /* No Transition Args */, DeoptArgs, GCArgs, Name); } CallInst *IRBuilderBase::CreateGCStatepointCall( - uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, - StatepointFlags Flags, ArrayRef CallArgs, ArrayRef TransitionArgs, + uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, uint32_t Flags, + ArrayRef CallArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointCallCommon( this, ID, NumPatchBytes, ActualCallee, Flags, CallArgs, TransitionArgs, @@ -316,15 +316,15 @@ CallInst *IRBuilderBase::CreateGCStatepointCall( ArrayRef CallArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointCallCommon( - this, ID, NumPatchBytes, ActualCallee, StatepointFlags::None, CallArgs, - None, DeoptArgs, GCArgs, Name); + this, ID, NumPatchBytes, ActualCallee, uint32_t(StatepointFlags::None), + CallArgs, None, DeoptArgs, GCArgs, Name); } template static InvokeInst *CreateGCStatepointInvokeCommon( IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, - StatepointFlags Flags, ArrayRef InvokeArgs, ArrayRef TransitionArgs, + uint32_t Flags, ArrayRef InvokeArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { // Extract out the type of the callee. PointerType *FuncPtrType = cast(ActualInvokee->getType()); @@ -350,13 +350,13 @@ InvokeInst *IRBuilderBase::CreateGCStatepointInvoke( ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointInvokeCommon( this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest, - StatepointFlags::None, InvokeArgs, None /* No Transition Args*/, + uint32_t(StatepointFlags::None), InvokeArgs, None /* No Transition Args*/, DeoptArgs, GCArgs, Name); } InvokeInst *IRBuilderBase::CreateGCStatepointInvoke( uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, - BasicBlock *NormalDest, BasicBlock *UnwindDest, StatepointFlags Flags, + BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags, ArrayRef InvokeArgs, ArrayRef TransitionArgs, ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointInvokeCommon( @@ -370,7 +370,8 @@ InvokeInst *IRBuilderBase::CreateGCStatepointInvoke( ArrayRef DeoptArgs, ArrayRef GCArgs, const Twine &Name) { return CreateGCStatepointInvokeCommon( this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest, - StatepointFlags::None, InvokeArgs, None, DeoptArgs, GCArgs, Name); + uint32_t(StatepointFlags::None), InvokeArgs, None, DeoptArgs, GCArgs, + Name); } CallInst *IRBuilderBase::CreateGCResult(Instruction *Statepoint, -- 2.34.1