summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJoel Stanley <jstanley@cs.uiuc.edu>2003-02-01 00:39:58 +0000
committerJoel Stanley <jstanley@cs.uiuc.edu>2003-02-01 00:39:58 +0000
commit4b27ed9759a740367b4d5110ba42c9386e71ee37 (patch)
tree3787b5038b2475590a52a2ac0385484bc744639d /llvm/lib
parent87d76c7f016b8ddfa4b65783ddc09815049d8e2b (diff)
downloadbcm5719-llvm-4b27ed9759a740367b4d5110ba42c9386e71ee37.tar.gz
bcm5719-llvm-4b27ed9759a740367b4d5110ba42c9386e71ee37.zip
Added implementation of alternate CallInst constructors (one ctor is
for no actual parameters, and one ctor is for one actual parameter). llvm-svn: 5452
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/iCall.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/iCall.cpp b/llvm/lib/VMCore/iCall.cpp
index 3a0545f1742..888e45f7f9f 100644
--- a/llvm/lib/VMCore/iCall.cpp
+++ b/llvm/lib/VMCore/iCall.cpp
@@ -32,6 +32,41 @@ CallInst::CallInst(Value *Func, const std::vector<Value*> &params,
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());
OpenPOWER on IntegriCloud