diff options
author | Devang Patel <dpatel@apple.com> | 2008-02-20 22:36:03 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-02-20 22:36:03 +0000 |
commit | 93f9d57bcdf74a3d5d1959b6136ffd26bd1750e8 (patch) | |
tree | af15338f9bec13f18ca16ff9e984bb4f82d8a910 /lib/VMCore | |
parent | 172f3118d80db43aaa3e5dd59d4ff156230c5608 (diff) | |
download | external_llvm-93f9d57bcdf74a3d5d1959b6136ffd26bd1750e8.zip external_llvm-93f9d57bcdf74a3d5d1959b6136ffd26bd1750e8.tar.gz external_llvm-93f9d57bcdf74a3d5d1959b6136ffd26bd1750e8.tar.bz2 |
What if functions can return aggregate values ?
One small step towards multiple return value support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Function.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index cbe11f0..ee38663 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -179,7 +179,8 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, ParamAttrs(0) { SymTab = new ValueSymbolTable(); - assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy) + assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy + || getReturnType()->getTypeID() == Type::StructTyID) && "LLVM functions cannot return aggregate values!"); // If the function has arguments, mark them as lazily built. diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 3000730..42c3770 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -443,7 +443,8 @@ FunctionType::FunctionType(const Type *Result, ContainedTys = reinterpret_cast<PATypeHandle*>(this+1); NumContainedTys = Params.size() + 1; // + 1 for result type assert((Result->isFirstClassType() || Result == Type::VoidTy || - isa<OpaqueType>(Result)) && + Result->getTypeID() == Type::StructTyID || + isa<OpaqueType>(Result)) && "LLVM functions cannot return aggregates"); bool isAbstract = Result->isAbstract(); new (&ContainedTys[0]) PATypeHandle(Result, this); diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 26bb234..4bd2ba6 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -451,7 +451,8 @@ void Verifier::visitFunction(Function &F) { "# formal arguments must match # of arguments for function type!", &F, FT); Assert1(F.getReturnType()->isFirstClassType() || - F.getReturnType() == Type::VoidTy, + F.getReturnType() == Type::VoidTy || + F.getReturnType()->getTypeID() == Type::StructTyID, "Functions cannot return aggregate values!", &F); Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy, @@ -1090,7 +1091,9 @@ void Verifier::visitInstruction(Instruction &I) { // Check to make sure that only first-class-values are operands to // instructions. - Assert1(I.getOperand(i)->getType()->isFirstClassType(), + Assert1(I.getOperand(i)->getType()->isFirstClassType() + || (isa<ReturnInst>(I) + && I.getOperand(i)->getType()->getTypeID() == Type::StructTyID), "Instruction operands must be first-class values!", &I); if (Function *F = dyn_cast<Function>(I.getOperand(i))) { |