Start using the new and improve interface to FunctionType arguments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11224 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-02-09 04:14:01 +00:00
parent 36cb08ae5b
commit d5d8996720
13 changed files with 98 additions and 117 deletions

View File

@ -1668,8 +1668,8 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
// Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
FunctionType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
FunctionType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
FunctionType::param_iterator I = Ty->param_begin();
FunctionType::param_iterator E = Ty->param_end();
std::vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
@ -1869,8 +1869,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
// Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
FunctionType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
FunctionType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
FunctionType::param_iterator I = Ty->param_begin();
FunctionType::param_iterator E = Ty->param_end();
std::vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)

View File

@ -218,16 +218,16 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf,
if (FTy == 0) throw std::string("Call to non function pointer value!");
std::vector<Value *> Params;
const FunctionType::ParamTypes &PL = FTy->getParamTypes();
if (!FTy->isVarArg()) {
FunctionType::ParamTypes::const_iterator It = PL.begin();
FunctionType::param_iterator It = FTy->param_begin();
for (unsigned i = 1, e = Args.size(); i != e; ++i) {
if (It == PL.end()) throw std::string("Invalid call instruction!");
if (It == FTy->param_end())
throw std::string("Invalid call instruction!");
Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
}
if (It != PL.end()) throw std::string("Invalid call instruction!");
if (It != FTy->param_end())
throw std::string("Invalid call instruction!");
} else {
Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);
@ -268,18 +268,18 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf,
std::vector<Value *> Params;
BasicBlock *Normal, *Except;
const FunctionType::ParamTypes &PL = FTy->getParamTypes();
if (!FTy->isVarArg()) {
Normal = getBasicBlock(Args[1]);
Except = getBasicBlock(Args[2]);
FunctionType::ParamTypes::const_iterator It = PL.begin();
FunctionType::param_iterator It = FTy->param_begin();
for (unsigned i = 3, e = Args.size(); i != e; ++i) {
if (It == PL.end()) throw std::string("Invalid invoke instruction!");
if (It == FTy->param_end())
throw std::string("Invalid invoke instruction!");
Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
}
if (It != PL.end()) throw std::string("Invalid invoke instruction!");
if (It != FTy->param_end())
throw std::string("Invalid invoke instruction!");
} else {
Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);

View File

