aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp20
-rw-r--r--lib/VMCore/Type.cpp21
-rw-r--r--lib/VMCore/iCall.cpp26
3 files changed, 29 insertions, 38 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 32cc4c7..3ed2312 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -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 << ")";
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 1fd65f4..7738955 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -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());
}
diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp
index 2d41dcd..37298f9 100644
--- a/lib/VMCore/iCall.cpp
+++ b/lib/VMCore/iCall.cpp
@@ -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++)