[llvm-branch-commits] [llvm-gcc-branch] r90921 - /llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Tue Dec 8 17:23:36 PST 2009


Author: void
Date: Tue Dec  8 19:23:36 2009
New Revision: 90921

URL: http://llvm.org/viewvc/llvm-project?rev=90921&view=rev
Log:
$ svn merge -c 90914 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r90914 into '.':
U    gcc/llvm-convert.cpp


Modified:
    llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp?rev=90921&r1=90920&r2=90921&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp Tue Dec  8 19:23:36 2009
@@ -2776,8 +2776,26 @@
     return 0;
 
   if (Client.isAggrReturn()) {
-    Value *Dest = BitCastToType(DestLoc->Ptr, Call->getType()->getPointerTo());
-    LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,Dest,DestLoc->Volatile,Builder);
+    if (TD.getTypeAllocSize(Call->getType()) <= TD.getTypeAllocSize(DestLoc->Ptr->getType())) {
+      Value *Dest = BitCastToType(DestLoc->Ptr, Call->getType()->getPointerTo());
+      LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,Dest,DestLoc->Volatile,Builder);
+    } else {
+      // The call will return an aggregate value in registers, but
+      // those registers are bigger than DestLoc.  Allocate a
+      // temporary to match the registers, store the registers there,
+      // cast the temporary into the correct (smaller) type, and using
+      // the correct type, copy the value into DestLoc.  Assume the
+      // optimizer will delete the temporary and clean this up.
+      AllocaInst *biggerTmp = CreateTemporary(Call->getType());
+      LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,biggerTmp,/*Volatile=*/false,
+					 Builder);
+      EmitAggregateCopy(*DestLoc,
+			MemRef(BitCastToType(biggerTmp,Call->getType()->
+					     getPointerTo()),
+			       DestLoc->getAlignment(),
+			       DestLoc->Volatile),
+			TREE_TYPE(exp));
+    }
     return 0;
   }
 





More information about the llvm-branch-commits mailing list