From b5f5073a1a591dd59028fc01cd04677d3d8eac10 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 22 Feb 2008 02:50:49 +0000 Subject: [PATCH] Print ret instruction that returns aggregates. llvm-svn: 47472 --- llvm/lib/VMCore/AsmWriter.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 6e1652c4c7f9..b1f15c676f0d 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1291,8 +1291,23 @@ void AssemblyWriter::printInstruction(const Instruction &I) { writeOperand(I.getOperand(op ), false); Out << ','; writeOperand(I.getOperand(op+1), false); Out << " ]"; } - } else if (isa(I) && !Operand) { - Out << " void"; + } else if (isa(I)) { + if (!Operand) + Out << " void"; + else { + if (I.getOperand(0)->getType()->isFirstClassType()) + writeOperand(I.getOperand(0), true); + else { + Constant *ROp = cast(I.getOperand(0)); + const StructType *STy = cast(ROp->getType()); + unsigned NumElems = STy->getNumElements(); + for (unsigned i = 0; i < NumElems; ++i) { + if (i) + Out << ","; + writeOperand(ROp->getOperand(i), true); + } + } + } } else if (const CallInst *CI = dyn_cast(&I)) { // Print the calling convention being used. switch (CI->getCallingConv()) {