This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add target hook in C front end


The mips port currently needs to pass __SIZE_TYPE__ and __PTRDIFF_TYPE__
to the preprocessor to make sure that the definitions of size_t and
ptrdiff_t agree with the size given. This is currently done through spec
files that are duplicated throughout the backend and usually only work
for the multilibs that a particular header file was designed to support.
(insert comment about herculean task of making sure updates work...)

This patch solves this problem by allowing C code to set the size of
__SIZE_TYPE__ and __PTRDIFF_TYPE__ and setting SIZE_TYPE and
PTRDIFF_TYPE to these values.

Tested on mips-elf, mipsisa32-elf, mips64-elf. Bootstrapped on
x86-linux. I'd have bootstrapped on irix, but that's broken in the last
week or so and I haven't gotten to fixing it yet.

Comments?

-eric

-- 
Fridays are not "pants optional"

2001-12-15  Eric Christopher  <echristo@redhat.com>

	* c-common.c (c_common_nodes_and_builtins): Conditionalize
	c_size_type_node and ptrdiff_type_node on macros. Add macro for
	C Language specific builtins. Move assignment to ptrdiff_type_node
	above builtin installation.
	* config/mips/mips.h (SUBTARGET_CPP_SIZE_SPEC): Define to "".
	Redefine SIZE_TYPE and PTRDIFF_TYPE.
	(SIZE_TYPE_NODE): New macro.
	(PTRDIFF_TYPE_NODE): Ditto.
	(INIT_C_BUILTINS): Ditto.
	* config/mips/iris6.h: Remove __SIZE_TYPE__ and __PTRDIFF_TYPE__
	from SUBTARGET_CPP_SIZE_SPEC.
	* config/mips/isa3264.h: Ditto. Remove all of SUBTARGET_CPP_SIZE_SPEC.
	* config/mips/linux.h: Ditto.
	* config/mips/r3900.h: Ditto. Reorganize file.
	* config/mips/mips-c.c: New file.
	* config.gcc: Add to configury.
	* config/mips/t-elf: Add to makefile fragment.
	* config/mips/t-iris6: Ditto.
	* config/mips/t-isa3264: Ditto.
	* config/mips/mips-protos.h: Add headers for new functions. Move target
	structure function prototypes here.
	* config/mips/mips.c: From here.


Index: gcc/c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.281
diff -u -p -w -r1.281 c-common.c
--- c-common.c	2001/12/11 19:42:32	1.281
+++ c-common.c	2001/12/16 21:20:12
@@ -2454,13 +2454,26 @@ c_common_nodes_and_builtins ()
   /* `unsigned long' is the standard type for sizeof.
      Note that stddef.h uses `unsigned long',
      and this must agree, even if long and int are the same size.  */
-  c_size_type_node =
-    TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
+
+#ifdef SIZE_TYPE_NODE
+  c_size_type_node = SIZE_TYPE_NODE;
+#else
+  c_size_type_node = TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
+#endif
+
   signed_size_type_node = signed_type (c_size_type_node);
   if (flag_traditional)
     c_size_type_node = signed_size_type_node;
   set_sizetype (c_size_type_node);
 
+#ifdef PTRDIFF_TYPE_NODE
+  ptrdiff_type_node = PTRDIFF_TYPE_NODE;
+#else
+  ptrdiff_type_node = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
+#endif
+
+  unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
+
   build_common_tree_nodes_2 (flag_short_double);
 
   record_builtin_type (RID_FLOAT, NULL, float_type_node);
@@ -2514,6 +2527,11 @@ c_common_nodes_and_builtins ()
 
   (*targetm.init_builtins) ();
 
