[llvm-commits] [125597] Apply Anton's patch to improve sret handling.

clattner at apple.com clattner at apple.com
Sun Apr 1 14:57:56 PDT 2007


Revision: 125597
Author:   clattner
Date:     2007-04-01 14:57:56 -0700 (Sun, 01 Apr 2007)

Log Message:
-----------
Apply Anton's patch to improve sret handling.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-types.cpp

Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-types.cpp	2007-04-01 20:33:33 UTC (rev 125596)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp	2007-04-01 21:57:56 UTC (rev 125597)
@@ -708,9 +708,10 @@
 
   FunctionType::ParamAttrsList ParamAttrs;
 
+  // Something for the return type.
+  ParamAttrs.push_back(FunctionType::NoAttributeSet);
+
   if (static_chain) {
-    // Something for the return type.
-    ParamAttrs.push_back(FunctionType::NoAttributeSet);
     // Pass the static chain in a register.
     ParamAttrs.push_back(FunctionType::InRegAttribute);
   }
@@ -796,10 +797,13 @@
   if (static_chain)
     // Pass the static chain in a register.
     ParamAttrs.push_back(FunctionType::InRegAttribute);
-
+  
+  // Handle struct return
+  if (ABIConverter.isStructReturn())
+    ParamAttrs.push_back(FunctionType::StructRetAttribute);
+  
   for (tree Args = TYPE_ARG_TYPES(type);
-       Args && TREE_VALUE(Args) != void_type_node;
-       Args = TREE_CHAIN(Args)) {
+       Args && TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)) {
     unsigned Attributes = FunctionType::NoAttributeSet;
     tree Ty = TREE_VALUE(Args);
     
@@ -816,15 +820,6 @@
       }
     }
 
-    // Handle struct return
-    if (isFirstArg) {
-      if (ABIConverter.isStructReturn()) {
-        Attributes |= FunctionType::StructRetAttribute;
-        //printf("Struct return!\n");
-      }
-      isFirstArg = false;
-    }
-
 #ifdef LLVM_TARGET_ENABLE_REGPARM
     if (TREE_CODE(Ty) == INTEGER_TYPE || TREE_CODE(Ty) == POINTER_TYPE)
       LLVM_ADJUST_REGPARM_ATTRIBUTE(Attributes, TREE_INT_CST_LOW(TYPE_SIZE(Ty)),





More information about the llvm-commits mailing list