From 95e8b1c9760dfdd93964da81d5003762683c61da Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Sat, 1 Feb 2003 00:39:58 +0000 Subject: [PATCH] Added implementation of alternate CallInst constructors (one ctor is for no actual parameters, and one ctor is for one actual parameter). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5452 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/iCall.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp index 3a0545f1742..888e45f7f9f 100644 --- a/lib/VMCore/iCall.cpp +++ b/lib/VMCore/iCall.cpp @@ -32,6 +32,41 @@ CallInst::CallInst(Value *Func, const std::vector ¶ms, Operands.push_back(Use(params[i], this)); } +CallInst::CallInst(Value *Func, const std::string &Name, + Instruction *InsertBefore) + : Instruction(cast(cast(Func->getType()) + ->getElementType())->getReturnType(), + Instruction::Call, Name, InsertBefore) { + Operands.reserve(1); + Operands.push_back(Use(Func, this)); + + const FunctionType *MTy = + cast(cast(Func->getType())->getElementType()); + + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); + assert((0 == PL.size()) || + (MTy->isVarArg() && 0 >= PL.size()) && + "Calling a function with bad signature"); +} + +CallInst::CallInst(Value *Func, Value* A, const std::string &Name, + Instruction *InsertBefore) + : Instruction(cast(cast(Func->getType()) + ->getElementType())->getReturnType(), + Instruction::Call, Name, InsertBefore) { + Operands.reserve(2); + Operands.push_back(Use(Func, this)); + + const FunctionType *MTy = + cast(cast(Func->getType())->getElementType()); + + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); + assert((1 == PL.size()) || + (MTy->isVarArg() && 1 >= PL.size()) && + "Calling a function with bad signature"); + Operands.push_back(Use(A, this)); +} + CallInst::CallInst(const CallInst &CI) : Instruction(CI.getType(), Instruction::Call) { Operands.reserve(CI.Operands.size()); -- 2.34.1