+  /* For C/C++ language specific builtins.  */
+#ifdef INIT_C_BUILTINS
+  INIT_C_BUILTINS;
+#endif
+
   /* This is special for C++ so functions can be overloaded.  */
   wchar_type_node = get_identifier (flag_short_wchar
 				    ? "short unsigned int"
@@ -2547,9 +2565,7 @@ c_common_nodes_and_builtins ()
     TREE_TYPE (identifier_global_value (get_identifier (UINTMAX_TYPE)));
 
   default_function_type = build_function_type (integer_type_node, NULL_TREE);
-  ptrdiff_type_node
-    = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
-  unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
+
 
   pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
 			va_list_type_node));
@@ -4042,4 +4058,3 @@ shadow_warning (msgid, name, decl)
 			      DECL_SOURCE_LINE (decl),
 			      "shadowed declaration is here");
 }
-
Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.132
diff -u -p -w -r1.132 config.gcc
--- config.gcc	2001/12/15 11:46:41	1.132
+++ config.gcc	2001/12/16 21:20:13
@@ -2109,6 +2109,8 @@ mips-sgi-irix6*)		# SGI System V.4., IRI
 	fi
 	tmake_file="mips/t-iris mips/t-iris6"
 	xm_defines=POSIX
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 #	if test x$enable_threads = xyes; then
 #		thread_file='irix'
 #	fi
@@ -2120,6 +2122,8 @@ mips-wrs-vxworks)
 	gnu_ld=yes
 	extra_parts="crtbegin.o crtend.o"
 	thread_file='vxworks'
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-sgi-irix5cross64)		# Irix5 host, Irix 6 target, cross64
 	tm_file="mips/iris6.h mips/cross64.h"
@@ -2128,6 +2132,8 @@ mips-sgi-irix5cross64)		# Irix5 host, Ir
 	tmake_file="mips/t-iris mips/t-cross64"
 	# See comment in mips/iris[56].h files.
 	use_collect2=yes
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 #	if test x$enable_threads = xyes; then
 #		thread_file='irix'
 #	fi
@@ -2167,6 +2173,8 @@ mips-sgi-irix5*)		# SGI System V.4., IRI
 	# mips-tfile doesn't work yet
 	# See comment in mips/iris5.h file.
 	use_collect2=yes
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 #	if test x$enable_threads = xyes; then
 #		thread_file='irix'
 #	fi
@@ -2187,6 +2195,8 @@ mips-sgi-irix4loser*)		# Mostly like a M
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 #	if test x$enable_threads = xyes; then
 #		thread_file='irix'
 #	fi
@@ -2207,6 +2217,8 @@ mips-sgi-irix4*)		# Mostly like a MIPS.
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 #	if test x$enable_threads = xyes; then
 #		thread_file='irix'
 #	fi
@@ -2226,11 +2238,15 @@ mips-sgi-*)			# Mostly like a MIPS.
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-dec-osfrose*)		# Decstation running OSF/1 reference port with OSF/rose.
 	tm_file="mips/osfrose.h ${tm_file}"
 	extra_objs=halfpic.o
 	use_collect2=yes
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-dec-osf*)			# Decstation running OSF/1 as shipped by DIGITAL
 	tm_file=mips/dec-osf1.h
@@ -2247,6 +2263,8 @@ mips-dec-osf*)			# Decstation running OS
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-dec-bsd*)                  # Decstation running 4.4 BSD
       tm_file=mips/dec-bsd.h
@@ -2260,11 +2278,15 @@ mips-dec-bsd*)                  # Decsta
       then
 		use_collect2=yes
       fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
       ;;
 mipsel-*-netbsd* | mips-dec-netbsd*)    # Decstation running NetBSD
 	tm_file=mips/netbsd.h
 	# On NetBSD, the headers are already okay, except for math.h.
 	tmake_file=t-netbsd
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
         tm_file="dbxelf.h elfos.h svr4.h linux.h mips/linux.h"
@@ -2286,6 +2308,8 @@ mips*-*-linux*)				# Linux MIPS, either 
 	if test x$enable_threads = xyes; then
 		thread_file='posix'
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips*el-*-openbsd*)	# mips little endian
 	target_cpu_default="MASK_GAS|MASK_ABICALLS"
