[llvm-commits] [llvm-gcc-4.2] r48291 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-internal.h llvm-types.cpp

Chris Lattner sabre at nondot.org
Wed Mar 12 10:46:50 PDT 2008


Author: lattner
Date: Wed Mar 12 12:46:50 2008
New Revision: 48291

URL: http://llvm.org/viewvc/llvm-project?rev=48291&view=rev
Log:
Update to match changes in LLVM repo for parameter attributes.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-internal.h
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=48291&r1=48290&r2=48291&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Mar 12 12:46:50 2008
@@ -1154,7 +1154,7 @@
     Function *FnEntry = TheModule->getFunction(Name);
     if (FnEntry == 0) {
       unsigned CC;
-      const ParamAttrsList *PAL;
+      PAListPtr PAL;
       const FunctionType *Ty = 
         TheTypeConverter->ConvertFunctionType(TREE_TYPE(decl), decl, NULL,
                                               CC, PAL);

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=48291&r1=48290&r2=48291&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Mar 12 12:46:50 2008
@@ -34,7 +34,6 @@
 #include "llvm/InlineAsm.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
-#include "llvm/ParamAttrsList.h"
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/System/Host.h"
 #include "llvm/Support/MathExtras.h"
@@ -533,7 +532,7 @@
   tree static_chain = cfun->static_chain_decl;
   const FunctionType *FTy;
   unsigned CallingConv;
-  const ParamAttrsList *PAL;
+  PAListPtr PAL;
 
   // If the function has no arguments and is varargs (...), turn it into a
   // non-varargs function by scanning the param list for the function.  This
@@ -2282,7 +2281,7 @@
          && "Not calling a function pointer?");
   tree function_type = TREE_TYPE(TREE_TYPE (TREE_OPERAND (exp, 0)));
   unsigned CallingConv;
-  const ParamAttrsList *PAL;
+  PAListPtr PAL;
 
   const Type *Ty = TheTypeConverter->ConvertFunctionType(function_type,
                                                          fndecl,
@@ -2447,15 +2446,16 @@
 /// in the CALL_EXP 'exp'.  If the result of the call is a scalar, return the
 /// result, otherwise store it in DestLoc.
 Value *TreeToLLVM::EmitCallOf(Value *Callee, tree exp, const MemRef *DestLoc,
-                              const ParamAttrsList *PAL) {
-  if (!PAL && isa<Function>(Callee))
+                              const PAListPtr &InPAL) {
+  PAListPtr PAL = InPAL;
+  if (PAL.isEmpty() && isa<Function>(Callee))
     PAL = cast<Function>(Callee)->getParamAttrs();
 
   // Determine if we need to generate an invoke instruction (instead of a simple
   // call) and if so, what the exception destination will be.
   BasicBlock *LandingPad = 0;
   bool NoUnwind =
-    (PAL && PAL->paramHasAttr(0, ParamAttr::NoUnwind)) ||
+    (PAL.paramHasAttr(0, ParamAttr::NoUnwind)) ||
     !tree_could_throw_p(exp);
 
   // Do not turn nounwind calls into invokes.
@@ -2485,7 +2485,7 @@
   if (NoUnwind)
     // This particular call does not unwind even though the callee may
     // unwind in general.  Add the 'nounwind' attribute to the call.
-    PAL = ParamAttrsList::includeAttrs(PAL, 0, ParamAttr::NoUnwind);
+    PAL = PAL.addAttr(0, ParamAttr::NoUnwind);
 
   SmallVector<Value*, 16> CallOperands;
   CallingConv::ID CallingConvention;
@@ -2535,7 +2535,7 @@
       ParameterAttributes Attributes = ParamAttr::None;
       ABIConverter.HandleArgument(TREE_TYPE(TREE_VALUE(arg)), &Attributes);
       if (Attributes != ParamAttr::None)
-        PAL= ParamAttrsList::includeAttrs(PAL, CallOperands.size(), Attributes);
+        PAL = PAL.addAttr(CallOperands.size(), Attributes);
     }
   }
 
@@ -4109,7 +4109,7 @@
         Intrinsic::getDeclaration(TheModule, IntrinsicID);
     }
 
-    Result = EmitCallOf(TargetBuiltinCache[FnCode], exp, DestLoc, 0);
+    Result = EmitCallOf(TargetBuiltinCache[FnCode], exp, DestLoc, PAListPtr());
     return true;
   }
   

Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=48291&r1=48290&r2=48291&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Wed Mar 12 12:46:50 2008
@@ -157,7 +157,7 @@
                                           tree_node *decl,
                                           tree_node *static_chain,
                                           unsigned &CallingConv,
-                                          const ParamAttrsList *&PAL);
+                                          PAListPtr &PAL);
   
   /// ConvertArgListToFnType - Given a DECL_ARGUMENTS list on an GCC tree,
   /// return the LLVM type corresponding to the function.  This is useful for
