aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-16 12:04:28 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-16 12:04:28 +0000
commit8e9b219b674a557a1e71db68fe3febdbe59c5494 (patch)
treeb3b394d8dc3863e5c498213f91250f0a1956b9b7 /lib/VMCore
parent7c4676f341a1abfe555e78fb2aac0a2d7cbe85cf (diff)
downloadexternal_llvm-8e9b219b674a557a1e71db68fe3febdbe59c5494.zip
external_llvm-8e9b219b674a557a1e71db68fe3febdbe59c5494.tar.gz
external_llvm-8e9b219b674a557a1e71db68fe3febdbe59c5494.tar.bz2
Add convinience constructor for function calls with two args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/iCall.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp
index 9a81f79..1e88be3 100644
--- a/lib/VMCore/iCall.cpp
+++ b/lib/VMCore/iCall.cpp
@@ -38,6 +38,21 @@ void CallInst::init(Value *Func, const std::vector<Value*> &Params)
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 @@ CallInst::CallInst(Value *Func, const std::vector<Value*> &Params,
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())