aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-22 02:50:49 +0000
committerDevang Patel <dpatel@apple.com>2008-02-22 02:50:49 +0000
commitec25f24dbf461576d459bb4e297716dc82a17c33 (patch)
treedde97c0fb63e9391b95c5570369f195ac927fa20
parent197be3de7f247e61c75d12dc1cb090c1c2c39f28 (diff)
Print ret instruction that returns aggregates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47472 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/AsmWriter.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 6e1652c4c7..b1f15c676f 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<ReturnInst>(I) && !Operand) {
- Out << " void";
+ } else if (isa<ReturnInst>(I)) {
+ if (!Operand)
+ Out << " void";
+ else {
+ if (I.getOperand(0)->getType()->isFirstClassType())
+ writeOperand(I.getOperand(0), true);
+ else {
+ Constant *ROp = cast<Constant>(I.getOperand(0));
+ const StructType *STy = cast<StructType>(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<CallInst>(&I)) {
// Print the calling convention being used.
switch (CI->getCallingConv()) {