@@ -166,7 +166,7 @@
                                              tree_node *arglist,
                                              tree_node *static_chain,
                                              unsigned &CallingConv,
-                                             const ParamAttrsList *&PAL);
+                                             PAListPtr &PAL);
   
 private:
   const Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
@@ -478,7 +478,7 @@
   Value *EmitOBJ_TYPE_REF(tree_node *exp);
   Value *EmitCALL_EXPR(tree_node *exp, const MemRef *DestLoc);
   Value *EmitCallOf(Value *Callee, tree_node *exp, const MemRef *DestLoc,
-                    const ParamAttrsList *PAL);
+                    const PAListPtr &PAL);
   Value *EmitMODIFY_EXPR(tree_node *exp, const MemRef *DestLoc);
   Value *EmitNOP_EXPR(tree_node *exp, const MemRef *DestLoc);
   Value *EmitCONVERT_EXPR(tree_node *exp, const MemRef *DestLoc);

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=48291&r1=48290&r2=48291&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Wed Mar 12 12:46:50 2008
@@ -29,7 +29,6 @@
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
-#include "llvm/ParamAttrsList.h"
 #include "llvm/TypeSymbolTable.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
@@ -864,8 +863,7 @@
       
     // No declaration to pass through, passing NULL.
     unsigned CallingConv;
-    const ParamAttrsList *PAL;
-
+    PAListPtr PAL;
     return TypeDB.setType(type, ConvertFunctionType(type, NULL, NULL,
                                                     CallingConv, PAL));
   }
@@ -1019,7 +1017,7 @@
 /// specified result type for the function.
 const FunctionType *TypeConverter::
 ConvertArgListToFnType(tree ReturnType, tree Args, tree static_chain,
-                       unsigned &CallingConv, const ParamAttrsList *&PAL) {
+                       unsigned &CallingConv, PAListPtr &PAL) {
   std::vector<PATypeHolder> ArgTys;
   PATypeHolder RetTy(Type::VoidTy);
   
@@ -1029,7 +1027,7 @@
   // Builtins are always prototyped, so this isn't one.
   ABIConverter.HandleReturnType(ReturnType, false);
 
-  ParamAttrsVector Attrs;
+  SmallVector<ParamAttrsWithIndex, 8> Attrs;
 
   // Compute whether the result needs to be zext or sext'd.
   ParameterAttributes RAttributes = HandleArgumentExtension(ReturnType);
@@ -1065,16 +1063,13 @@
       Attrs.push_back(ParamAttrsWithIndex::get(ArgTys.size(), Attributes));
   }
 
-  PAL = 0;
-  if (!Attrs.empty())
-    PAL = ParamAttrsList::get(Attrs);
-
+  PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
   return GetFunctionType(RetTy, ArgTys, false);
 }
 
 const FunctionType *TypeConverter::
 ConvertFunctionType(tree type, tree decl, tree static_chain,
-                    unsigned &CallingConv, const ParamAttrsList *&PAL) {
+                    unsigned &CallingConv, PAListPtr &PAL) {
   PATypeHolder RetTy = Type::VoidTy;
   std::vector<PATypeHolder> ArgTypes;
   bool isVarArg = false;
@@ -1090,7 +1085,7 @@
 #endif
 
   // Compute attributes for return type (and function attributes).
-  ParamAttrsVector Attrs;
+  SmallVector<ParamAttrsWithIndex, 8> Attrs;
   ParameterAttributes RAttributes = ParamAttr::None;
 
   int flags = flags_from_decl_or_type(decl ? decl : type);
@@ -1222,8 +1217,8 @@
   // write to struct arguments passed by value, but in LLVM this becomes a
   // write through the byval pointer argument, which LLVM does not allow for
   // readonly/readnone functions.
-  if (HasByVal && Attrs[0].index == 0) {
-    ParameterAttributes &RAttrs = Attrs[0].attrs;
+  if (HasByVal && Attrs[0].Index == 0) {
+    ParameterAttributes &RAttrs = Attrs[0].Attrs;
     RAttrs &= ~(ParamAttr::ReadNone | ParamAttr::ReadOnly);
     if (RAttrs == ParamAttr::None)
       Attrs.erase(Attrs.begin());
@@ -1233,12 +1228,8 @@
   isVarArg = (Args == 0);
   assert(RetTy && "Return type not specified!");
 
-  // Only instantiate the parameter attributes if we got some.
-  PAL = 0;
-  if (!Attrs.empty())
-    PAL = ParamAttrsList::get(Attrs);
-
-  // Finally, make the function type
+  // Finally, make the function type and result attributes.
+  PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
   return GetFunctionType(RetTy, ArgTypes, isVarArg);
 }
 





More information about the llvm-commits mailing list