[llvm-commits] [llvm-gcc-4.2] r53205 - in /llvm-gcc-4.2/trunk/gcc: config.gcc config/mips/llvm-mips-target.h config/mips/llvm-mips.cpp config/mips/mips.h

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Mon Jul 7 14:22:53 PDT 2008


Author: bruno
Date: Mon Jul  7 16:22:48 2008
New Revision: 53205

URL: http://llvm.org/viewvc/llvm-project?rev=53205&view=rev
Log:
Added support for passing aggregates with byval if size greater than a register, as defined by mips eabi.

Added:
    llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h
    llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp
Modified:
    llvm-gcc-4.2/trunk/gcc/config.gcc
    llvm-gcc-4.2/trunk/gcc/config/mips/mips.h

Modified: llvm-gcc-4.2/trunk/gcc/config.gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=53205&r1=53204&r2=53205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config.gcc (original)
+++ llvm-gcc-4.2/trunk/gcc/config.gcc Mon Jul  7 16:22:48 2008
@@ -315,6 +315,9 @@
 	;;
 mips*-*-*)
 	cpu_type=mips
+# LLVM LOCAL begin
+	out_cxx_file=mips/llvm-mips.cpp
+# LLVM LOCAL end                               
 	need_64bit_hwint=yes
 	;;
 powerpc*-*-*)

Added: llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h?rev=53205&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h (added)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h Mon Jul  7 16:22:48 2008
@@ -0,0 +1,32 @@
+/* LLVM LOCAL begin (ENTIRE FILE!)  */
+/* Some target-specific hooks for gcc->llvm conversion
+Copyright (C) 2008 Free Software Foundation, Inc.
+Contributed by Bruno Cardoso Lopes (bruno.cardoso at gmail.com)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#ifdef LLVM_ABI_H
+
+extern bool llvm_mips_should_pass_aggregate_in_memory(tree, const Type *);
+
+#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY)      \
+  llvm_mips_should_pass_aggregate_in_memory(X, TY)
+
+#endif /* LLVM_ABI_H */
+
+/* LLVM LOCAL end (ENTIRE FILE!)  */

Added: llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp?rev=53205&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp (added)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips.cpp Mon Jul  7 16:22:48 2008
@@ -0,0 +1,48 @@
+/* LLVM LOCAL begin (ENTIRE FILE!)  */
+/* High-level LLVM backend interface 
+Copyright (C) 2008 Free Software Foundation, Inc.
+Contributed by Bruno Cardoso Lopes (bruno.cardoso at gmail.com)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+//===----------------------------------------------------------------------===//
+// This is a C++ source file that implements specific llvm mips ABI.
+//===----------------------------------------------------------------------===//
+
+#include "llvm-abi.h"
+#include "llvm-mips-target.h"
+
+/* Target hook for llvm-abi.h. It returns true if an aggregate of the
+   specified type should be passed in memory. In mips EABI this is 
+   true for aggregates with size > 32-bits. */
+bool llvm_mips_should_pass_aggregate_in_memory(tree TreeType, const Type *Ty) {
+  if (mips_abi == ABI_EABI)
+  {
+    enum machine_mode mode = TYPE_MODE(TreeType);
+    int size;
+
+    if (mode == DImode || mode == DFmode)
+      return false;
+
+    size = TreeType ? int_size_in_bytes (TreeType) : GET_MODE_SIZE (mode);
+    return size == -1 || size > UNITS_PER_WORD;
+  }
+  return false; // TODO: support o32 ABI
+}
+
+/* LLVM LOCAL end (ENTIRE FILE!)  */

Modified: llvm-gcc-4.2/trunk/gcc/config/mips/mips.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/mips.h?rev=53205&r1=53204&r2=53205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/mips.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/mips.h Mon Jul  7 16:22:48 2008
@@ -23,6 +23,16 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* LLVM LOCAL begin */
+
+#ifdef ENABLE_LLVM
+
+/* Add general target specific stuff */
+#include "llvm-mips-target.h"
+
+#endif /* ENABLE_LLVM */
+
+/* LLVM LOCAL end */
 
 /* MIPS external variables defined in mips.c.  */
 





More information about the llvm-commits mailing list