return Insert(PHINode::Create(Ty, NumReservedValues), Name);
}
- CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = None,
- const Twine &Name = "", MDNode *FPMathTag = nullptr) {
- auto *PTy = cast<PointerType>(Callee->getType());
- auto *FTy = cast<FunctionType>(PTy->getElementType());
- return CreateCall(FTy, Callee, Args, Name, FPMathTag);
- }
-
CallInst *CreateCall(FunctionType *FTy, Value *Callee,
- ArrayRef<Value *> Args, const Twine &Name = "",
+ ArrayRef<Value *> Args = None, const Twine &Name = "",
MDNode *FPMathTag = nullptr) {
CallInst *CI = CallInst::Create(FTy, Callee, Args, DefaultOperandBundles);
if (isa<FPMathOperator>(CI))
return Insert(CI, Name);
}
- CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ CallInst *CreateCall(FunctionType *FTy, Value *Callee, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> OpBundles,
const Twine &Name = "", MDNode *FPMathTag = nullptr) {
- CallInst *CI = CallInst::Create(Callee, Args, OpBundles);
+ CallInst *CI = CallInst::Create(FTy, Callee, Args, OpBundles);
if (isa<FPMathOperator>(CI))
CI = cast<CallInst>(setFPAttrs(CI, FPMathTag, FMF));
return Insert(CI, Name);
}
- CallInst *CreateCall(Function *Callee, ArrayRef<Value *> Args,
+ CallInst *CreateCall(Function *Callee, ArrayRef<Value *> Args = None,
const Twine &Name = "", MDNode *FPMathTag = nullptr) {
return CreateCall(Callee->getFunctionType(), Callee, Args, Name, FPMathTag);
}
+ CallInst *CreateCall(Function *Callee, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> OpBundles,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr) {
+ return CreateCall(Callee->getFunctionType(), Callee, Args, OpBundles, Name,
+ FPMathTag);
+ }
+
+ // Deprecated [opaque pointer types]
+ CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = None,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr) {
+ return CreateCall(
+ cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee,
+ Args, Name, FPMathTag);
+ }
+
+ // Deprecated [opaque pointer types]
+ CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> OpBundles,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr) {
+ return CreateCall(
+ cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee,
+ Args, OpBundles, Name, FPMathTag);
+ }
+
Value *CreateSelect(Value *C, Value *True, Value *False,
const Twine &Name = "", Instruction *MDFrom = nullptr) {
if (auto *CC = dyn_cast<Constant>(C))
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
Instruction *InsertBefore);
- inline CallInst(Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
- Instruction *InsertBefore)
- : CallInst(cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType()),
- Func, Args, Bundles, NameStr, InsertBefore) {}
-
- inline CallInst(Value *Func, ArrayRef<Value *> Args, const Twine &NameStr,
- Instruction *InsertBefore)
- : CallInst(Func, Args, None, NameStr, InsertBefore) {}
+ inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
+ const Twine &NameStr, Instruction *InsertBefore)
+ : CallInst(Ty, Func, Args, None, NameStr, InsertBefore) {}
/// Construct a CallInst given a range of arguments.
/// Construct a CallInst from a range of arguments
- inline CallInst(Value *Func, ArrayRef<Value *> Args,
+ inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
BasicBlock *InsertAtEnd);
- explicit CallInst(Value *F, const Twine &NameStr, Instruction *InsertBefore);
+ explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
+ Instruction *InsertBefore);
- CallInst(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd);
+ CallInst(FunctionType *ty, Value *F, const Twine &NameStr,
+ BasicBlock *InsertAtEnd);
- void init(Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr) {
- init(cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType()),
- Func, Args, Bundles, NameStr);
- }
void init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
- void init(Value *Func, const Twine &NameStr);
+ void init(FunctionType *FTy, Value *Func, const Twine &NameStr);
/// Compute the number of operands to allocate.
static int ComputeNumOperands(int NumArgs, int NumBundleInputs = 0) {
CallInst *cloneImpl() const;
public:
- static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = None,
- const Twine &NameStr = "",
+ static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr = "",
Instruction *InsertBefore = nullptr) {
- return Create(cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType()),
- Func, Args, Bundles, NameStr, InsertBefore);
- }
-
- static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- return Create(cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType()),
- Func, Args, None, NameStr, InsertBefore);
+ return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertBefore);
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
}
- static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr,
+ BasicBlock *InsertAtEnd) {
+ return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertAtEnd);
+ }
+
+ static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ return new (ComputeNumOperands(Args.size()))
+ CallInst(Ty, Func, Args, None, NameStr, InsertAtEnd);
+ }
+
+ static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr, BasicBlock *InsertAtEnd) {
const int NumOperands =
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
return new (NumOperands, DescriptorBytes)
- CallInst(Func, Args, Bundles, NameStr, InsertAtEnd);
+ CallInst(Ty, Func, Args, Bundles, NameStr, InsertAtEnd);
}
- static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ static CallInst *Create(Function *Func, const Twine &NameStr = "",
+ Instruction *InsertBefore = nullptr) {
+ return Create(Func->getFunctionType(), Func, NameStr, InsertBefore);
+ }
+
+ static CallInst *Create(Function *Func, ArrayRef<Value *> Args,
+ const Twine &NameStr = "",
+ Instruction *InsertBefore = nullptr) {
+ return Create(Func->getFunctionType(), Func, Args, NameStr, InsertBefore);
+ }
+
+ static CallInst *Create(Function *Func, const Twine &NameStr,
+ BasicBlock *InsertAtEnd) {
+ return Create(Func->getFunctionType(), Func, NameStr, InsertAtEnd);
+ }
+
+ static CallInst *Create(Function *Func, ArrayRef<Value *> Args,
const Twine &NameStr, BasicBlock *InsertAtEnd) {
- return new (ComputeNumOperands(Args.size()))
- CallInst(Func, Args, None, NameStr, InsertAtEnd);
+ return Create(Func->getFunctionType(), Func, Args, NameStr, InsertAtEnd);
}
- static CallInst *Create(Value *F, const Twine &NameStr = "",
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, const Twine &NameStr = "",
Instruction *InsertBefore = nullptr) {
- return new (ComputeNumOperands(0)) CallInst(F, NameStr, InsertBefore);
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, NameStr, InsertBefore);
+ }
+
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ const Twine &NameStr,
+ Instruction *InsertBefore = nullptr) {
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, Args, NameStr, InsertBefore);
}
- static CallInst *Create(Value *F, const Twine &NameStr,
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles = None,
+ const Twine &NameStr = "",
+ Instruction *InsertBefore = nullptr) {
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, Args, Bundles, NameStr, InsertBefore);
+ }
+
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, const Twine &NameStr,
BasicBlock *InsertAtEnd) {
- return new (ComputeNumOperands(0)) CallInst(F, NameStr, InsertAtEnd);
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, NameStr, InsertAtEnd);
+ }
+
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, Args, NameStr, InsertAtEnd);
+ }
+
+ // Deprecated [opaque pointer types]
+ static CallInst *Create(Value *Func, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ return Create(cast<FunctionType>(
+ cast<PointerType>(Func->getType())->getElementType()),
+ Func, Args, Bundles, NameStr, InsertAtEnd);
}
/// Create a clone of \p CI with a different set of operand bundles and
}
};
-CallInst::CallInst(Value *Func, ArrayRef<Value *> Args,
+CallInst::CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
BasicBlock *InsertAtEnd)
- : CallBase(cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType())
- ->getReturnType(),
- Instruction::Call,
+ : CallBase(Ty->getReturnType(), Instruction::Call,
OperandTraits<CallBase>::op_end(this) -
(Args.size() + CountBundleInputs(Bundles) + 1),
unsigned(Args.size() + CountBundleInputs(Bundles) + 1),
InsertAtEnd) {
- init(Func, Args, Bundles, NameStr);
+ init(Ty, Func, Args, Bundles, NameStr);
}
CallInst::CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,