1 //===-- iCall.cpp - Implement the call & icall instructions ------*- C++ -*--=//
3 // This file implements the call and icall instructions.
5 //===----------------------------------------------------------------------===//
7 #include "llvm/iOther.h"
8 #include "llvm/DerivedTypes.h"
9 #include "llvm/Method.h"
11 CallInst::CallInst(Method *M, const vector<Value*> ¶ms,
13 : Instruction(M->getReturnType(), Instruction::Call, Name) {
15 Operands.reserve(1+params.size());
16 Operands.push_back(Use(M, this));
18 const MethodType::ParamTypes &PL = M->getMethodType()->getParamTypes();
19 assert((params.size() == PL.size()) ||
20 (M->getMethodType()->isVarArg() && params.size() > PL.size()) &&
21 "Calling a function with bad signature");
23 MethodType::ParamTypes::const_iterator It = PL.begin();
25 for (unsigned i = 0; i < params.size(); i++)
26 Operands.push_back(Use(params[i], this));
29 CallInst::CallInst(const CallInst &CI)
30 : Instruction(CI.getType(), Instruction::Call) {
31 Operands.reserve(CI.Operands.size());
32 for (unsigned i = 0; i < CI.Operands.size(); ++i)
33 Operands.push_back(Use(CI.Operands[i], this));