[llvm-commits] [llvm-gcc-4.2] r56680 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h llvm-convert.cpp llvm-internal.h llvm-types.cpp

Dale Johannesen dalej at apple.com
Fri Sep 26 12:34:17 PDT 2008


Author: johannes
Date: Fri Sep 26 14:34:17 2008
New Revision: 56680

URL: http://llvm.org/viewvc/llvm-project?rev=56680&view=rev
Log:
Use inreg attribute not x86_ssecall calling convention
to implement sse regcall on x86.


Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
    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/config/i386/llvm-i386-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=56680&r1=56679&r2=56680&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Fri Sep 26 14:34:17 2008
@@ -28,14 +28,17 @@
       CC = CallingConv::X86_StdCall;                            \
     } else if (lookup_attribute("fastcall", type_attributes)) { \
       CC = CallingConv::X86_FastCall;                           \
-    } else if (!TARGET_64BIT &&                                 \
-               (TARGET_SSEREGPARM ||                            \
-                lookup_attribute("sseregparm",                  \
-                                 type_attributes))){            \
-      CC = CallingConv::X86_SSECall;                            \
     }                                                           \
   }
 
+#define TARGET_ADJUST_LLVM_RETATTR(Rattributes, type)           \
+  {                                                             \
+    tree type_attributes = TYPE_ATTRIBUTES (type);              \
+    if (!TARGET_64BIT && (TARGET_SSEREGPARM ||                  \
+               lookup_attribute("sseregparm", type_attributes)))\
+      RAttributes |= Attribute::InReg;                          \
+  }
+
 /* LLVM specific stuff for converting gcc's `regparm` attribute to LLVM's
    `inreg` parameter attribute */
 #define LLVM_TARGET_ENABLE_REGPARM

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=56680&r1=56679&r2=56680&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Sep 26 14:34:17 2008
@@ -568,13 +568,10 @@
   // "T foo(void) {}" and allows us to handle functions with K&R-style
   // definitions correctly.
   if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0) {
-    FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(TREE_TYPE(FnDecl)),
+    FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl),
                                                    DECL_ARGUMENTS(FnDecl),
                                                    static_chain,
                                                    CallingConv, PAL);
-#ifdef TARGET_ADJUST_LLVM_CC
-    TARGET_ADJUST_LLVM_CC(CallingConv, TREE_TYPE(FnDecl));
-#endif
   } else {
     // Otherwise, just get the type from the function itself.
     FTy = TheTypeConverter->ConvertFunctionType(TREE_TYPE(FnDecl),

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=56680&r1=56679&r2=56680&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Sep 26 14:34:17 2008
@@ -169,7 +169,7 @@
   /// ConvertArgListToFnType - Given a DECL_ARGUMENTS list on an GCC tree,
   /// return the LLVM type corresponding to the function.  This is useful for
   /// turning "T foo(...)" functions into "T foo(void)" functions.
-  const FunctionType *ConvertArgListToFnType(tree_node *retty,
+  const FunctionType *ConvertArgListToFnType(tree_node *type,
                                              tree_node *arglist,
                                              tree_node *static_chain,
                                              unsigned &CallingConv,

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=56680&r1=56679&r2=56680&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Sep 26 14:34:17 2008
@@ -1047,8 +1047,9 @@
 /// fills in Result with the argument types for the function.  It returns the
 /// specified result type for the function.
 const FunctionType *TypeConverter::
-ConvertArgListToFnType(tree ReturnType, tree Args, tree static_chain,
+ConvertArgListToFnType(tree type, tree Args, tree static_chain,
                        unsigned &CallingConv, AttrListPtr &PAL) {
+  tree ReturnType = TREE_TYPE(type);
   std::vector<PATypeHolder> ArgTys;
   PATypeHolder RetTy(Type::VoidTy);
   
@@ -1058,11 +1059,20 @@
   // Builtins are always prototyped, so this isn't one.
   ABIConverter.HandleReturnType(ReturnType, current_function_decl, false);
 
+#ifdef TARGET_ADJUST_LLVM_CC
+    TARGET_ADJUST_LLVM_CC(CallingConv, type);
+#endif
+
   SmallVector<AttributeWithIndex, 8> Attrs;
 
   // Compute whether the result needs to be zext or sext'd.
   Attributes RAttributes = HandleArgumentExtension(ReturnType);
 
+  // Allow the target to change the attributes.
+#ifdef TARGET_ADJUST_LLVM_RETATTR
+  TARGET_ADJUST_LLVM_RETATTR(RAttributes, type);
+#endif
+
   if (RAttributes != Attribute::None)
     Attrs.push_back(AttributeWithIndex::get(0, RAttributes));
 
@@ -1161,6 +1171,11 @@
   // Compute whether the result needs to be zext or sext'd.
   RAttributes |= HandleArgumentExtension(TREE_TYPE(type));
 
+  // Allow the target to change the attributes.
+#ifdef TARGET_ADJUST_LLVM_RETATTR
+  TARGET_ADJUST_LLVM_RETATTR(RAttributes, type);
+#endif
+
   if (RAttributes != Attribute::None)
     Attrs.push_back(AttributeWithIndex::get(0, RAttributes));
 





More information about the llvm-commits mailing list