[llvm-branch-commits] [cfe-branch] r195385 - Merging r195268:

Bill Wendling isanbard at gmail.com
Thu Nov 21 15:31:45 PST 2013


Author: void
Date: Thu Nov 21 17:31:45 2013
New Revision: 195385

URL: http://llvm.org/viewvc/llvm-project?rev=195385&view=rev
Log:
Merging r195268:
------------------------------------------------------------------------
r195268 | jholewinski | 2013-11-20 12:35:34 -0800 (Wed, 20 Nov 2013) | 3 lines

[NVPTX] Update ABI handling

For PTX, we want the target to handle struct returns directly.
------------------------------------------------------------------------

Added:
    cfe/branches/release_34/test/CodeGen/nvptx-abi.c
      - copied unchanged from r195268, cfe/trunk/test/CodeGen/nvptx-abi.c
Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/CodeGen/TargetInfo.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 21 17:31:45 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195283
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/CodeGen/TargetInfo.cpp?rev=195385&r1=195384&r2=195385&view=diff
==============================================================================
--- cfe/branches/release_34/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/release_34/lib/CodeGen/TargetInfo.cpp Thu Nov 21 17:31:45 2013
@@ -4197,16 +4197,26 @@ private:
 ABIArgInfo NVPTXABIInfo::classifyReturnType(QualType RetTy) const {
   if (RetTy->isVoidType())
     return ABIArgInfo::getIgnore();
-  if (isAggregateTypeForABI(RetTy))
-    return ABIArgInfo::getIndirect(0);
-  return ABIArgInfo::getDirect();
+
+  // note: this is different from default ABI
+  if (!RetTy->isScalarType())
+    return ABIArgInfo::getDirect();
+
+  // Treat an enum type as its underlying type.
+  if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
+    RetTy = EnumTy->getDecl()->getIntegerType();
+
+  return (RetTy->isPromotableIntegerType() ?
+          ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
 }
 
 ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const {
-  if (isAggregateTypeForABI(Ty))
-    return ABIArgInfo::getIndirect(0);
+  // Treat an enum type as its underlying type.
+  if (const EnumType *EnumTy = Ty->getAs<EnumType>())
+    Ty = EnumTy->getDecl()->getIntegerType();
 
-  return ABIArgInfo::getDirect();
+  return (Ty->isPromotableIntegerType() ?
+          ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
 }
 
 void NVPTXABIInfo::computeInfo(CGFunctionInfo &FI) const {





More information about the llvm-branch-commits mailing list