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]

i386/x86_64 only compiler changes + cpp specs


Hi,
this patch adds code to allow building of 32bit-only compiler and adds missing
bits in the SPECs for 32bit specs.
Now it is important to avoid bi arch compiler, as HOST_WIDE_INT gets to long
long and makes compiler slower.

Honza

Ne kvě  6 19:03:27 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* i386.h (TARGET_64BIT): Define to constant if !TARGET_BI_ARCH
	(CPP_CPU??_SIZE_TYPE): New.
	(CPP_CPU??_SPEC, CPP_CPUCOMMON_SPEC): Break out from...
	(CPP_CPU_SPEC): ... here; support choosing of CPU.
	(EXTRA_SPECS): Add cpp_cpu??, cpp_cpu??sizet, cpp_cpucommon.
	(MAX_LONG_TYPE_SIZE, MAX_BITS_PER_WORD): Define to 32 for 32bit-only
	compiler.
	* i386.c (override_options): Add sorry about not suported modes.

*** i386.h.orig	Thu May  3 15:03:24 2001
--- i386.h	Sun May  6 19:09:55 2001
*************** extern int target_flags;
*** 181,187 ****
--- 181,195 ----
  #define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
  
  /* 64bit Sledgehammer mode */
+ #ifdef TARGET_BI_ARCH
  #define TARGET_64BIT (target_flags & MASK_64BIT)
+ #else
+ #ifdef TARGET_64BIT_DEFAULT
+ #define TARGET_64BIT 1
+ #else
+ #define TARGET_64BIT 0
+ #endif
+ #endif
  
  #define TARGET_386 (ix86_cpu == PROCESSOR_I386)
  #define TARGET_486 (ix86_cpu == PROCESSOR_I486)
*************** extern int ix86_arch;
*** 462,471 ****
  #endif
  #endif /* CPP_CPU_DEFAULT_SPEC */
  
