diff options
author | James Y Knight <jyknight@google.com> | 2019-01-14 21:37:42 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2019-01-14 21:37:42 +0000 |
commit | f956390954f30ed97b1d1518a9f695b4dc84a972 (patch) | |
tree | 2fa1315f6b8e17a687f5a01e56c46ca183ad342d /llvm/lib/IR/Instructions.cpp | |
parent | 93bfb99ffc7ea9c828c3679ecc61719de453a8d0 (diff) | |
download | bcm5719-llvm-f956390954f30ed97b1d1518a9f695b4dc84a972.tar.gz bcm5719-llvm-f956390954f30ed97b1d1518a9f695b4dc84a972.zip |
[opaque pointer types] Update CallInst creation APIs to consistently
accept a callee-type argument.
Note: this also adds a new C API and soft-deprecates the old C API.
Differential Revision: https://reviews.llvm.org/D56556
llvm-svn: 351121
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index c7437f6f4c5..d88779bae73 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -388,9 +388,8 @@ void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args, setName(NameStr); } -void CallInst::init(Value *Func, const Twine &NameStr) { - FTy = - cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType()); +void CallInst::init(FunctionType *FTy, Value *Func, const Twine &NameStr) { + this->FTy = FTy; assert(getNumOperands() == 1 && "NumOperands not set up?"); setCalledOperand(Func); @@ -399,22 +398,18 @@ void CallInst::init(Value *Func, const Twine &NameStr) { setName(NameStr); } -CallInst::CallInst(Value *Func, const Twine &Name, Instruction *InsertBefore) - : CallBase(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()) - ->getReturnType(), - Instruction::Call, OperandTraits<CallBase>::op_end(this) - 1, 1, - InsertBefore) { - init(Func, Name); +CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name, + Instruction *InsertBefore) + : CallBase(Ty->getReturnType(), Instruction::Call, + OperandTraits<CallBase>::op_end(this) - 1, 1, InsertBefore) { + init(Ty, Func, Name); } -CallInst::CallInst(Value *Func, const Twine &Name, BasicBlock *InsertAtEnd) - : CallBase(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()) - ->getReturnType(), - Instruction::Call, OperandTraits<CallBase>::op_end(this) - 1, 1, - InsertAtEnd) { - init(Func, Name); +CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name, + BasicBlock *InsertAtEnd) + : CallBase(Ty->getReturnType(), Instruction::Call, + OperandTraits<CallBase>::op_end(this) - 1, 1, InsertAtEnd) { + init(Ty, Func, Name); } CallInst::CallInst(const CallInst &CI) |