@@ -2293,6 +2317,8 @@ mips*el-*-openbsd*)	# mips little endian
 mips*-*-openbsd*)		# mips big endian
 	target_cpu_default="MASK_GAS|MASK_ABICALLS"
 	tm_file="mips/openbsd-be.h ${tm_file}"
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-sony-bsd* | mips-sony-newsos*)	# Sony NEWS 3600 or risc/news.
 	tm_file="mips/news4.h ${tm_file}"
@@ -2308,6 +2334,8 @@ mips-sony-bsd* | mips-sony-newsos*)	# So
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-sony-sysv*)		# Sony NEWS 3800 with NEWSOS5.0.
 				# That is based on svr4.
@@ -2326,6 +2354,8 @@ mips-sony-sysv*)		# Sony NEWS 3800 with 
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-tandem-sysv4*)		# Tandem S2 running NonStop UX
 	tm_file="mips/svr4-5.h mips/svr4-t.h"
@@ -2343,6 +2373,8 @@ mips-tandem-sysv4*)		# Tandem S2 running
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-ultrix* | mips-dec-mach3)	# Decstation.
 	tm_file="mips/ultrix.h ${tm_file}"
@@ -2359,6 +2391,8 @@ mips-*-ultrix* | mips-dec-mach3)	# Decst
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
         ;;
 mips-*-riscos[56789]bsd*)
 	tm_file=mips/bsd-5.h	# MIPS BSD 4.3, RISC-OS 5.0
@@ -2376,6 +2410,8 @@ mips-*-riscos[56789]bsd*)
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
         ;;
 mips-*-bsd* | mips-*-riscosbsd* | mips-*-riscos[1234]bsd*)
 	tm_file="mips/bsd-4.h ${tm_file}" # MIPS BSD 4.3, RISC-OS 4.0
@@ -2393,6 +2429,8 @@ mips-*-bsd* | mips-*-riscosbsd* | mips-*
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
         ;;
 mips-*-riscos[56789]sysv4*)
 	tm_file=mips/svr4-5.h	# MIPS System V.4., RISC-OS 5.0
@@ -2410,6 +2448,8 @@ mips-*-riscos[56789]sysv4*)
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-sysv4* | mips-*-riscos[1234]sysv4* | mips-*-riscossysv4*)
 	tm_file="mips/svr4-4.h ${tm_file}"
@@ -2428,6 +2468,8 @@ mips-*-sysv4* | mips-*-riscos[1234]sysv4
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-riscos[56789]sysv*)
 	tm_file=mips/svr3-5.h	# MIPS System V.3, RISC-OS 5.0
@@ -2446,6 +2488,8 @@ mips-*-riscos[56789]sysv*)
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-sysv* | mips-*-riscos*sysv*)
 	tm_file="mips/svr3-4.h ${tm_file}"
@@ -2464,6 +2508,8 @@ mips-*-sysv* | mips-*-riscos*sysv*)
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-riscos[56789]*)		# Default MIPS RISC-OS 5.0.
 	tm_file=mips/mips-5.h
@@ -2479,6 +2525,8 @@ mips-*-riscos[56789]*)		# Default MIPS R
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mipsel-*-ecoff*)
 	tm_file=mips/ecoffl.h
@@ -2493,35 +2541,51 @@ mips-*-ecoff*)
 		tm_file="${tm_file} dbx.h"
 	fi
 	tmake_file=mips/t-ecoff
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mipsisa32-*-elf*)
 	tm_file="mips/isa3264.h mips/abi64.h"
 	tmake_file=mips/t-isa3264
 	target_cpu_default="MASK_SOFT_FLOAT"
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mipsel-*-elf*)
 	tm_file="mips/elfl.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-elf*)
 	tm_file="mips/elf.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips64el-*-elf*)
 	tm_file="mips/elfl64.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips64orionel-*-elf*)
 	tm_file="mips/elforion.h mips/elfl64.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips64-*-elf*)
 	tm_file="mips/elf64.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips64orion-*-elf*)
 	tm_file="mips/elforion.h mips/elf64.h"
 	tmake_file=mips/t-elf
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips64orion-*-rtems*)
 	tm_file="mips/elforion.h mips/elf64.h mips/rtems64.h"