! #ifndef CPP_CPU_SPEC
! #define CPP_CPU_SPEC "\
! -Acpu=i386 -Amachine=i386 \
! %{!ansi:%{!std=c*:%{!std=i*:-Di386}}} -D__i386 -D__i386__ \
  %{march=i386:%{!mcpu*:-D__tune_i386__ }}\
  %{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
  %{march=pentium|march=i586:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
--- 470,493 ----
  #endif
  #endif /* CPP_CPU_DEFAULT_SPEC */
  
! #ifdef NO_BUILTIN_SIZE_TYPE
! #define CPP_CPU32_SIZE_TYPE_SPEC \
!   " -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
! #define CPP_CPU64_SIZE_TYPE_SPEC \
!   " -D__SIZE_TYPE__=unsigned\\ long\\ int -D__PTRDIFF_TYPE__=long\\ int"
! #else
! #define CPP_CPU32_SIZE_TYPE_SPEC ""
! #define CPP_CPU64_SIZE_TYPE_SPEC ""
! #endif
! 
! #define CPP_CPU32_SPEC \
!   "-Acpu=i386 -Amachine=i386 %{!ansi:%{!std=c*:%{!std=i*:-Di386}}} -D__i386 \
! -D__i386__ %(cpp_cpu32sizet)"
! 
! #define CPP_CPU64_SPEC \
!   "-Acpu=x86_64 -Amachine=x86_64 -D__x86_64 -D__x86_64__ %(cpp_cpu64sizet)"
! 
! #define CPP_CPUCOMMON_SPEC "\
  %{march=i386:%{!mcpu*:-D__tune_i386__ }}\
  %{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}\
  %{march=pentium|march=i586:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
*************** extern int ix86_arch;
*** 475,481 ****
    %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
  %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
  %{march=athlon:-D__athlon -D__athlon__ %{!mcpu*:-D__tune_athlon__ }}\
! %{mpentium4=pentium4:-D__pentium4 -D__pentium4__ %{!mcpu*:-D__tune_pentium4__ }}\
  %{m386|mcpu=i386:-D__tune_i386__ }\
  %{m486|mcpu=i486:-D__tune_i486__ }\
  %{mpentium|mcpu=pentium|mcpu=i586:-D__tune_i586__ -D__tune_pentium__ }\
--- 497,503 ----
    %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
  %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
  %{march=athlon:-D__athlon -D__athlon__ %{!mcpu*:-D__tune_athlon__ }}\
! %{march=pentium4:-D__pentium4 -D__pentium4__ %{!mcpu*:-D__tune_pentium4__ }}\
  %{m386|mcpu=i386:-D__tune_i386__ }\
  %{m486|mcpu=i486:-D__tune_i486__ }\
  %{mpentium|mcpu=pentium|mcpu=i586:-D__tune_i586__ -D__tune_pentium__ }\
*************** extern int ix86_arch;
*** 484,489 ****
--- 506,526 ----
  %{mcpu=athlon:-D__tune_athlon__ }\
  %{mcpu=pentium4:-D__tune_pentium4__ }\
  %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
+ 
+ #ifndef CPP_CPU_SPEC
+ #ifdef TARGET_BI_ARCH
+ #ifdef TARGET_64BIT_DEFAULT
+ #define CPP_CPU_SPEC "%{m32:%(cpp_cpu32)}%{!m32:%(cpp_cpu64)} %(cpp_cpucommon)"
+ #else
+ #define CPP_CPU_SPEC "%{m64:%(cpp_cpu64)}%{!m64:%(cpp_cpu32)} %(cpp_cpucommon)"
+ #endif
+ #else
+ #ifdef TARGET_64BIT_DEFAULT
+ #define CPP_CPU_SPEC "%(cpp_cpu64) %(cpp_cpucommon)"
+ #else
+ #define CPP_CPU_SPEC "%(cpp_cpu32) %(cpp_cpucommon)"
+ #endif
+ #endif
  #endif
  
  #ifndef CC1_SPEC
*************** extern int ix86_arch;
*** 507,512 ****
--- 544,554 ----
  #define EXTRA_SPECS							\
    { "cpp_cpu_default",	CPP_CPU_DEFAULT_SPEC },				\
    { "cpp_cpu",	CPP_CPU_SPEC },						\
+   { "cpp_cpu32", CPP_CPU32_SPEC },					\
+   { "cpp_cpu64", CPP_CPU64_SPEC },					\
+   { "cpp_cpu32sizet", CPP_CPU32_SIZE_TYPE_SPEC },			\
+   { "cpp_cpu64sizet", CPP_CPU64_SIZE_TYPE_SPEC },			\
+   { "cpp_cpucommon", CPP_CPUCOMMON_SPEC },				\
    { "cc1_cpu",  CC1_CPU_SPEC },						\
    SUBTARGET_EXTRA_SPECS
  
*************** extern int ix86_arch;
*** 535,544 ****
  #define FLOAT_TYPE_SIZE 32
  #define LONG_TYPE_SIZE BITS_PER_WORD
  #define MAX_WCHAR_TYPE_SIZE 32
- #define MAX_LONG_TYPE_SIZE 64
  #define DOUBLE_TYPE_SIZE 64
  #define LONG_LONG_TYPE_SIZE 64
  
  /* Define if you don't want extended real, but do want to use the
     software floating point emulator for REAL_ARITHMETIC and
     decimal <-> binary conversion. */
--- 577,593 ----
  #define FLOAT_TYPE_SIZE 32
  #define LONG_TYPE_SIZE BITS_PER_WORD
  #define MAX_WCHAR_TYPE_SIZE 32
  #define DOUBLE_TYPE_SIZE 64
  #define LONG_LONG_TYPE_SIZE 64
  
+ #if defined (TARGET_BI_ARCH) || defined (TARGET_64BIT_DEFAULT)
+ #define MAX_BITS_PER_WORD 64
+ #define MAX_LONG_TYPE_SIZE 64
+ #else
+ #define MAX_BITS_PER_WORD 32
+ #define MAX_LONG_TYPE_SIZE 32
+ #endif
+ 
  /* Define if you don't want extended real, but do want to use the
     software floating point emulator for REAL_ARITHMETIC and
     decimal <-> binary conversion. */
*************** extern int ix86_arch;
*** 566,572 ****
     if using 16-bit ints on a 80386, this would still be 32.
     But on a machine with 16-bit registers, this would be 16.  */
  #define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
- #define MAX_BITS_PER_WORD 64
  
  /* Width of a word, in units (bytes).  */
  #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
--- 615,620 ----
*** /p1/x86-64/egcs/gcc/config/i386/i386.c	Thu Apr 26 20:25:01 2001
--- i386.c	Sun May  6 18:47:34 2001
*************** override_options ()
*** 701,706 ****
--- 742,750 ----
  	   ix86_cmodel_string, TARGET_64BIT ? "64" : "32");
    if (ix86_cmodel == CM_LARGE)
      sorry ("Code model `large' not supported yet.");
+   if ((TARGET_64BIT != 0) != ((target_flags & MASK_64BIT) != 0))
+     sorry ("%i-bit mode not compiled in.",
+ 	   (target_flags & MASK_64BIT) ? 64 : 32);
  
    if (ix86_arch_string != 0)
      {


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