From 2754d59c53796cb932beda13afa5aae6a5356474 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 --- lib/VMCore/AsmWriter.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 6e1652c4c7f..b1f15c676f0 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/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()) {