Allocation insts always have one operand
[oota-llvm.git] / lib / VMCore / iCall.cpp
index d757ea2349a2a9c24f8aac0428d4f207f4bef4fe..3a0545f17425f828377a97326ffaa52acb54a87e 100644 (file)
@@ -7,22 +7,22 @@
 #include "llvm/iOther.h"
 #include "llvm/iTerminators.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 
 //===----------------------------------------------------------------------===//
 //                        CallInst Implementation
 //===----------------------------------------------------------------------===//
 
-CallInst::CallInst(Value *Meth, const std::vector<Value*> &params, 
-                   const std::string &Name) 
-  : Instruction(cast<FunctionType>(cast<PointerType>(Meth->getType())
+CallInst::CallInst(Value *Func, const std::vector<Value*> &params, 
+                   const std::string &Name, Instruction *InsertBefore
+  : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
                                 ->getElementType())->getReturnType(),
-               Instruction::Call, Name) {
+               Instruction::Call, Name, InsertBefore) {
   Operands.reserve(1+params.size());
-  Operands.push_back(Use(Meth, this));
+  Operands.push_back(Use(Func, this));
 
   const FunctionType *MTy = 
-    cast<FunctionType>(cast<PointerType>(Meth->getType())->getElementType());
+    cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
 
   const FunctionType::ParamTypes &PL = MTy->getParamTypes();
   assert((params.size() == PL.size()) || 
@@ -43,19 +43,19 @@ CallInst::CallInst(const CallInst &CI)
 //                        InvokeInst Implementation
 //===----------------------------------------------------------------------===//
 
-InvokeInst::InvokeInst(Value *Meth, BasicBlock *IfNormal, \
+InvokeInst::InvokeInst(Value *Func, BasicBlock *IfNormal,
                       BasicBlock *IfException,
                        const std::vector<Value*> &params,
-                      const std::string &Name)
-  : TerminatorInst(cast<FunctionType>(cast<PointerType>(Meth->getType())
+                      const std::string &Name, Instruction *InsertBefore)
+  : TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
                                    ->getElementType())->getReturnType(),
-                  Instruction::Invoke, Name) {
+                  Instruction::Invoke, Name, InsertBefore) {
   Operands.reserve(3+params.size());
-  Operands.push_back(Use(Meth, this));
-  Operands.push_back(Use(IfNormal, this));
-  Operands.push_back(Use(IfException, this));
+  Operands.push_back(Use(Func, this));
+  Operands.push_back(Use((Value*)IfNormal, this));
+  Operands.push_back(Use((Value*)IfException, this));
   const FunctionType *MTy = 
-    cast<FunctionType>(cast<PointerType>(Meth->getType())->getElementType());
+    cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
   
   const FunctionType::ParamTypes &PL = MTy->getParamTypes();
   assert((params.size() == PL.size()) ||