Author: stoklund
Date: Tue Jun  4 22:00:09 2013
New Revision: 183290

URL: http://llvm.org/viewvc/llvm-project?rev=183290&view=rev
Log:
Heed ABIArgInfo::getInReg() for return values.

The 'inreg' attribute can also be applied to function return values in
LLVM IR. The SPARC v9 backend is using the flag when returning structs
containing 32-bit floats.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/sparcv9-abi.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=183290&r1=183289&r2=183290&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Jun  4 22:00:09 2013
@@ -1054,8 +1054,11 @@ void CodeGenModule::ConstructAttributeLi
       RetAttrs.addAttribute(llvm::Attribute::SExt);
     else if (RetTy->hasUnsignedIntegerRepresentation())
       RetAttrs.addAttribute(llvm::Attribute::ZExt);
-    break;
+    // FALL THROUGH
   case ABIArgInfo::Direct:
+    if (RetAI.getInReg())
+      RetAttrs.addAttribute(llvm::Attribute::InReg);
+    break;
   case ABIArgInfo::Ignore:
     break;
 

Modified: cfe/trunk/test/CodeGen/sparcv9-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sparcv9-abi.c?rev=183290&r1=183289&r2=183290&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/sparcv9-abi.c (original)
+++ cfe/trunk/test/CodeGen/sparcv9-abi.c Tue Jun  4 22:00:09 2013
@@ -73,8 +73,7 @@ struct mixed {
   float b;
 };
 
-// CHECK: @f_mixed(i32 inreg %x.coerce0, float inreg %x.coerce1)
-// FIXME: The return value should also be 'inreg'.
+// CHECK: define inreg %struct.mixed @f_mixed(i32 inreg %x.coerce0, float 
inreg %x.coerce1)
 struct mixed f_mixed(struct mixed x) {
   x.a += 1;
   return x;


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to