]> granicus.if.org Git - clang/commitdiff
Heed ABIArgInfo::getInReg() for return values.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 5 Jun 2013 03:00:09 +0000 (03:00 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 5 Jun 2013 03:00:09 +0000 (03:00 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183290 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
test/CodeGen/sparcv9-abi.c

index 9a8edccdef0944ae3f7837de30d7b12ed1f3e5a3..3c079cd58bbe7d9e92c131e1cf3b5e121904fbef 100644 (file)
@@ -1054,8 +1054,11 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
       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;
 
index 41b06dd01dc6efa7a356ccaa3d1a28860a6d13b5..b4c7d6854988e254b55512085956fdcdce35faa2 100644 (file)
@@ -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;