[IRBuilder] Change the `gc.statepoint` creation interface
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 8 Oct 2015 23:18:33 +0000 (23:18 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 8 Oct 2015 23:18:33 +0000 (23:18 +0000)
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
lib/IR/IRBuilder.cpp

index f8e280d0043df6ae15c84949bd2fcc93e5100d75..ec7872c0660f3ec4a5104ce5051d59d11ecb2852 100644 (file)
@@ -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<Use> CallArgs,
                                    ArrayRef<Use> TransitionArgs,
                                    ArrayRef<Use> 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<Use> InvokeArgs, ArrayRef<Use> TransitionArgs,
       ArrayRef<Use> DeoptArgs, ArrayRef<Value *> GCArgs,
       const Twine &Name = "");
index aac1ed376d82d87903c54a729f9496d371f1744a..447412936335c069699a8b8891aef0d551b41bae 100644 (file)
@@ -250,15 +250,15 @@ CallInst *IRBuilderBase::CreateMaskedIntrinsic(Intrinsic::ID Id,
 template <typename T0, typename T1, typename T2, typename T3>
 static std::vector<Value *>
 getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes,
-                  Value *ActualCallee, StatepointFlags Flags,
-                  ArrayRef<T0> CallArgs, ArrayRef<T1> TransitionArgs,
-                  ArrayRef<T2> DeoptArgs, ArrayRef<T3> GCArgs) {
+                  Value *ActualCallee, uint32_t Flags, ArrayRef<T0> CallArgs,
+                  ArrayRef<T1> TransitionArgs, ArrayRef<T2> DeoptArgs,
+                  ArrayRef<T3> GCArgs) {
   std::vector<Value *> 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 <typename T0, typename T1, typename T2, typename T3>
 static CallInst *CreateGCStatepointCallCommon(
     IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes,
-    Value *ActualCallee, StatepointFlags Flags, ArrayRef<T0> CallArgs,
+    Value *ActualCallee, uint32_t Flags, ArrayRef<T0> CallArgs,
     ArrayRef<T1> TransitionArgs, ArrayRef<T2> DeoptArgs, ArrayRef<T3> GCArgs,
     const Twine &Name) {
   // Extract out the type of the callee.
@@ -298,13 +298,13 @@ CallInst *IRBuilderBase::CreateGCStatepointCall(
     ArrayRef<Value *> CallArgs, ArrayRef<Value *> DeoptArgs,
     ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointCallCommon<Value *, Value *, Value *, Value *>(
-      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<Use> CallArgs, ArrayRef<Use> TransitionArgs,
+    uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, uint32_t Flags,
+    ArrayRef<Use> CallArgs, ArrayRef<Use> TransitionArgs,
     ArrayRef<Use> DeoptArgs, ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointCallCommon<Use, Use, Use, Value *>(
       this, ID, NumPatchBytes, ActualCallee, Flags, CallArgs, TransitionArgs,
@@ -316,15 +316,15 @@ CallInst *IRBuilderBase::CreateGCStatepointCall(
     ArrayRef<Use> CallArgs, ArrayRef<Value *> DeoptArgs,
     ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointCallCommon<Use, Value *, Value *, Value *>(
-      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 <typename T0, typename T1, typename T2, typename T3>
 static InvokeInst *CreateGCStatepointInvokeCommon(
     IRBuilderBase *Builder, uint64_t ID, uint32_t NumPatchBytes,
     Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest,
-    StatepointFlags Flags, ArrayRef<T0> InvokeArgs, ArrayRef<T1> TransitionArgs,
+    uint32_t Flags, ArrayRef<T0> InvokeArgs, ArrayRef<T1> TransitionArgs,
     ArrayRef<T2> DeoptArgs, ArrayRef<T3> GCArgs, const Twine &Name) {
   // Extract out the type of the callee.
   PointerType *FuncPtrType = cast<PointerType>(ActualInvokee->getType());
@@ -350,13 +350,13 @@ InvokeInst *IRBuilderBase::CreateGCStatepointInvoke(
     ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointInvokeCommon<Value *, Value *, Value *, Value *>(
       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<Use> InvokeArgs, ArrayRef<Use> TransitionArgs,
     ArrayRef<Use> DeoptArgs, ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointInvokeCommon<Use, Use, Use, Value *>(
@@ -370,7 +370,8 @@ InvokeInst *IRBuilderBase::CreateGCStatepointInvoke(
     ArrayRef<Value *> DeoptArgs, ArrayRef<Value *> GCArgs, const Twine &Name) {
   return CreateGCStatepointInvokeCommon<Use, Value *, Value *, Value *>(
       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,