[llvm-commits] CVS: llvm/lib/VMCore/iCall.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Fri Jul 16 05:04:38 PDT 2004
Changes in directory llvm/lib/VMCore:
iCall.cpp updated: 1.25 -> 1.26
---
Log message:
Add convinience constructor for function calls with two args.
---
Diffs of the changes: (+31 -0)
Index: llvm/lib/VMCore/iCall.cpp
diff -u llvm/lib/VMCore/iCall.cpp:1.25 llvm/lib/VMCore/iCall.cpp:1.26
--- llvm/lib/VMCore/iCall.cpp:1.25 Wed May 26 19:15:23 2004
+++ llvm/lib/VMCore/iCall.cpp Fri Jul 16 07:04:28 2004
@@ -38,6 +38,21 @@
Operands.push_back(Use(Params[i], this));
}
+void CallInst::init(Value *Func, Value *Actual1, Value *Actual2)
+{
+ Operands.reserve(3);
+ Operands.push_back(Use(Func, this));
+
+ const FunctionType *MTy =
+ cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
+
+ assert((MTy->getNumParams() == 2 ||
+ (MTy->isVarArg() && MTy->getNumParams() == 0)) &&
+ "Calling a function with bad signature");
+ Operands.push_back(Use(Actual1, this));
+ Operands.push_back(Use(Actual2, this));
+}
+
void CallInst::init(Value *Func, Value *Actual)
{
Operands.reserve(2);
@@ -79,6 +94,22 @@
init(Func, Params);
}
+CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
+ const std::string &Name, Instruction *InsertBefore)
+ : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
+ ->getElementType())->getReturnType(),
+ Instruction::Call, Name, InsertBefore) {
+ init(Func, Actual1, Actual2);
+}
+
+CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
+ const std::string &Name, BasicBlock *InsertAtEnd)
+ : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
+ ->getElementType())->getReturnType(),
+ Instruction::Call, Name, InsertAtEnd) {
+ init(Func, Actual1, Actual2);
+}
+
CallInst::CallInst(Value *Func, Value* Actual, const std::string &Name,
Instruction *InsertBefore)
: Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
More information about the llvm-commits
mailing list