@@ -3603,36 +3603,17 @@ class InvokeInst : public CallBase {
3603
3603
// / Construct an InvokeInst given a range of arguments.
3604
3604
// /
3605
3605
// / Construct an InvokeInst from a range of arguments
3606
- inline InvokeInst (Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
3607
- ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3608
- int NumOperands, const Twine &NameStr,
3609
- Instruction *InsertBefore)
3610
- : InvokeInst (cast<FunctionType>(
3611
- cast<PointerType>(Func->getType ())->getElementType ()),
3612
- Func, IfNormal, IfException, Args, Bundles, NumOperands,
3613
- NameStr, InsertBefore) {}
3614
-
3615
3606
inline InvokeInst (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3616
3607
BasicBlock *IfException, ArrayRef<Value *> Args,
3617
3608
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
3618
3609
const Twine &NameStr, Instruction *InsertBefore);
3619
- // / Construct an InvokeInst given a range of arguments.
3620
- // /
3621
- // / Construct an InvokeInst from a range of arguments
3622
- inline InvokeInst (Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
3623
- ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3624
- int NumOperands, const Twine &NameStr,
3625
- BasicBlock *InsertAtEnd);
3626
3610
3627
- void init (Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
3628
- ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
3629
- const Twine &NameStr) {
3630
- init (cast<FunctionType>(
3631
- cast<PointerType>(Func->getType ())->getElementType ()),
3632
- Func, IfNormal, IfException, Args, Bundles, NameStr);
3633
- }
3611
+ inline InvokeInst (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3612
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3613
+ ArrayRef<OperandBundleDef> Bundles, int NumOperands,
3614
+ const Twine &NameStr, BasicBlock *InsertAtEnd);
3634
3615
3635
- void init (FunctionType *FTy , Value *Func, BasicBlock *IfNormal,
3616
+ void init (FunctionType *Ty , Value *Func, BasicBlock *IfNormal,
3636
3617
BasicBlock *IfException, ArrayRef<Value *> Args,
3637
3618
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
3638
3619
@@ -3650,27 +3631,6 @@ class InvokeInst : public CallBase {
3650
3631
InvokeInst *cloneImpl () const ;
3651
3632
3652
3633
public:
3653
- static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3654
- BasicBlock *IfException, ArrayRef<Value *> Args,
3655
- const Twine &NameStr,
3656
- Instruction *InsertBefore = nullptr ) {
3657
- return Create (cast<FunctionType>(
3658
- cast<PointerType>(Func->getType ())->getElementType ()),
3659
- Func, IfNormal, IfException, Args, None, NameStr,
3660
- InsertBefore);
3661
- }
3662
-
3663
- static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3664
- BasicBlock *IfException, ArrayRef<Value *> Args,
3665
- ArrayRef<OperandBundleDef> Bundles = None,
3666
- const Twine &NameStr = " " ,
3667
- Instruction *InsertBefore = nullptr ) {
3668
- return Create (cast<FunctionType>(
3669
- cast<PointerType>(Func->getType ())->getElementType ()),
3670
- Func, IfNormal, IfException, Args, Bundles, NameStr,
3671
- InsertBefore);
3672
- }
3673
-
3674
3634
static InvokeInst *Create (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3675
3635
BasicBlock *IfException, ArrayRef<Value *> Args,
3676
3636
const Twine &NameStr,
@@ -3695,16 +3655,16 @@ class InvokeInst : public CallBase {
3695
3655
NameStr, InsertBefore);
3696
3656
}
3697
3657
3698
- static InvokeInst *Create (Value *Func,
3699
- BasicBlock *IfNormal, BasicBlock *IfException,
3700
- ArrayRef<Value *> Args, const Twine &NameStr,
3701
- BasicBlock *InsertAtEnd) {
3658
+ static InvokeInst *Create (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3659
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3660
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
3702
3661
int NumOperands = ComputeNumOperands (Args.size ());
3703
- return new (NumOperands) InvokeInst (Func, IfNormal, IfException, Args, None,
3704
- NumOperands, NameStr, InsertAtEnd);
3662
+ return new (NumOperands)
3663
+ InvokeInst (Ty, Func, IfNormal, IfException, Args, None, NumOperands,
3664
+ NameStr, InsertAtEnd);
3705
3665
}
3706
3666
3707
- static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3667
+ static InvokeInst *Create (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3708
3668
BasicBlock *IfException, ArrayRef<Value *> Args,
3709
3669
ArrayRef<OperandBundleDef> Bundles,
3710
3670
const Twine &NameStr, BasicBlock *InsertAtEnd) {
@@ -3713,10 +3673,85 @@ class InvokeInst : public CallBase {
3713
3673
unsigned DescriptorBytes = Bundles.size () * sizeof (BundleOpInfo);
3714
3674
3715
3675
return new (NumOperands, DescriptorBytes)
3716
- InvokeInst (Func, IfNormal, IfException, Args, Bundles, NumOperands,
3676
+ InvokeInst (Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
3717
3677
NameStr, InsertAtEnd);
3718
3678
}
3719
3679
3680
+ static InvokeInst *Create (Function *Func, BasicBlock *IfNormal,
3681
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3682
+ const Twine &NameStr,
3683
+ Instruction *InsertBefore = nullptr ) {
3684
+ return Create (Func->getFunctionType (), Func, IfNormal, IfException, Args,
3685
+ None, NameStr, InsertBefore);
3686
+ }
3687
+
3688
+ static InvokeInst *Create (Function *Func, BasicBlock *IfNormal,
3689
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3690
+ ArrayRef<OperandBundleDef> Bundles = None,
3691
+ const Twine &NameStr = " " ,
3692
+ Instruction *InsertBefore = nullptr ) {
3693
+ return Create (Func->getFunctionType (), Func, IfNormal, IfException, Args,
3694
+ Bundles, NameStr, InsertBefore);
3695
+ }
3696
+
3697
+ static InvokeInst *Create (Function *Func, BasicBlock *IfNormal,
3698
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3699
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
3700
+ return Create (Func->getFunctionType (), Func, IfNormal, IfException, Args,
3701
+ NameStr, InsertAtEnd);
3702
+ }
3703
+
3704
+ static InvokeInst *Create (Function *Func, BasicBlock *IfNormal,
3705
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3706
+ ArrayRef<OperandBundleDef> Bundles,
3707
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
3708
+ return Create (Func->getFunctionType (), Func, IfNormal, IfException, Args,
3709
+ Bundles, NameStr, InsertAtEnd);
3710
+ }
3711
+
3712
+ // Deprecated [opaque pointer types]
3713
+ static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3714
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3715
+ const Twine &NameStr,
3716
+ Instruction *InsertBefore = nullptr ) {
3717
+ return Create (cast<FunctionType>(
3718
+ cast<PointerType>(Func->getType ())->getElementType ()),
3719
+ Func, IfNormal, IfException, Args, None, NameStr,
3720
+ InsertBefore);
3721
+ }
3722
+
3723
+ // Deprecated [opaque pointer types]
3724
+ static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3725
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3726
+ ArrayRef<OperandBundleDef> Bundles = None,
3727
+ const Twine &NameStr = " " ,
3728
+ Instruction *InsertBefore = nullptr ) {
3729
+ return Create (cast<FunctionType>(
3730
+ cast<PointerType>(Func->getType ())->getElementType ()),
3731
+ Func, IfNormal, IfException, Args, Bundles, NameStr,
3732
+ InsertBefore);
3733
+ }
3734
+
3735
+ // Deprecated [opaque pointer types]
3736
+ static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3737
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3738
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
3739
+ return Create (cast<FunctionType>(
3740
+ cast<PointerType>(Func->getType ())->getElementType ()),
3741
+ Func, IfNormal, IfException, Args, NameStr, InsertAtEnd);
3742
+ }
3743
+
3744
+ // Deprecated [opaque pointer types]
3745
+ static InvokeInst *Create (Value *Func, BasicBlock *IfNormal,
3746
+ BasicBlock *IfException, ArrayRef<Value *> Args,
3747
+ ArrayRef<OperandBundleDef> Bundles,
3748
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
3749
+ return Create (cast<FunctionType>(
3750
+ cast<PointerType>(Func->getType ())->getElementType ()),
3751
+ Func, IfNormal, IfException, Args, Bundles, NameStr,
3752
+ InsertAtEnd);
3753
+ }
3754
+
3720
3755
// / Create a clone of \p II with a different set of operand bundles and
3721
3756
// / insert it before \p InsertPt.
3722
3757
// /
@@ -3795,17 +3830,14 @@ InvokeInst::InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3795
3830
init (Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3796
3831
}
3797
3832
3798
- InvokeInst::InvokeInst (Value *Func, BasicBlock *IfNormal,
3833
+ InvokeInst::InvokeInst (FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
3799
3834
BasicBlock *IfException, ArrayRef<Value *> Args,
3800
3835
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
3801
3836
const Twine &NameStr, BasicBlock *InsertAtEnd)
3802
- : CallBase(cast<FunctionType>(
3803
- cast<PointerType>(Func->getType ())->getElementType())
3804
- ->getReturnType(),
3805
- Instruction::Invoke,
3837
+ : CallBase(Ty->getReturnType (), Instruction::Invoke,
3806
3838
OperandTraits<CallBase>::op_end(this ) - NumOperands, NumOperands,
3807
3839
InsertAtEnd) {
3808
- init (Func, IfNormal, IfException, Args, Bundles, NameStr);
3840
+ init (Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
3809
3841
}
3810
3842
3811
3843
// ===----------------------------------------------------------------------===//
0 commit comments