[llvm-commits] [llvm-gcc-4.2] r46031 - in /llvm-gcc-4.2/trunk/gcc/config/i386: i386.c llvm-i386-target.h llvm-i386.cpp

Evan Cheng evan.cheng at apple.com
Tue Jan 15 15:26:36 PST 2008


Author: evancheng
Date: Tue Jan 15 17:26:36 2008
New Revision: 46031

URL: http://llvm.org/viewvc/llvm-project?rev=46031&view=rev
Log:
Clean up code.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=46031&r1=46030&r2=46031&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Tue Jan 15 17:26:36 2008
@@ -21527,15 +21527,18 @@
 
 /* APPLE LOCAL begin LLVM */
 
-/* Target hook for llvm-abi.h. It returns true if an aggregate of the
-   specified type should be passed in memory. This is only called for
-   x86-64. */
-int llvm_x86_64_should_pass_aggregate_in_memory(tree type) {
-  int needed_intregs, needed_sseregs;
-  enum machine_mode mode = type_natural_mode (type);
-  return !examine_argument(mode, type, 1, &needed_intregs, &needed_sseregs);
+/* These are wrappers for type_natural_mode and examine_argument which are
+   both static functions. */
+enum machine_mode ix86_getNaturalModeForType(tree type) {
+  return type_natural_mode(type);
 }
 
+int ix86_HowToPassArgument(enum machine_mode mode, tree type, int in_return,
+                             int *int_nregs, int *sse_nregs) {
+  return examine_argument(mode, type, in_return, int_nregs, sse_nregs);
+}
+
+  
 /* APPLE LOCAL end LLVM */
 
 #include "gt-i386.h"

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=46031&r1=46030&r2=46031&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 Tue Jan 15 17:26:36 2008
@@ -62,11 +62,10 @@
     }                                                           \
   }
 
-extern int llvm_x86_64_should_pass_aggregate_in_memory(tree);
+extern bool llvm_x86_64_should_pass_aggregate_in_memory(tree);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X)          \
-  ((!TARGET_64BIT)                                              \
-  ? true : llvm_x86_64_should_pass_aggregate_in_memory(X))
+  (!TARGET_64BIT || llvm_x86_64_should_pass_aggregate_in_memory(X))
 
 /* LLVM LOCAL end (ENTIRE FILE!)  */
 

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=46031&r1=46030&r2=46031&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Jan 15 17:26:36 2008
@@ -660,4 +660,18 @@
   return false;
 }
 
+/* These are defined in i386.c */
+extern "C" enum machine_mode ix86_getNaturalModeForType(tree);
+extern "C" int ix86_HowToPassArgument(enum machine_mode, tree, int, int*, int*);
+
+/* Target hook for llvm-abi.h. It returns true if an aggregate of the
+   specified type should be passed in memory. This is only called for
+   x86-64. */
+bool llvm_x86_64_should_pass_aggregate_in_memory(tree type) {
+  int IntRegs, SSERegs;
+  enum machine_mode Mode = ix86_getNaturalModeForType(type);
+  /* If ix86_HowToPassArgument return 0, then it's passed byval in memory.*/
+  return !ix86_HowToPassArgument(Mode, type, 1, &IntRegs, &SSERegs);
+}
+
 /* LLVM LOCAL end (ENTIRE FILE!)  */





More information about the llvm-commits mailing list