@@ -2529,6 +2593,8 @@ mips64orion-*-rtems*)
 	if test x$enable_threads = xyes; then
 	  thread_file='rtems'
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips*-*-rtems*)
 	tm_file="mips/elf.h mips/rtems.h"
@@ -2536,15 +2602,21 @@ mips*-*-rtems*)
 	if test x$enable_threads = xyes; then
 	  thread_file='rtems'
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mipstx39el-*-elf*)
 	tm_file="mips/r3900.h mips/elfl.h mips/abi64.h"
 	tmake_file=mips/t-r3900
 	target_cpu_default="MASK_SOFT_FLOAT"
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mipstx39-*-elf*)
 	tm_file="mips/r3900.h mips/elf.h mips/abi64.h"
 	tmake_file=mips/t-r3900
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mips-*-*)				# Default MIPS RISC-OS 4.0.
 	if test x$stabs = xyes; then
@@ -2559,6 +2631,8 @@ mips-*-*)				# Default MIPS RISC-OS 4.0.
 	then
 		use_collect2=yes
 	fi
+	c_target_objs="mips-c.o"
+	cxx_target_objs="mips-c.o"
 	;;
 mmix-knuth-mmixware)
 	;;
Index: gcc/config/mips/iris6.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision 1.42
diff -u -p -w -r1.42 iris6.h
--- iris6.h	2001/10/31 04:08:18	1.42
+++ iris6.h	2001/12/16 21:20:14
@@ -80,13 +80,11 @@ Boston, MA 02111-1307, USA.  */
 
 #undef SUBTARGET_CPP_SIZE_SPEC
 #define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=32|mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
--D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int} \
-%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
--D__WCHAR_TYPE__=int -D__WINT_TYPE__=int} \
-%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
--D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int}"
+%{mabi=32|mabi=n32: -D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int} \
+%{mabi=64: -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int} \
+%{!mabi*: -D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int}"
 
+
 /* We must make -mips3 do what -mlong64 used to do.  */
 /* ??? If no mipsX option given, but a mabi=X option is, then should set
    _MIPS_ISA based on the mabi=X option.  */
@@ -94,7 +92,6 @@ Boston, MA 02111-1307, USA.  */
    _MIPS_SIM based on the mipsX option.  */
 /* ??? Same for _MIPS_SZINT.  */
 /* ??? Same for _MIPS_SZPTR.  */
-/* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE.  */
 #undef SUBTARGET_CPP_SPEC
 #define SUBTARGET_CPP_SPEC "\
 %{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} \
Index: gcc/config/mips/isa3264.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/isa3264.h,v
retrieving revision 1.4
diff -u -p -w -r1.4 isa3264.h
--- isa3264.h	2001/12/03 19:13:34	1.4
+++ isa3264.h	2001/12/16 21:20:14
@@ -37,114 +37,9 @@ Boston, MA 02111-1307, USA.  */
 
 #include "mips/elf.h"
 
