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, 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* MT = M->getMethodType();
19 const MethodType::ParamTypes &PL = MT->getParamTypes();
20 assert(params.size() == PL.size() && "Calling a function with bad signature");
22 MethodType::ParamTypes::const_iterator It = PL.begin();
24 for (unsigned i = 0; i < params.size(); i++) {
25 assert(*It++ == params[i]->getType() && "Call Operands not correct type!");
26 Operands.push_back(Use(params[i], this));
30 CallInst::CallInst(const CallInst &CI)
31 : Instruction(CI.getType(), Instruction::Call) {
32 Operands.reserve(CI.Operands.size());
33 for (unsigned i = 0; i < CI.Operands.size(); ++i)
34 Operands.push_back(Use(CI.Operands[i], this));