@ -381,11 +381,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// Insert arguments into the value table before we parse the first basic
// block in the function, but after we potentially read in the
// compaction table.
const FunctionType::ParamTypes &Params =
F->getFunctionType()->getParamTypes();
const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
for (FunctionType::ParamTypes::const_iterator It = Params.begin();
It != Params.end(); ++It, ++AI)
for (FunctionType::param_iterator It = FT->param_begin();
It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}
@ -404,11 +403,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// Insert arguments into the value table before we parse the first basic
// block in the function, but after we potentially read in the
// compaction table.
const FunctionType::ParamTypes &Params =
F->getFunctionType()->getParamTypes();
const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
for (FunctionType::ParamTypes::const_iterator It = Params.begin();
It != Params.end(); ++It, ++AI)
for (FunctionType::param_iterator It = FT->param_begin();
It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}
@ -424,11 +422,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// list for the function, but after we potentially read in the compaction
// table.
if (!InsertedArguments) {
const FunctionType::ParamTypes &Params =
F->getFunctionType()->getParamTypes();
const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
for (FunctionType::ParamTypes::const_iterator It = Params.begin();
It != Params.end(); ++It, ++AI)
for (FunctionType::param_iterator It = FT->param_begin();
It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}

View File

@ -34,12 +34,12 @@ void BytecodeWriter::outputType(const Type *T) {
assert(Slot != -1 && "Type used but not available!!");
output_vbr((unsigned)Slot, Out);
// Output the number of arguments to method (+1 if varargs):
output_vbr((unsigned)MT->getParamTypes().size()+MT->isVarArg(), Out);
// Output the number of arguments to function (+1 if varargs):
output_vbr((unsigned)MT->getNumParams()+MT->isVarArg(), Out);
// Output all of the arguments...
FunctionType::ParamTypes::const_iterator I = MT->getParamTypes().begin();
for (; I != MT->getParamTypes().end(); ++I) {
FunctionType::param_iterator I = MT->param_begin();
for (; I != MT->param_end(); ++I) {
Slot = Table.getSlot(*I);
assert(Slot != -1 && "Type used but not available!!");
output_vbr((unsigned)Slot, Out);

View File

@ -89,9 +89,9 @@ GenericValue Interpreter::runFunction(Function *F,
// take into account gratuitous differences in declared types,
// though.
std::vector<GenericValue> ActualArgs;
const unsigned ArgCount = F->getFunctionType()->getParamTypes().size();
const unsigned ArgCount = F->getFunctionType()->getNumParams();
for (unsigned i = 0; i < ArgCount; ++i)
ActualArgs.push_back (ArgValues[i]);
ActualArgs.push_back(ArgValues[i]);
// Set up the function call.
callFunction(F, ActualArgs);

View File

@ -201,17 +201,16 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const FunctionType *MTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
for (FunctionType::ParamTypes::const_iterator
I = MTy->getParamTypes().begin(),
E = MTy->getParamTypes().end(); I != E; ++I) {
if (I != MTy->getParamTypes().begin())
for (FunctionType::param_iterator I = MTy->param_begin(),
E = MTy->param_end(); I != E; ++I) {
if (I != MTy->param_begin())
FunctionInnards << ", ";
printType(FunctionInnards, *I, "");
}
if (MTy->isVarArg()) {
if (!MTy->getParamTypes().empty())
if (MTy->getNumParams())
FunctionInnards << ", ...";
} else if (MTy->getParamTypes().empty()) {
} else if (!MTy->getNumParams()) {
FunctionInnards << "void";
}
FunctionInnards << ")";
@ -948,10 +947,9 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
}
} else {
// Loop over the arguments, printing them...
for (FunctionType::ParamTypes::const_iterator I =
FT->getParamTypes().begin(),
E = FT->getParamTypes().end(); I != E; ++I) {
if (I != FT->getParamTypes().begin()) FunctionInnards << ", ";
for (FunctionType::param_iterator I = FT->param_begin(),
E = FT->param_end(); I != E; ++I) {
if (I != FT->param_begin()) FunctionInnards << ", ";
printType(FunctionInnards, *I);
}
}
@ -959,10 +957,10 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
// Finish printing arguments... if this is a vararg function, print the ...,
// unless there are no known types, in which case, we just emit ().
//
if (FT->isVarArg() && !FT->getParamTypes().empty()) {
if (FT->getParamTypes().size()) FunctionInnards << ", ";
if (FT->isVarArg() && FT->getNumParams()) {
if (FT->getNumParams()) FunctionInnards << ", ";
FunctionInnards << "..."; // Output varargs portion of signature!
} else if (!FT->isVarArg() && FT->getParamTypes().empty()) {
} else if (!FT->isVarArg() && FT->getNumParams() == 0) {
FunctionInnards << "void"; // ret() -> ret(void) in C.
}
FunctionInnards << ")";

View File

@ -201,17 +201,16 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const FunctionType *MTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
for (FunctionType::ParamTypes::const_iterator
I = MTy->getParamTypes().begin(),
E = MTy->getParamTypes().end(); I != E; ++I) {
if (I != MTy->getParamTypes().begin())
for (FunctionType::param_iterator I = MTy->param_begin(),
E = MTy->param_end(); I != E; ++I) {
if (I != MTy->param_begin())
FunctionInnards << ", ";
printType(FunctionInnards, *I, "");
}
if (MTy->isVarArg()) {
if (!MTy->getParamTypes().empty())
if (MTy->getNumParams())
FunctionInnards << ", ...";
} else if (MTy->getParamTypes().empty()) {
} else if (!MTy->getNumParams()) {
FunctionInnards << "void";
}
FunctionInnards << ")";
@ -948,10 +947,9 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
}
} else {
// Loop over the arguments, printing them...
for (FunctionType::ParamTypes::const_iterator I =
FT->getParamTypes().begin(),
E = FT->getParamTypes().end(); I != E; ++I) {
if (I != FT->getParamTypes().begin()) FunctionInnards << ", ";
for (FunctionType::param_iterator I = FT->param_begin(),
E = FT->param_end(); I != E; ++I) {
if (I != FT->param_begin()) FunctionInnards << ", ";
printType(FunctionInnards, *I);
}
}
@ -959,10 +957,10 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
// Finish printing arguments... if this is a vararg function, print the ...,
// unless there are no known types, in which case, we just emit ().
//
if (FT->isVarArg() && !FT->getParamTypes().empty()) {
if (FT->getParamTypes().size()) FunctionInnards << ", ";
if (FT->isVarArg() && FT->getNumParams()) {
if (FT->getNumParams()) FunctionInnards << ", ";
FunctionInnards << "..."; // Output varargs portion of signature!
} else if (!FT->isVarArg() && FT->getParamTypes().empty()) {
} else if (!FT->isVarArg() && FT->getNumParams() == 0) {
FunctionInnards << "void"; // ret() -> ret(void) in C.
}
FunctionInnards << ")";

View File

@ -304,8 +304,7 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty,
//
const PointerType *PT = cast<PointerType>(I->getOperand(0)->getType());
const FunctionType *FT = cast<FunctionType>(PT->getElementType());
std::vector<const Type *> ArgTys(FT->getParamTypes().begin(),
FT->getParamTypes().end());
std::vector<const Type *> ArgTys(FT->param_begin(), FT->param_end());
const FunctionType *NewTy =
FunctionType::get(Ty, ArgTys, FT->isVarArg());
if (!ExpressionConvertibleToType(I->getOperand(0),
@ -513,8 +512,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
//
const PointerType *PT = cast<PointerType>(I->getOperand(0)->getType());
const FunctionType *FT = cast<FunctionType>(PT->getElementType());
std::vector<const Type *> ArgTys(FT->getParamTypes().begin(),
FT->getParamTypes().end());
std::vector<const Type *> ArgTys(FT->param_begin(), FT->param_end());
const FunctionType *NewTy =
FunctionType::get(Ty, ArgTys, FT->isVarArg());
const PointerType *NewPTy = PointerType::get(NewTy);
@ -862,9 +860,8 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
// reason for this is that we prefer to have resolved functions but casted
// arguments if possible.
//
const FunctionType::ParamTypes &PTs = FTy->getParamTypes();
for (unsigned i = 0, NA = PTs.size(); i < NA; ++i)
if (!PTs[i]->isLosslesslyConvertibleTo(I->getOperand(i+1)->getType()))
for (unsigned i = 0, NA = FTy->getNumParams(); i < NA; ++i)
if (!FTy->getParamType(i)->isLosslesslyConvertibleTo(I->getOperand(i+1)->getType()))
return false; // Operands must have compatible types!
// Okay, at this point, we know that all of the arguments can be
@ -878,7 +875,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
const FunctionType *FTy = cast<FunctionType>(MPtr->getElementType());
if (!FTy->isVarArg()) return false;
if ((OpNum-1) < FTy->getParamTypes().size())
if ((OpNum-1) < FTy->getNumParams())
return false; // It's not in the varargs section...
// If we get this far, we know the value is in the varargs section of the
@ -1175,7 +1172,6 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
if (Meth == OldVal) { // Changing the function pointer?
const PointerType *NewPTy = cast<PointerType>(NewVal->getType());
const FunctionType *NewTy = cast<FunctionType>(NewPTy->getElementType());
const FunctionType::ParamTypes &PTs = NewTy->getParamTypes();
if (NewTy->getReturnType() == Type::VoidTy)
Name = ""; // Make sure not to name a void call!
@ -1191,12 +1187,13 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
// Convert over all of the call operands to their new types... but only
// convert over the part that is not in the vararg section of the call.
//
for (unsigned i = 0; i < PTs.size(); ++i)
if (Params[i]->getType() != PTs[i]) {
for (unsigned i = 0; i != NewTy->getNumParams(); ++i)
if (Params[i]->getType() != NewTy->getParamType(i)) {
// Create a cast to convert it to the right type, we know that this
// is a lossless cast...
//
Params[i] = new CastInst(Params[i], PTs[i], "callarg.cast." +
Params[i] = new CastInst(Params[i], NewTy->getParamType(i),
"callarg.cast." +
Params[i]->getName(), It);
}
Meth = NewVal; // Update call destination to new value

View File

@ -58,7 +58,7 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
const FunctionType *OldMT = Old->getFunctionType();
const FunctionType *ConcreteMT = Concrete->getFunctionType();
if (OldMT->getParamTypes().size() > ConcreteMT->getParamTypes().size() &&
if (OldMT->getNumParams() > ConcreteMT->getNumParams() &&
!ConcreteMT->isVarArg())
if (!Old->use_empty()) {
std::cerr << "WARNING: Linking function '" << Old->getName()
@ -73,14 +73,14 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
// Check to make sure that if there are specified types, that they
// match...
//
unsigned NumArguments = std::min(OldMT->getParamTypes().size(),
ConcreteMT->getParamTypes().size());
unsigned NumArguments = std::min(OldMT->getNumParams(),
ConcreteMT->getNumParams());
if (!Old->use_empty() && !Concrete->use_empty())
for (unsigned i = 0; i < NumArguments; ++i)
if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i])
if (OldMT->getParamTypes()[i]->getPrimitiveID() !=
ConcreteMT->getParamTypes()[i]->getPrimitiveID()) {
if (OldMT->getParamType(i) != ConcreteMT->getParamType(i))
if (OldMT->getParamType(i)->getPrimitiveID() !=
ConcreteMT->getParamType(i)->getPrimitiveID()) {
std::cerr << "WARNING: Function [" << Old->getName()
<< "]: Parameter types conflict for: '";
WriteTypeSymbolic(std::cerr, OldMT, &M);
@ -231,7 +231,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
if ((ConcreteF->getReturnType() == OtherF->getReturnType() ||
CallersAllIgnoreReturnValue(*OtherF)) &&
OtherF->getFunctionType()->isVarArg() &&
OtherF->getFunctionType()->getParamTypes().empty())
OtherF->getFunctionType()->getNumParams() == 0)
DontPrintWarning = true;
// Otherwise, if the non-concrete global is a global array variable with a

View File

@ -60,8 +60,8 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
const Type *RetTy = ConvertType(FT->getReturnType());
std::vector<const Type*> ArgTypes;
for (FunctionType::ParamTypes::const_iterator I = FT->getParamTypes().begin(),
E = FT->getParamTypes().end(); I != E; ++I)
for (FunctionType::param_iterator I = FT->param_begin(),
E = FT->param_end(); I != E; ++I)
ArgTypes.push_back(ConvertType(*I));
DestTy = FunctionType::get(RetTy, ArgTypes, FT->isVarArg());

View File

@ -153,15 +153,14 @@ static std::string calcTypeName(const Type *Ty,
case Type::FunctionTyID: {
const FunctionType *FTy = cast<FunctionType>(Ty);
Result = calcTypeName(FTy->getReturnType(), TypeStack, TypeNames) + " (";
for (FunctionType::ParamTypes::const_iterator
I = FTy->getParamTypes().begin(),
E = FTy->getParamTypes().end(); I != E; ++I) {
if (I != FTy->getParamTypes().begin())
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
Result += ", ";
Result += calcTypeName(*I, TypeStack, TypeNames);
}
if (FTy->isVarArg()) {
if (!FTy->getParamTypes().empty()) Result += ", ";
if (FTy->getNumParams()) Result += ", ";
Result += "...";
}
Result += ")";
@ -517,15 +516,14 @@ private :
std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
printType(FTy->getReturnType()) << " (";
for (FunctionType::ParamTypes::const_iterator
I = FTy->getParamTypes().begin(),
E = FTy->getParamTypes().end(); I != E; ++I) {
if (I != FTy->getParamTypes().begin())
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
Out << ", ";
printType(*I);
}
if (FTy->isVarArg()) {
if (!FTy->getParamTypes().empty()) Out << ", ";
if (FTy->getNumParams()) Out << ", ";
Out << "...";
}
Out << ")";
@ -689,7 +687,7 @@ void AssemblyWriter::printFunction(const Function *F) {
// Finish printing arguments...
if (FT->isVarArg()) {
if (FT->getParamTypes().size()) Out << ", ";
if (FT->getNumParams()) Out << ", ";
Out << "..."; // Output varargs portion of signature!
}
Out << ")";

View File

@ -190,15 +190,14 @@ static std::string getTypeDescription(const Type *Ty,
case Type::FunctionTyID: {
const FunctionType *FTy = cast<FunctionType>(Ty);
Result = getTypeDescription(FTy->getReturnType(), TypeStack) + " (";
for (FunctionType::ParamTypes::const_iterator
I = FTy->getParamTypes().begin(),
E = FTy->getParamTypes().end(); I != E; ++I) {
if (I != FTy->getParamTypes().begin())
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
Result += ", ";
Result += getTypeDescription(*I, TypeStack);
}
if (FTy->isVarArg()) {
if (!FTy->getParamTypes().empty()) Result += ", ";
if (FTy->getNumParams()) Result += ", ";
Result += "...";
}
Result += ")";
@ -528,13 +527,11 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2,
} else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
const FunctionType *FTy2 = cast<FunctionType>(Ty2);
if (FTy->isVarArg() != FTy2->isVarArg() ||
FTy->getParamTypes().size() != FTy2->getParamTypes().size() ||
FTy->getNumParams() != FTy2->getNumParams() ||
!TypesEqual(FTy->getReturnType(), FTy2->getReturnType(), EqTypes))
return false;
const FunctionType::ParamTypes &FTyP = FTy->getParamTypes();
const FunctionType::ParamTypes &FTy2P = FTy2->getParamTypes();
for (unsigned i = 0, e = FTyP.size(); i != e; ++i)
if (!TypesEqual(FTyP[i], FTy2P[i], EqTypes))
for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i)
if (!TypesEqual(FTy->getParamType(i), FTy2->getParamType(i), EqTypes))
return false;
return true;
} else {
@ -736,8 +733,8 @@ static TypeMap<FunctionValType, FunctionType> FunctionTypes;
FunctionValType FunctionValType::get(const FunctionType *FT) {
// Build up a FunctionValType
std::vector<const Type *> ParamTypes;
ParamTypes.reserve(FT->getParamTypes().size());
for (unsigned i = 0, e = FT->getParamTypes().size(); i != e; ++i)
ParamTypes.reserve(FT->getNumParams());
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i)
ParamTypes.push_back(FT->getParamType(i));
return FunctionValType(FT->getReturnType(), ParamTypes, FT->isVarArg());
}

View File

@ -31,14 +31,13 @@ CallInst::CallInst(Value *Func, const std::vector<Value*> &params,
Operands.reserve(1+params.size());
Operands.push_back(Use(Func, this));
const FunctionType *MTy =
const FunctionType *FTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
const FunctionType::ParamTypes &PL = MTy->getParamTypes();
assert(params.size() == PL.size() ||
(MTy->isVarArg() && params.size() > PL.size()) &&
assert((params.size() == FTy->getNumParams() ||
(FTy->isVarArg() && params.size() > FTy->getNumParams())) &&
"Calling a function with bad signature");
for (unsigned i = 0; i < params.size(); i++)
for (unsigned i = 0; i != params.size(); i++)
Operands.push_back(Use(params[i], this));
}
@ -53,8 +52,7 @@ CallInst::CallInst(Value *Func, const std::string &Name,
const FunctionType *MTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
const FunctionType::ParamTypes &PL = MTy->getParamTypes();
assert(PL.empty() && "Calling a function with bad signature");
assert(MTy->getNumParams() == 0 && "Calling a function with bad signature");
}
CallInst::CallInst(Value *Func, Value* A, const std::string &Name,
@ -68,8 +66,8 @@ CallInst::CallInst(Value *Func, Value* A, const std::string &Name,
const FunctionType *MTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
const FunctionType::ParamTypes &PL = MTy->getParamTypes();
assert(PL.size() == 1 || (MTy->isVarArg() && PL.empty()) &&
assert((MTy->getNumParams() == 1 ||
(MTy->isVarArg() && MTy->getNumParams() == 0)) &&
"Calling a function with bad signature");
Operands.push_back(Use(A, this));
}
@ -115,9 +113,8 @@ InvokeInst::InvokeInst(Value *Func, BasicBlock *IfNormal,
const FunctionType *MTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
const FunctionType::ParamTypes &PL = MTy->getParamTypes();
assert((params.size() == PL.size()) ||
(MTy->isVarArg() && params.size() > PL.size()) &&
assert((params.size() == MTy->getNumParams()) ||
(MTy->isVarArg() && params.size() > MTy->getNumParams()) &&
"Calling a function with bad signature");
for (unsigned i = 0; i < params.size(); i++)
@ -138,9 +135,8 @@ InvokeInst::InvokeInst(Value *Func, BasicBlock *IfNormal,
const FunctionType *MTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
const FunctionType::ParamTypes &PL = MTy->getParamTypes();
assert((params.size() == PL.size()) ||
(MTy->isVarArg() && params.size() > PL.size()) &&
assert((params.size() == MTy->getNumParams()) ||
(MTy->isVarArg() && params.size() > MTy->getNumParams()) &&
"Calling a function with bad signature");
for (unsigned i = 0; i < params.size(); i++)