[llvm-commits] [llvm] r47406 - in /llvm/trunk/lib/VMCore: Function.cpp Type.cpp Verifier.cpp
Devang Patel
dpatel at apple.com
Wed Feb 20 14:36:03 PST 2008
Author: dpatel
Date: Wed Feb 20 16:36:03 2008
New Revision: 47406
URL: http://llvm.org/viewvc/llvm-project?rev=47406&view=rev
Log:
What if functions can return aggregate values ?
One small step towards multiple return value support.
Modified:
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/Type.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47406&r1=47405&r2=47406&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Wed Feb 20 16:36:03 2008
@@ -179,7 +179,8 @@
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.
Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=47406&r1=47405&r2=47406&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Wed Feb 20 16:36:03 2008
@@ -443,7 +443,8 @@
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);
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=47406&r1=47405&r2=47406&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Feb 20 16:36:03 2008
@@ -451,7 +451,8 @@
"# 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 @@
// 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))) {
More information about the llvm-commits
mailing list