[llvm-commits] CVS: llvm/lib/VMCore/iCall.cpp

Joel Stanley jstanley at cs.uiuc.edu
Fri Jan 31 18:41:01 PST 2003


Changes in directory llvm/lib/VMCore:

iCall.cpp updated: 1.14 -> 1.15

---
Log message:

Added implementation of alternate CallInst constructors (one ctor is
for no actual parameters, and one ctor is for one actual parameter).



---
Diffs of the changes:

Index: llvm/lib/VMCore/iCall.cpp
diff -u llvm/lib/VMCore/iCall.cpp:1.14 llvm/lib/VMCore/iCall.cpp:1.15
--- llvm/lib/VMCore/iCall.cpp:1.14	Tue Sep 10 10:45:53 2002
+++ llvm/lib/VMCore/iCall.cpp	Fri Jan 31 18:39:58 2003
@@ -32,6 +32,41 @@
     Operands.push_back(Use(params[i], this));
 }
 
+CallInst::CallInst(Value *Func, const std::string &Name,
+                   Instruction  *InsertBefore)
+  : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
+                                   ->getElementType())->getReturnType(),
+                Instruction::Call, Name, InsertBefore) {
+  Operands.reserve(1);
+  Operands.push_back(Use(Func, this));
+  
+  const FunctionType *MTy = 
+    cast<FunctionType>(cast<PointerType>(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<FunctionType>(cast<PointerType>(Func->getType())
+                                   ->getElementType())->getReturnType(),
+                Instruction::Call, Name, InsertBefore) {
+  Operands.reserve(2);
+  Operands.push_back(Use(Func, this));
+  
+  const FunctionType *MTy = 
+    cast<FunctionType>(cast<PointerType>(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());





More information about the llvm-commits mailing list