-/* This must be done after including mips.h so that the
-   ABI_{EABI,O64,O32,...} are #defined.  */
-
-#if MIPS_ABI_DEFAULT == ABI_EABI
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=eabi|!mabi=*:\
-  %{mips1|mips2|mips32|mlong32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-  %{!mips1:%{!mips2:%{!mips32:%{!mlong32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}}} \
-%{mabi=o64:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-"
-#endif
-
-#if MIPS_ABI_DEFAULT == ABI_O64
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=eabi:\
-  %{mips1|mips2|mips32|mlong32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-  %{!mips1:%{!mips2:%{!mips32:%{!mlong32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}}} \
-%{mabi=o64|!mabi=*:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-"
-#endif
-
-#if MIPS_ABI_DEFAULT == ABI_32
-#if MIPS_ISA_DEFAULT == 3 || MIPS_ISA_DEFAULT == 4 || MIPS_ISA_DEFAULT == 5 || MIPS_ISA_DEFAULT == 64
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=eabi:\
-  %{mips1|mips2|mips32|mlong32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-  %{!mips1:%{!mips2:%{!mips32:%{!mlong32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}}} \
-%{mabi=o64|!!mabi=*:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-"
-#else /* not a 64bit default ISA */
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=eabi:\
-  %{mips3|mips4|mips5|mips64|mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-  %{!mips3:%{!mips4:%{!mips5:%{!mips64:%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}}}}}} \
-%{mabi=o64:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{!mabi=*:\
- %{mips3|mips4|mips5|mips64:\
-  %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-  %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
- %{!mips3:%{!mips4:%{!mips5:%{!mips64:\
-  -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}}}}} \
-"
-#endif /* ISA */
-#endif
-
 #if MIPS_ABI_DEFAULT == ABI_MEABI
 /* For MEABI, don't link with crt0 files, let the linker start files specify
    the appropriate crt0 file.  */
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0: }"
-
-/*
-   The MIPS_ISA_DEFAULT test is for EABI, in which the size of longs depends on
-   the ISA.
-
-   For MEABI the size of longs is always 32bits.  If long64 is specified then
-   we honor that.  The errors for long64 & long32 is because while CC1 can
-   handle overriding mlong32 with mlong64 and vise-versa, the specs cannot.  */
-
-#if MIPS_ISA_DEFAULT == 3 || MIPS_ISA_DEFAULT == 4 || MIPS_ISA_DEFAULT == 5 || MIPS_ISA_DEFAULT == 64
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=meabi:\
-  %{mips1|mips2|mips32|mlong32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-  %{!mips1:%{!mips2:%{!mips32:%{!mlong32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}}} \
-%{mabi=o64:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
-  %{mlong32:%e-mlong32 and -mlong64 can not both be specified}} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int }} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=meabi|!mabi=*:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
-  %{mlong32:%e-mlong32 and -mlong64 can not both be specified}} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int }} \
-"
-
-#else /* not a 64bit default ISA */
-#undef  SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=meabi:\
-  %{mips3|mips4|mips5|mips64|mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-  %{!mips3:%{!mips4:%{!mips5:%{!mips64:%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}}}}}} \
-%{mabi=o64:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
-  %{mlong32:%e-mlong32 and -mlong64 can not both be specified}} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int }} \
-%{mabi=32:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=meabi|!mabi=*:\
- %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
-  %{mlong32:%e-mlong32 and -mlong64 can not both be specified}} \
- %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int }} \
-"
-#endif /* ISA */
 #endif
-
Index: gcc/config/mips/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/linux.h,v
retrieving revision 1.33
diff -u -p -w -r1.33 linux.h
--- linux.h	2001/11/19 11:28:52	1.33
+++ linux.h	2001/12/16 21:20:14
@@ -146,13 +146,6 @@ void FN ()							\
 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
 #endif
 
-#undef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
-
 /* We must make -mips3 do what -mlong64 used to do.  */
 /* ??? If no mipsX option given, but a mabi=X option is, then should set
    _MIPS_ISA based on the mabi=X option.  */
Index: gcc/config/mips/mips-c.c
===================================================================
RCS file: mips-c.c
diff -N mips-c.c
--- /dev/null	Tue May  5 13:32:27 1998
+++ mips-c.c	Sun Dec 16 13:20:14 2001
@@ -0,0 +1,76 @@
+/*
+  C/C++ Language Routines for MIPS.
+
+  Copyright (C) 2001 Free Software Foundation, Inc.
+
+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.  */
+
+#include "config.h"
+#include "system.h"
+#include <signal.h>
+#include "rtl.h"
+#include "regs.h"
+#include "hard-reg-set.h"
+#include "real.h"
+#include "insn-config.h"
+#include "conditions.h"
+#include "recog.h"
+#include "toplev.h"
+#include "output.h"
+#include "tree.h"
+#include "function.h"
+#include "expr.h"
+#include "flags.h"
+#include "reload.h"
+#include "output.h"
+#include "tm_p.h"
+#include "ggc.h"
+#include "gstab.h"
+#include "hashtab.h"
+#include "debug.h"
+#include "target.h"
+#include "target-def.h"
+#include "c-common.h"
+
+/* Returns a tree type for a SIZE_TYPE node.  */
+tree
+mips_size_type_node ()
+{
+
+  tree t = NULL_TREE;
+
+  if (TARGET_64BIT || TARGET_LONG64)
+    t = TREE_TYPE (identifier_global_value (get_identifier ("long unsigned int")));
+  else
+    t = TREE_TYPE (identifier_global_value (get_identifier ("unsigned int")));
+
+  return t;
+}
+
+tree
+mips_ptrdiff_type_node ()
+{
+  tree t = NULL_TREE;
+
+  if (TARGET_64BIT || TARGET_LONG64)
+    t = TREE_TYPE (identifier_global_value (get_identifier ("long int")));
+  else
+    t = TREE_TYPE (identifier_global_value (get_identifier ("int")));
+
+  return t;
+}
Index: gcc/config/mips/mips-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips-protos.h,v
retrieving revision 1.14
diff -u -p -w -r1.14 mips-protos.h
--- mips-protos.h	2001/12/01 17:40:43	1.14
+++ mips-protos.h	2001/12/16 21:20:14
@@ -26,6 +26,9 @@ Boston, MA 02111-1307, USA.  */
 #ifndef GCC_MIPS_PROTOS_H
 #define GCC_MIPS_PROTOS_H
 
+extern int mips_adjust_cost PARAMS ((rtx, rtx, rtx, int));
+extern void mips_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+extern void mips_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 extern HOST_WIDE_INT	compute_frame_size PARAMS ((HOST_WIDE_INT));
 extern void		mips_asm_file_end PARAMS ((FILE *));
 extern void		mips_asm_file_start PARAMS ((FILE *));
@@ -146,5 +149,8 @@ extern rtx		gen_int_relational PARAMS ((
 						    rtx,int *));
 extern void		gen_conditional_branch PARAMS ((rtx *, enum rtx_code));
 #endif
+
+extern tree mips_size_type_node    PARAMS ((void));
+extern tree mips_ptrdiff_type_node PARAMS ((void));
 
 #endif /* ! GCC_MIPS_PROTOS_H */
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.170
diff -u -p -w -r1.170 mips.c
--- mips.c	2001/12/06 11:49:34	1.170
+++ mips.c	2001/12/16 21:20:19
@@ -118,8 +118,6 @@ static void abort_with_insn			PARAMS ((r
   ATTRIBUTE_NORETURN;
 static int symbolic_expression_p                PARAMS ((rtx));
 static void mips_add_gc_roots                   PARAMS ((void));
-static void mips_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
-static void mips_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static enum processor_type mips_parse_cpu       PARAMS ((const char *));
 static void copy_file_data			PARAMS ((FILE *, FILE *));
 #ifdef TARGET_IRIX6
@@ -132,7 +130,6 @@ static int iris_section_align_entry_eq		
 static hashval_t iris_section_align_entry_hash	PARAMS ((const PTR));
 static int iris6_section_align_1		PARAMS ((void **, void *));
 #endif
-static int mips_adjust_cost			PARAMS ((rtx, rtx, rtx, int));
 
 /* Global variables for machine-dependent things.  */
 
@@ -6942,7 +6939,7 @@ save_restore_insns (store_p, large_reg, 
 
 /* Set up the stack and frame (if desired) for the function.  */
 
-static void
+void
 mips_output_function_prologue (file, size)
      FILE *file;
      HOST_WIDE_INT size ATTRIBUTE_UNUSED;
@@ -7515,7 +7512,7 @@ mips_expand_prologue ()
 #define RA_MASK BITMASK_HIGH	/* 1 << 31 */
 #define PIC_OFFSET_TABLE_MASK (1 << (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST))
 
-static void
+void
 mips_output_function_epilogue (file, size)
      FILE *file ATTRIBUTE_UNUSED;
      HOST_WIDE_INT size ATTRIBUTE_UNUSED;
@@ -9924,7 +9921,7 @@ mips_parse_cpu (cpu_string)
    is to make no adjustment to COST.
 
    On the MIPS, ignore the cost of anti- and output-dependencies.  */
-static int
+int
 mips_adjust_cost (insn, link, dep, cost)
      rtx insn ATTRIBUTE_UNUSED;
      rtx link;
Index: gcc/config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.142
diff -u -p -w -r1.142 mips.h
--- mips.h	2001/12/04 06:30:02	1.142
+++ mips.h	2001/12/16 21:20:23
@@ -1066,13 +1066,11 @@ extern int mips_abi;
 
 /* Preprocessor specs.  */
 
-/* SUBTARGET_CPP_SIZE_SPEC defines SIZE_TYPE and PTRDIFF_TYPE.  It may
-   be overridden by subtargets.  */
+/* Some old targets may have this defined. If not defined, define to empty.  */
+/* This should be removed as targets can be tested.  */
 
 #ifndef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mlong64:%{!mips1:%{!mips2:%{!mips32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}} \
-%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
+#define SUBTARGET_CPP_SIZE_SPEC ""
 #endif
 
 /* SUBTARGET_CPP_SPEC is passed to the preprocessor.  It may be
@@ -3172,7 +3170,6 @@ typedef struct mips_args {
 
 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
 
-
 /* Define this macro if references to a symbol must be treated
    differently depending on something about the variable or
    function named by the symbol (such as what section it is in).
@@ -4663,14 +4660,27 @@ while (0)
 /* Default definitions for size_t and ptrdiff_t.  */
 
 #ifndef SIZE_TYPE
-#define NO_BUILTIN_SIZE_TYPE
-#define SIZE_TYPE (Pmode == DImode ? "long unsigned int" : "unsigned int")
+#define SIZE_TYPE "__SIZE_TYPE__"
+#define SIZE_TYPE_NODE mips_size_type_node ()
 #endif
 
 #ifndef PTRDIFF_TYPE
-#define NO_BUILTIN_PTRDIFF_TYPE
-#define PTRDIFF_TYPE (Pmode == DImode ? "long int" : "int")
+#define PTRDIFF_TYPE "__PTRDIFF_TYPE__"
+#define PTRDIFF_TYPE_NODE mips_ptrdiff_type_node ()
 #endif
+
+#define INIT_C_BUILTINS                                               \
+  do                                                                  \
+     {                                                                \
+         pushdecl (build_decl (TYPE_DECL,                             \
+			       get_identifier ("__SIZE_TYPE__"),      \
+			       c_size_type_node));                    \
+                                                                      \
+         pushdecl (build_decl (TYPE_DECL,                             \
+                               get_identifier ("__PTRDIFF_TYPE__"),   \
+			       ptrdiff_type_node));                   \
+      }                                                               \
+   while (0)
 
 /* See mips_expand_prologue's use of loadgp for when this should be
    true.  */
Index: gcc/config/mips/r3900.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/r3900.h,v
retrieving revision 1.11
diff -u -p -w -r1.11 r3900.h
--- r3900.h	2001/12/03 19:13:34	1.11
+++ r3900.h	2001/12/16 21:20:23
@@ -22,6 +22,19 @@ along with GNU CC; see the file COPYING.
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+#define MIPS_CPU_STRING_DEFAULT "R3900"
+#define MIPS_ISA_DEFAULT 1
+
+#define MULTILIB_DEFAULTS { MULTILIB_ENDIAN_DEFAULT, "msoft-float" }
+
+/* We use EABI by default.  */
+#define MIPS_ABI_DEFAULT ABI_EABI
+
+/* Debugging */
+
+#define DWARF2_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
 #define SUBTARGET_CPP_SPEC "\
 %{!mabi=32: %{!mabi=n32: %{!mabi=64: -D__mips_eabi}}} \
 %{!msingle-float:-D__mips_soft_float} \
@@ -29,34 +42,12 @@ Boston, MA 02111-1307, USA.  */
 %{msingle-float:%{msoft-float: \
   %e-msingle-float and -msoft-float can not both be specified}}"
 
-/* The following is needed because -mips3 and -mips4 set gp64 which in
-   combination with abi=eabi, causes long64 to be set.  */
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mips3:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{mips4:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mips3:%{!mips4:%{!m4650:\
-  -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}}} "
-
 /* by default (if not mips-something-else) produce code for the r3900 */
 #define SUBTARGET_CC1_SPEC "\
 %{mhard-float:%e-mhard-float not supported} \
 %{msingle-float:%{msoft-float: \
   %e-msingle-float and -msoft-float can not both be specified}}"
 
-#define MIPS_CPU_STRING_DEFAULT "R3900"
-#define MIPS_ISA_DEFAULT 1
-
-#define MULTILIB_DEFAULTS { MULTILIB_ENDIAN_DEFAULT, "msoft-float" }
-
-/* We use the MIPS EABI by default.  */
-#define MIPS_ABI_DEFAULT ABI_EABI
-
-
-/* Debugging */
-
-#define DWARF2_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-
 /* For the 'preferred' cases ("gN" and "ggdbN") we need to tell the 
    gnu assembler not to generate debugging information.  */
    
Index: gcc/config/mips/t-elf
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-elf,v
retrieving revision 1.7
diff -u -p -w -r1.7 t-elf
--- t-elf	2001/09/05 08:39:06	1.7
+++ t-elf	2001/12/16 21:20:23
@@ -12,6 +12,10 @@ $(T)crtn.o: $(srcdir)/config/mips/crtn.a
 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
 	-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
 
+# C/C++ Language specific options
+mips-c.o: $(srcdir)/config/mips/mips-c.c $(RTL_H) $(TREE_H) $(CONFIG_H)
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
 LIB1ASMSRC = mips/mips16.S
 LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
 	_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
Index: gcc/config/mips/t-iris6
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-iris6,v
retrieving revision 1.11
diff -u -p -w -r1.11 t-iris6
--- t-iris6	2001/07/24 12:27:03	1.11
+++ t-iris6	2001/12/16 21:20:23
@@ -1,3 +1,7 @@
+# C/C++ Language specific options
+mips-c.o: $(srcdir)/config/mips/mips-c.c $(RTL_H) $(TREE_H) $(CONFIG_H)
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
 # ??? If no mabi=X option given, but a mipsX option is, then should deal
 # with that.
 # ??? mabi=32 is deliberately left off the list because it doesn't work yet.
Index: gcc/config/mips/t-isa3264
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-isa3264,v
retrieving revision 1.1
diff -u -p -w -r1.1 t-isa3264
--- t-isa3264	2001/09/15 02:03:14	1.1
+++ t-isa3264	2001/12/16 21:20:23
@@ -1,5 +1,9 @@
 CONFIG2_H	= $(srcdir)/config/mips/isa3264.h $(srcdir)/config/mips/elf.h $(srcdir)/config/mips/ecoff.h $(srcdir)/config/mips/mips.h
 
+# C/C++ Language specific options
+mips-c.o: $(srcdir)/config/mips/mips-c.c $(RTL_H) $(TREE_H) $(CONFIG_H)
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
 # Suppress building libgcc1.a, since the MIPS compiler port is complete
 # and does not need anything from libgcc1.a.
 LIBGCC1 =


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]