[llvm-commits] [126379] apply reid's patch for PR1146

clattner at apple.com clattner at apple.com
Sat Apr 21 22:52:14 PDT 2007


Revision: 126379
Author:   clattner
Date:     2007-04-21 22:52:13 -0700 (Sat, 21 Apr 2007)

Log Message:
-----------
apply reid's patch for PR1146

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-21 06:48:37 UTC (rev 126378)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp	2007-04-22 05:52:13 UTC (rev 126379)
@@ -751,15 +751,17 @@
   for (; Args && TREE_TYPE(Args) != void_type_node; Args = TREE_CHAIN(Args))
     ABIConverter.HandleArgument(TREE_TYPE(Args));
 
-  ParamAttrsList *ParamAttrs = 0;
+  ParamAttrsList *PAL = 0;
 
   if (static_chain) {
     // Pass the static chain in a register.
-    ParamAttrs = new ParamAttrsList();
-    ParamAttrs->addAttributes(1, ParamAttr::InReg);
+    ParamAttrsVector Attrs;
+    ParamAttrsWithIndex PAWI; PAWI.index = 1; PAWI.attrs = ParamAttr::InReg;
+    Attrs.push_back(PAWI);
+    PAL = ParamAttrsList::get(Attrs);
   }
 
-  return FunctionType::get(RetTy, ArgTys, false, ParamAttrs);
+  return FunctionType::get(RetTy, ArgTys, false, PAL);
 }
 
 const FunctionType *TypeConverter::ConvertFunctionType(tree type,
@@ -811,7 +813,7 @@
   // the parameter attribute in the FunctionType so any arguments passed to
   // the function will be correctly sign or zero extended to 32-bits by
   // the LLVM code gen.
-  ParamAttrsList Attrs;
+  ParamAttrsVector Attrs;
   uint16_t RAttributes = ParamAttr::None;
   if (CallingConv == CallingConv::C) {
     tree ResultTy = TREE_TYPE(type);  
@@ -827,8 +829,10 @@
           RAttributes |= ParamAttr::SExt;
     }
   }
-  if (RAttributes != ParamAttr::None)
-    Attrs.addAttributes(0, RAttributes);
+  if (RAttributes != ParamAttr::None) {
+    ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = RAttributes;
+    Attrs.push_back(PAWI);
+  }
   
   unsigned Idx = 1;
   bool isFirstArg = true;
@@ -838,16 +842,21 @@
   LLVM_TARGET_INIT_REGPARM(lparam, type);
 #endif // LLVM_TARGET_ENABLE_REGPARM
 
-  if (static_chain)
+  if (static_chain) {
     // Pass the static chain in a register.
-    Attrs.addAttributes(Idx++, ParamAttr::InReg);
+    ParamAttrsWithIndex PAWI; PAWI.index = Idx++; PAWI.attrs = ParamAttr::InReg;
+    Attrs.push_back(PAWI);
+  }
   
   // The struct return attribute must be associated with the first
   // parameter but that parameter may have other attributes too so we set up
   // the first Attributes value here based on struct return. This only works
   // Handle the structure return calling convention
-  if (ABIConverter.isStructReturn())
-    Attrs.addAttributes(Idx++, ParamAttr::StructRet);
+  if (ABIConverter.isStructReturn()) {
+    ParamAttrsWithIndex PAWI; 
+    PAWI.index = Idx++; PAWI.attrs = ParamAttr::StructRet;
+    Attrs.push_back(PAWI);
+  }
   
   for (tree Args = TYPE_ARG_TYPES(type);
        Args && TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)) {
@@ -873,18 +882,20 @@
                                     isVarArg, lparam);
 #endif // LLVM_TARGET_ENABLE_REGPARM
 
-    if (Attributes != ParamAttr::None)
-      Attrs.addAttributes(Idx, Attributes);
+    if (Attributes != ParamAttr::None) {
+     ParamAttrsWithIndex PAWI; PAWI.index = Idx; PAWI.attrs = Attributes;
+     Attrs.push_back(PAWI);
+    }
     Idx++;
   }
 
   // Only instantiate the parameter attributes if we got some
-  ParamAttrsList *ParamAttrs = 0;
+  ParamAttrsList *PAL = 0;
   if (!Attrs.empty())
-    ParamAttrs = new ParamAttrsList(Attrs);
+    PAL = ParamAttrsList::get(Attrs);
 
   // Finally, make the function type
-  return FunctionType::get(RetTy, ArgTypes, isVarArg, ParamAttrs);
+  return FunctionType::get(RetTy, ArgTypes, isVarArg, PAL);
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list