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]

RFA: Remove TARGET_SWITCHES from the SH port


Because the SH options are so complex, I thought it would be better
to do the .opt transition in two stages: TARGET_SWITCHES and then
TARGET_OPTIONS.  This patch does the TARGET_SWITCHES bit.

The main complication is that so many options are only supposed to
be available if certain preprocessor conditions are true.  I've
handled this by:

  (1) Extending the .opt scripts so that options can be hidden
      from the user (see separate message)

  (2) Making the SUPPORT_* macros have the value "1" when defined.
      This allows them to be used in preprocessor conditions without
      resorting to "defined(...)".

  (3) Recoding logic such as:

        #ifndef SUPPORT_SH1
        ...
        #ifndef SUPPORT_SH2
        #define TARGET_SWITCH_SH2
        ...
        #endif
        #endif
        ...
        #ifndef TARGET_SWITCH_SH2
        #define TARGET_SWITCH_SH2 \
          {"2",		TARGET_NONE, "" }, \
          {"2",		SELECT_SH2, "Generate SH2 code" },
        #endif

      so that SUPPORT_SH1 implies SUPPORT_SH2 and so that the "-m2"
      option is conditional on SUPPORT_SH2:

        #if SUPPORT_SH1
        #define SUPPORT_SH2 1
        #endif
        ...
        m2
        Target RejectNegative Mask(SH2) Condition(SUPPORT_SH2)
        Generate SH2 code

  (4) Adding three new support macros:

        #define SUPPORT_ANY_SH5_32MEDIA \
          (SUPPORT_SH5_32MEDIA || SUPPORT_SH5_32MEDIA_NOFPU)
        #define SUPPORT_ANY_SH5_64MEDIA \
          (SUPPORT_SH5_64MEDIA || SUPPORT_SH5_64MEDIA_NOFPU)
        #define SUPPORT_ANY_SH5 \
          (SUPPORT_ANY_SH5_32MEDIA || SUPPORT_ANY_SH5_64MEDIA)

Also, superh.h and superh64.h define something called
TARGET_PROCESSOR_SWITCHES.  This macro doesn't seem to be used
anywhere, and as far as I can tell, the headers themselves aren't
included by any configuration.  The patch simply deletes them.
Is that OK?

Otherwise, the main changes are:

  (a) Changing FOO_BIT into MASK_FOO.  Many of the *_BIT names used
      a different base name from their associated TARGET_* macro.
      In such cases, the MASK_* macro now has the suffix as the
      TARGET_* one.

  (b) Overriding options.h's TARGET_SH4 with a definition that
      checks !TARGET_SH1.

  (c) Replacing TARGET_NONE with a new macro called MASK_ARCH.
      The new macro is the inclusive-OR of all flags controlled
      by the architecture options (rather than the negative).

  (d) Making sh_pch_valid_p check for specific flag groups rather
      than iterating over the TARGET_SWITCHES array.

Tested by building cc1 for sh-elf, sh-superh-elf, sh-linux-gnu and
sh64-elf and by trying each option by hand.  OK to install?

Richard


	* config.gcc (sh*-*-*): Define SUPPORT_* macros to 1.
	* config/sh/sh.h: Update mask names throughout.
	(target_flags, ISIZE_BIT, DALIGN_BIT, SH1_BIT, SH2_BIT, SH3_BIT)
	(SH_E_BIT, HARD_SH4_BIT, FPU_SINGLE_BIT, SH4_BIT, SH4A_BIT, FMOVD_BIT)
	(SH5_BIT, SPACE_BIT, BIGTABLE_BIT, RELAX_BIT, USERMODE_BIT)
	(HITACHI_BIT, NOMACSAVE_BIT, PREFERGOT_BIT, PADSTRUCT_BIT)
	(LITTLE_ENDIAN_BIT, IEEE_BIT, SAVE_ALL_TR_BIT, HARD_SH2A_BIT)
	(HARD_SH2A_DOUBLE_BIT, INDEXED_ADDRESS_BIT, PT_FIXED_BIT)
	(INVALID_SYMBOLS_BIT, ADJUST_UNROLL_BIT, TARGET_DUMPISIZE)
	(TARGET_ALIGN_DOUBLE, TARGET_SH1, TARGET_SH2, TARGET_SH3)
	(TARGET_HARD_SH4, TARGET_FPU_SINGLE, TARGET_SH5, TARGET_FMOVD)
	(TARGET_IEEE, TARGET_SMALLCODE, TARGET_BIGTABLE, TARGET_RELAX)
	(TARGET_HITACHI, TARGET_NOMACSAVE, TARGET_PADSTRUCT)
	(TARGET_LITTLE_ENDIAN, TARGET_USERMODE, TARGET_PREFERGOT)
	(TARGET_SAVE_ALL_TARGET_REGS, TARGET_ALLOW_INDEXED_ADDRESS)
	(TARGET_PT_FIXED, TARGET_INVALID_SYMBOLS, TARGET_ADJUST_UNROLL)
	(TARGET_SWITCH_SH1, TARGET_SWITCH_SH2, TARGET_SWITCH_SH2E)
	(TARGET_SWITCH_SH2A, TARGET_SWITCH_SH2A_SINGLE_ONLY)
	(TARGET_SWITCH_SH2A_SINGLE, TARGET_SWITCH_SH2A_NOFPU)
	(TARGET_SWITCH_SH3, TARGET_SWITCH_SH3E, TARGET_SWITCH_SH4_SINGLE_ONLY)
	(TARGET_SWITCH_SH4_SINGLE, TARGET_SWITCH_SH4_NOFPU, TARGET_SWITCH_SH4)
	(TARGET_SWITCH_SH4A, TARGET_SWITCH_SH4A_SINGLE_ONLY)
	(TARGET_SWITCH_SH4A_SINGLE, TARGET_SWITCH_SH4A_NOFPU)
	(TARGET_SWITCH_SH4AL, TARGET_SWITCH_SH5_64MEDIA)
	(TARGET_SWITCH_SH5_64MEDIA_NOFPU, TARGET_SWITCHES_SH5_32MEDIA)
	(TARGET_SWITCHES_SH5_32MEDIA_NOFPU, TARGET_SWITCH_SH5_32_ANY_EXTRA)
	(TARGET_SWITCH_SH5_MEDIA_ANY_EXTRA, TARGET_SWITCHES)
	(SUBTARGET_SWITCHES): Delete.
	(TARGET_SH2E, TARGET_SH2A, TARGET_SH2A_SINGLE, TARGET_SH2A_DOUBLE)
	(TARGET_SH3E, TARGET_CACHE32, TARGET_SUPERSCALAR, TARGET_HARVARD)
	(TARGET_FPU_DOUBLE, TARGET_SH4A_ARCH, TARGET_SHMEDIA32)
	(TARGET_SHMEDIA64): Redefine using other TARGET_* macros.
	(TARGET_SH4): Undefine options.h definition and check MASK_SH1 as well.
	(SUPPORT_SH1, SUPPORT_SH2E, SUPPORT_SH4, SUPPORT_SH4_SINGLE)
	(SUPPORT_SH2A, SUPPORT_SH2A_SINGLE): Make numeric.
	(SUPPORT_SH2): Define to 1 if SUPPORT_SH1.
	(SUPPORT_SH3): Likewise SUPPORT_SH2.
	(SUPPORT_SH4_NOFPU): Likewise SUPPORT_SH3.
	(SUPPORT_SH4A_NOFPU, SUPPORT_SH4AL, SUPPORT_SH2A_NOFPU): Likewise
	SUPPORT_SH4_NOFPU.
	(SUPPORT_SH3E): Likewise SUPPORT_SH2E.
	(SUPPORT_SH4_SINGLE_ONLY, SUPPORT_SH4A_SINGLE_ONLY)
	(SUPPORT_SH2A_SINGLE_ONLY): Likewise SUPPORT_SH3E.
	(SUPPORT_SH4A): Likewise SUPPORT_SH4.
	(SUPPORT_SH4A_SINGLE): Likewise SUPPORT_SH4_SINGLE.
	(SUPPORT_SH5_32MEDIA): Likewise SUPPORT_SH5_COMPACT.
	(SUPPORT_SH5_32MEDIA_NOFPU): Likewise SUPPORT_SH5_COMPACT_NOFPU.
	(SUPPORT_ANY_SH5_32MEDIA, SUPPORT_ANY_SH5_64MEDIA)
	(SUPPORT_ANY_SH5): New macros.
	(TARGET_NONE): Replace with...
	(MASK_ARCH): ...this new macro.
	* config/sh/elf.h: Update mask names
	* config/sh/linux.h: Likewise.
	* config/sh/little.h: Likewise.
	* config/sh/netbsd-elf.h: Likewise.
	* config/sh/symbian-pre.h: Likewise.
	* config/sh/sh.c (sh_handle_option): New function.
	(TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Override defaults.
	(calc_live_regs): Use MASK_FPU_SINGLE instead of FPU_SINGLE_BIT.
	(sh_target_switches, target_switches): Delete.
	(sh_pch_valid_p): Check for specific differences in the target_flags
	settings.
	(sh_init_cumulative_args): Use MASK_HITACHI instead of HITACHI_BIT.
	* config/sh/superh.h: Delete.
	* config/sh/superh64.h: Delete.
	* config/sh/sh.opt: New file.

Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.544
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.544 config.gcc
--- config.gcc	7 May 2005 18:51:39 -0000	1.544
+++ config.gcc	15 May 2005 21:48:59 -0000
@@ -1945,7 +1945,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbian
 		sh5-32media | sh5-32media-nofpu | \
 		sh5-compact | sh5-compact-nofpu)
 			tmake_file="${tmake_file} sh/t-mlib-${sh_multilib}"
-			tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr a-z- A-Z_`"
+			tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr a-z- A-Z_`=1"
 			;;
 		*)
 			echo "with_multilib_list=${sh_multilib} not supported."
@@ -1954,7 +1954,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbian
 		esac
 	done
 	if test x${enable_incomplete_targets} == xyes ; then
-		tm_defines="$tm_defines SUPPORT_SH1 SUPPORT_SH2E SUPPORT_SH4 SUPPORT_SH4_SINGLE SUPPORT_SH2A SUPPORT_SH2A_SINGLE SUPPORT_SH5_32MEDIA SUPPORT_SH5_32MEDIA_NOFPU SUPPORT_SH5_64MEDIA SUPPORT_SH5_64MEDIA_NOFPU"
+		tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1"
 	fi
 	use_fixproto=yes
 	;;
Index: config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.266
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.266 sh.h
--- config/sh/sh.h	9 May 2005 17:42:37 -0000	1.266
+++ config/sh/sh.h	15 May 2005 21:49:01 -0000
@@ -148,108 +148,49 @@ #define CONDITIONAL_REGISTER_USAGE do			
 	SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno);	\
 } while (0)
 
-/* ??? Need to write documentation for all SH options and add it to the
-   invoke.texi file.  */
-
-/* Run-time compilation parameters selecting different hardware subsets.  */
-
-extern int target_flags;
-#define ISIZE_BIT      	(1<<1)
-#define DALIGN_BIT     	(1<<6)
-#define SH1_BIT	       	(1<<8)
-#define SH2_BIT	       	(1<<9)
-#define SH3_BIT	       	(1<<10)
-#define SH_E_BIT	(1<<11)
-#define HARD_SH4_BIT	(1<<5)
-#define FPU_SINGLE_BIT	(1<<7)
-#define SH4_BIT	       	(1<<12)
-#define SH4A_BIT	(1<<3)
-#define FMOVD_BIT	(1<<4)
-#define SH5_BIT		(1<<0)
-#define SPACE_BIT 	(1<<13)
-#define BIGTABLE_BIT  	(1<<14)
-#define RELAX_BIT	(1<<15)
-#define USERMODE_BIT	(1<<16)
-#define HITACHI_BIT     (1<<22)
-#define NOMACSAVE_BIT   (1<<23)
-#define PREFERGOT_BIT	(1<<24)
-#define PADSTRUCT_BIT  (1<<28)
-#define LITTLE_ENDIAN_BIT (1<<29)
-#define IEEE_BIT (1<<30)
-#define SAVE_ALL_TR_BIT (1<<2)
-#define HARD_SH2A_BIT	(1<<17)
-#define HARD_SH2A_DOUBLE_BIT	(1<<18)
-#define INDEXED_ADDRESS_BIT (1<<19)
-#define PT_FIXED_BIT	(1<<21)
-#define INVALID_SYMBOLS_BIT (1<<25)
-#define ADJUST_UNROLL_BIT (1<<20)
-
 /* Nonzero if this is an ELF target - compile time only */
 #define TARGET_ELF 0
 
-/* Nonzero if we should dump out instruction size info.  */
-#define TARGET_DUMPISIZE  (target_flags & ISIZE_BIT)
-
-/* Nonzero to align doubles on 64 bit boundaries.  */
-#define TARGET_ALIGN_DOUBLE (target_flags & DALIGN_BIT)
-
-/* Nonzero if we should generate code using type 1 insns.  */
-#define TARGET_SH1 (target_flags & SH1_BIT)
-
-/* Nonzero if we should generate code using type 2 insns.  */
-#define TARGET_SH2 (target_flags & SH2_BIT)
-
 /* Nonzero if we should generate code using type 2E insns.  */
-#define TARGET_SH2E ((target_flags & SH_E_BIT) && TARGET_SH2)
+#define TARGET_SH2E (TARGET_SH2 && TARGET_SH_E)
 
 /* Nonzero if we should generate code using type 2A insns.  */
-#define TARGET_SH2A (target_flags & HARD_SH2A_BIT)
+#define TARGET_SH2A TARGET_HARD_SH2A
 /* Nonzero if we should generate code using type 2A SF insns.  */
-#define TARGET_SH2A_SINGLE ((target_flags & HARD_SH2A_BIT) && TARGET_SH2E)
+#define TARGET_SH2A_SINGLE (TARGET_SH2A && TARGET_SH2E)
 /* Nonzero if we should generate code using type 2A DF insns.  */
-#define TARGET_SH2A_DOUBLE ((target_flags & HARD_SH2A_DOUBLE_BIT) && TARGET_SH2A)
-
-/* Nonzero if we should generate code using type 3 insns.  */
-#define TARGET_SH3 (target_flags & SH3_BIT)
+#define TARGET_SH2A_DOUBLE (TARGET_HARD_SH2A_DOUBLE && TARGET_SH2A)
 
 /* Nonzero if we should generate code using type 3E insns.  */
-#define TARGET_SH3E ((target_flags & SH_E_BIT) && TARGET_SH3)
+#define TARGET_SH3E (TARGET_SH3 && TARGET_SH_E)
 
 /* Nonzero if the cache line size is 32.  */
-#define TARGET_CACHE32 (target_flags & HARD_SH4_BIT || TARGET_SH5)
+#define TARGET_CACHE32 (TARGET_HARD_SH4 || TARGET_SH5)
 
 /* Nonzero if we schedule for a superscalar implementation.  */
-#define TARGET_SUPERSCALAR (target_flags & HARD_SH4_BIT)
+#define TARGET_SUPERSCALAR TARGET_HARD_SH4
 
 /* Nonzero if the target has separate instruction and data caches.  */
-#define TARGET_HARVARD (target_flags & HARD_SH4_BIT || TARGET_SH5)
-
-/* Nonzero if compiling for SH4 hardware (to be used for insn costs etc.)  */
-#define TARGET_HARD_SH4 (target_flags & HARD_SH4_BIT)
-
-/* Nonzero if the default precision of th FPU is single */
-#define TARGET_FPU_SINGLE (target_flags & FPU_SINGLE_BIT)
+#define TARGET_HARVARD (TARGET_HARD_SH4 || TARGET_SH5)
 
 /* Nonzero if a double-precision FPU is available.  */
-#define TARGET_FPU_DOUBLE ((target_flags & SH4_BIT) || TARGET_SH2A_DOUBLE)
+#define TARGET_FPU_DOUBLE (TARGET_SH4 || TARGET_SH2A_DOUBLE)
 
 /* Nonzero if an FPU is available.  */
 #define TARGET_FPU_ANY (TARGET_SH2E || TARGET_FPU_DOUBLE)
 
 /* Nonzero if we should generate code using type 4 insns.  */
-#define TARGET_SH4 ((target_flags & SH4_BIT) && (target_flags & SH1_BIT))
+#undef TARGET_SH4
+#define TARGET_SH4 ((target_flags & MASK_SH4) != 0 && TARGET_SH1)
 
 /* Nonzero if we're generating code for the common subset of
    instructions present on both SH4a and SH4al-dsp.  */
-#define TARGET_SH4A_ARCH (target_flags & SH4A_BIT)
+#define TARGET_SH4A_ARCH TARGET_SH4A
 
 /* Nonzero if we're generating code for SH4a, unless the use of the
    FPU is disabled (which makes it compatible with SH4al-dsp).  */
 #define TARGET_SH4A_FP (TARGET_SH4A_ARCH && TARGET_FPU_ANY)
 
-/* Nonzero if we should generate code for a SH5 CPU (either ISA).  */
-#define TARGET_SH5 (target_flags & SH5_BIT)
-
 /* Nonzero if we should generate code using the SHcompact instruction
    set and 32-bit ABI.  */
 #define TARGET_SHCOMPACT (TARGET_SH5 && TARGET_SH1)
@@ -260,55 +201,14 @@ #define TARGET_SHMEDIA (TARGET_SH5 && ! 
 
 /* Nonzero if we should generate code using the SHmedia ISA and 32-bit
    ABI.  */
-#define TARGET_SHMEDIA32 (TARGET_SH5 && ! TARGET_SH1 \
-			  && (target_flags & SH_E_BIT))
+#define TARGET_SHMEDIA32 (TARGET_SH5 && ! TARGET_SH1 && TARGET_SH_E)
 
 /* Nonzero if we should generate code using the SHmedia ISA and 64-bit
    ABI.  */
-#define TARGET_SHMEDIA64 (TARGET_SH5 && ! TARGET_SH1 \
- 			  && ! (target_flags & SH_E_BIT))
+#define TARGET_SHMEDIA64 (TARGET_SH5 && ! TARGET_SH1 && ! TARGET_SH_E)
 
 /* Nonzero if we should generate code using SHmedia FPU instructions.  */
 #define TARGET_SHMEDIA_FPU (TARGET_SHMEDIA && TARGET_FPU_DOUBLE)
-/* Nonzero if we should generate fmovd.  */
-#define TARGET_FMOVD (target_flags & FMOVD_BIT)
-
-/* Nonzero if we respect NANs.  */
-#define TARGET_IEEE (target_flags & IEEE_BIT)
-
-/* Nonzero if we should generate smaller code rather than faster code.  */
-#define TARGET_SMALLCODE   (target_flags & SPACE_BIT)
-
-/* Nonzero to use long jump tables.  */
-#define TARGET_BIGTABLE     (target_flags & BIGTABLE_BIT)
-
-/* Nonzero to generate pseudo-ops needed by the assembler and linker
-   to do function call relaxing.  */
-#define TARGET_RELAX (target_flags & RELAX_BIT)
-
-/* Nonzero if using Renesas's calling convention.  */
-#define TARGET_HITACHI 		(target_flags & HITACHI_BIT)
-
-/* Nonzero if not saving macl/mach when using -mhitachi */
-#define TARGET_NOMACSAVE	(target_flags & NOMACSAVE_BIT)
-
-/* Nonzero if padding structures to a multiple of 4 bytes.  This is
-   incompatible with Renesas's compiler, and gives unusual structure layouts
-   which confuse programmers.
-   ??? This option is not useful, but is retained in case there are people
-   who are still relying on it.  It may be deleted in the future.  */
-#define TARGET_PADSTRUCT       (target_flags & PADSTRUCT_BIT)
-
-/* Nonzero if generating code for a little endian SH.  */
-#define TARGET_LITTLE_ENDIAN     (target_flags & LITTLE_ENDIAN_BIT)
-
-/* Nonzero if we should do everything in userland.  */
-#define TARGET_USERMODE		(target_flags & USERMODE_BIT)
-
-/* Nonzero if we should prefer @GOT calls when generating PIC.  */
-#define TARGET_PREFERGOT	(target_flags & PREFERGOT_BIT)
-
-#define TARGET_SAVE_ALL_TARGET_REGS (target_flags & SAVE_ALL_TR_BIT)
 
 /* This is not used by the SH2E calling convention  */
 #define TARGET_VARARGS_PRETEND_ARGS(FUN_DECL) \
@@ -317,12 +217,12 @@ #define TARGET_VARARGS_PRETEND_ARGS(FUN_
 
 #ifndef TARGET_CPU_DEFAULT
 #define TARGET_CPU_DEFAULT SELECT_SH1
-#define SUPPORT_SH1
-#define SUPPORT_SH2E
-#define SUPPORT_SH4
-#define SUPPORT_SH4_SINGLE
-#define SUPPORT_SH2A
-#define SUPPORT_SH2A_SINGLE
+#define SUPPORT_SH1 1
+#define SUPPORT_SH2E 1
+#define SUPPORT_SH4 1
+#define SUPPORT_SH4_SINGLE 1
+#define SUPPORT_SH2A 1
+#define SUPPORT_SH2A_SINGLE 1
 #endif
 
 #define TARGET_DIVIDE_INV \
@@ -339,307 +239,88 @@ #define TARGET_DIVIDE_INV20L (sh_div_str
 #define TARGET_DIVIDE_INV_CALL (sh_div_strategy == SH_DIV_INV_CALL)
 #define TARGET_DIVIDE_INV_CALL2 (sh_div_strategy == SH_DIV_INV_CALL2)
 
-/* Target macros pertaining to SHmedia architecture bugs.  */
-#define TARGET_ALLOW_INDEXED_ADDRESS (target_flags & INDEXED_ADDRESS_BIT)
-#define TARGET_PT_FIXED (target_flags & PT_FIXED_BIT)
-#define TARGET_INVALID_SYMBOLS (target_flags & INVALID_SYMBOLS_BIT)
-
-#define TARGET_ADJUST_UNROLL (target_flags & ADJUST_UNROLL_BIT)
-
-#define SELECT_SH1               (SH1_BIT)
-#define SELECT_SH2               (SH2_BIT | SELECT_SH1)
-#define SELECT_SH2E              (SH_E_BIT | SH2_BIT | SH1_BIT | FPU_SINGLE_BIT)
-#define SELECT_SH2A              (SH_E_BIT | HARD_SH2A_BIT | HARD_SH2A_DOUBLE_BIT | SH2_BIT | SH1_BIT)
-#define SELECT_SH2A_NOFPU        (HARD_SH2A_BIT | SH2_BIT | SH1_BIT)
-#define SELECT_SH2A_SINGLE_ONLY  (SH_E_BIT | HARD_SH2A_BIT | SH2_BIT | SH1_BIT | FPU_SINGLE_BIT)
-#define SELECT_SH2A_SINGLE       (SH_E_BIT | HARD_SH2A_BIT | FPU_SINGLE_BIT \
-				  | HARD_SH2A_DOUBLE_BIT | SH2_BIT | SH1_BIT)
-#define SELECT_SH3               (SH3_BIT | SELECT_SH2)
-#define SELECT_SH3E              (SH_E_BIT | FPU_SINGLE_BIT | SELECT_SH3)
-#define SELECT_SH4_NOFPU         (HARD_SH4_BIT | SELECT_SH3)
-#define SELECT_SH4_SINGLE_ONLY   (HARD_SH4_BIT | SELECT_SH3E)
-#define SELECT_SH4               (SH4_BIT | SH_E_BIT | HARD_SH4_BIT | SELECT_SH3)
-#define SELECT_SH4_SINGLE        (FPU_SINGLE_BIT | SELECT_SH4)
-#define SELECT_SH4A_NOFPU        (SH4A_BIT | SELECT_SH4_NOFPU)
-#define SELECT_SH4A_SINGLE_ONLY  (SH4A_BIT | SELECT_SH4_SINGLE_ONLY)
-#define SELECT_SH4A              (SH4A_BIT | SELECT_SH4)
-#define SELECT_SH4A_SINGLE       (SH4A_BIT | SELECT_SH4_SINGLE)
-#define SELECT_SH5_64MEDIA       (SH5_BIT | SH4_BIT)
-#define SELECT_SH5_64MEDIA_NOFPU (SH5_BIT)
-#define SELECT_SH5_32MEDIA       (SH5_BIT | SH4_BIT | SH_E_BIT)
-#define SELECT_SH5_32MEDIA_NOFPU (SH5_BIT | SH_E_BIT)
-#define SELECT_SH5_COMPACT       (SH5_BIT | SH4_BIT | SELECT_SH3E)
-#define SELECT_SH5_COMPACT_NOFPU (SH5_BIT | SELECT_SH3)
-
-/* Disable processor switches for which we have no suitable multilibs.  */
-#ifndef SUPPORT_SH1
-#define TARGET_SWITCH_SH1
-#ifndef SUPPORT_SH2
-#define TARGET_SWITCH_SH2
-#ifndef SUPPORT_SH3
-#define TARGET_SWITCH_SH3
-#ifndef SUPPORT_SH4_NOFPU
-#define TARGET_SWITCH_SH4_NOFPU
-#endif
-#ifndef SUPPORT_SH4A_NOFPU
-#define TARGET_SWITCH_SH4A_NOFPU
-#endif
-#ifndef SUPPORT_SH4AL
-#define TARGET_SWITCH_SH4AL
-#endif
-#ifndef SUPPORT_SH2A_NOFPU
-#define TARGET_SWITCH_SH2A_NOFPU
-#endif
-#endif
-#endif
-#endif
-
-#ifndef SUPPORT_SH2E
-#define TARGET_SWITCH_SH2E
-#ifndef SUPPORT_SH3E
-#define TARGET_SWITCH_SH3E
-#ifndef SUPPORT_SH4_SINGLE_ONLY
-#define TARGET_SWITCH_SH4_SINGLE_ONLY
-#endif
-#ifndef SUPPORT_SH4A_SINGLE_ONLY
-#define TARGET_SWITCH_SH4A_SINGLE_ONLY
-#endif
-#ifndef SUPPORT_SH2A_SINGLE_ONLY
-#define TARGET_SWITCH_SH2A_SINGLE_ONLY
-#endif
-#endif
-#endif
-
-#ifndef SUPPORT_SH4
-#define TARGET_SWITCH_SH4
-#ifndef SUPPORT_SH4A
-#define TARGET_SWITCH_SH4A
-#endif
-#endif
-
-#ifndef SUPPORT_SH4_SINGLE
-#define TARGET_SWITCH_SH4_SINGLE
-#ifndef SUPPORT_SH4A_SINGLE
-#define TARGET_SWITCH_SH4A_SINGLE
-#endif
-#endif
-
-#ifndef SUPPORT_SH2A
-#define TARGET_SWITCH_SH2A
-#endif
-
-#ifndef SUPPORT_SH2A_SINGLE
-#define TARGET_SWITCH_SH2A_SINGLE
-#endif
-
-#ifndef SUPPORT_SH5_64MEDIA
-#define TARGET_SWITCH_SH5_64MEDIA
-#endif
-
-#ifndef SUPPORT_SH5_64MEDIA_NOFPU
-#define TARGET_SWITCH_SH5_64MEDIA_NOFPU
-#endif
-
-#if !defined(SUPPORT_SH5_32MEDIA) && !defined (SUPPORT_SH5_COMPACT)
-#define TARGET_SWITCHES_SH5_32MEDIA
-#endif
-
-#if !defined(SUPPORT_SH5_32MEDIA_NOFPU) && !defined (SUPPORT_SH5_COMPACT_NOFPU)
-#define TARGET_SWITCHES_SH5_32MEDIA_NOFPU
-#endif
-
-#if defined(TARGET_SWITCHES_SH5_32MEDIA) && defined(TARGET_SWITCHES_SH5_32MEDIA_NOFPU)
-#define TARGET_SWITCH_SH5_32_ANY_EXTRA
-#endif
-
-#if defined(TARGET_SWITCH_SH5_32_ANY_EXTRA) && !defined(SUPPORT_SH5_64MEDIA) && !defined(SUPPORT_SH5_64MEDIA_NOFPU)
-#define TARGET_SWITCH_SH5_MEDIA_ANY_EXTRA
-#endif
+#define SELECT_SH1               (MASK_SH1)
+#define SELECT_SH2               (MASK_SH2 | SELECT_SH1)
+#define SELECT_SH2E              (MASK_SH_E | MASK_SH2 | MASK_SH1 \
+				  | MASK_FPU_SINGLE)
+#define SELECT_SH2A              (MASK_SH_E | MASK_HARD_SH2A \
+				  | MASK_HARD_SH2A_DOUBLE \
+				  | MASK_SH2 | MASK_SH1)
+#define SELECT_SH2A_NOFPU        (MASK_HARD_SH2A | MASK_SH2 | MASK_SH1)
+#define SELECT_SH2A_SINGLE_ONLY  (MASK_SH_E | MASK_HARD_SH2A | MASK_SH2 \
+				  | MASK_SH1 | MASK_FPU_SINGLE)
+#define SELECT_SH2A_SINGLE       (MASK_SH_E | MASK_HARD_SH2A \
+				  | MASK_FPU_SINGLE | MASK_HARD_SH2A_DOUBLE \
+				  | MASK_SH2 | MASK_SH1)
+#define SELECT_SH3               (MASK_SH3 | SELECT_SH2)
+#define SELECT_SH3E              (MASK_SH_E | MASK_FPU_SINGLE | SELECT_SH3)
+#define SELECT_SH4_NOFPU         (MASK_HARD_SH4 | SELECT_SH3)
+#define SELECT_SH4_SINGLE_ONLY   (MASK_HARD_SH4 | SELECT_SH3E)
+#define SELECT_SH4               (MASK_SH4 | MASK_SH_E | MASK_HARD_SH4 \
+				  | SELECT_SH3)
+#define SELECT_SH4_SINGLE        (MASK_FPU_SINGLE | SELECT_SH4)
+#define SELECT_SH4A_NOFPU        (MASK_SH4A | SELECT_SH4_NOFPU)
+#define SELECT_SH4A_SINGLE_ONLY  (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
+#define SELECT_SH4A              (MASK_SH4A | SELECT_SH4)
+#define SELECT_SH4A_SINGLE       (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SH5_64MEDIA       (MASK_SH5 | MASK_SH4)
+#define SELECT_SH5_64MEDIA_NOFPU (MASK_SH5)
+#define SELECT_SH5_32MEDIA       (MASK_SH5 | MASK_SH4 | MASK_SH_E)
+#define SELECT_SH5_32MEDIA_NOFPU (MASK_SH5 | MASK_SH_E)
+#define SELECT_SH5_COMPACT       (MASK_SH5 | MASK_SH4 | SELECT_SH3E)
+#define SELECT_SH5_COMPACT_NOFPU (MASK_SH5 | SELECT_SH3)
+
+#if SUPPORT_SH1
+#define SUPPORT_SH2 1
+#endif
+#if SUPPORT_SH2
+#define SUPPORT_SH3 1
+#endif
+#if SUPPORT_SH3
+#define SUPPORT_SH4_NOFPU 1
+#endif
+#if SUPPORT_SH4_NOFPU
+#define SUPPORT_SH4A_NOFPU 1
+#define SUPPORT_SH4AL 1
+#define SUPPORT_SH2A_NOFPU 1
+#endif
+
+#if SUPPORT_SH2E
+#define SUPPORT_SH3E 1
+#endif
+#if SUPPORT_SH3E
+#define SUPPORT_SH4_SINGLE_ONLY 1
+#define SUPPORT_SH4A_SINGLE_ONLY 1
+#define SUPPORT_SH2A_SINGLE_ONLY 1
+#endif
+
+#if SUPPORT_SH4
+#define SUPPORT_SH4A 1
+#endif
+
+#if SUPPORT_SH4_SINGLE
+#define SUPPORT_SH4A_SINGLE 1
+#endif
+
+#if SUPPORT_SH5_COMPAT
+#define SUPPORT_SH5_32MEDIA 1
+#endif
+
+#if SUPPORT_SH5_COMPACT_NOFPU
+#define SUPPORT_SH5_32MEDIA_NOFPU 1
+#endif
+
+#define SUPPORT_ANY_SH5_32MEDIA \
+  (SUPPORT_SH5_32MEDIA || SUPPORT_SH5_32MEDIA_NOFPU)
+#define SUPPORT_ANY_SH5_64MEDIA \
+  (SUPPORT_SH5_64MEDIA || SUPPORT_SH5_64MEDIA_NOFPU)
+#define SUPPORT_ANY_SH5 \
+  (SUPPORT_ANY_SH5_32MEDIA || SUPPORT_ANY_SH5_64MEDIA)
 
 /* Reset all target-selection flags.  */
-#define TARGET_NONE -(SH1_BIT | SH2_BIT | SH3_BIT | SH_E_BIT | SH4_BIT \
-		      | HARD_SH2A_BIT | HARD_SH2A_DOUBLE_BIT \
-		      | SH4A_BIT | HARD_SH4_BIT | FPU_SINGLE_BIT | SH5_BIT)
-
-#ifndef TARGET_SWITCH_SH1
-#define TARGET_SWITCH_SH1 \
-  {"1",		TARGET_NONE, "" }, \
-  {"1",		SELECT_SH1, "Generate SH1 code" },
-#endif
-#ifndef TARGET_SWITCH_SH2
-#define TARGET_SWITCH_SH2 \
-  {"2",		TARGET_NONE, "" }, \
-  {"2",		SELECT_SH2, "Generate SH2 code" },
-#endif
-#ifndef TARGET_SWITCH_SH2E
-#define TARGET_SWITCH_SH2E \
-  {"2e",	TARGET_NONE, "" }, \
-  {"2e",	SELECT_SH2E, "Generate SH2e code" },
-#endif
-#ifndef TARGET_SWITCH_SH2A
-#define TARGET_SWITCH_SH2A \
-  {"2a",	TARGET_NONE, "" }, \
-  {"2a",	SELECT_SH2A, "Generate SH2a code" },
-#endif
-#ifndef TARGET_SWITCH_SH2A_SINGLE_ONLY
-#define TARGET_SWITCH_SH2A_SINGLE_ONLY \
-  {"2a-single-only", TARGET_NONE, "" },	\
-  {"2a-single-only", SELECT_SH2A_SINGLE_ONLY, "Generate only single-precision SH2a code" },
-#endif
-#ifndef TARGET_SWITCH_SH2A_SINGLE
-#define TARGET_SWITCH_SH2A_SINGLE \
-  {"2a-single", TARGET_NONE, "" },	\
-  {"2a-single", SELECT_SH2A_SINGLE, "Generate default single-precision SH2a code" },
-#endif
-#ifndef TARGET_SWITCH_SH2A_NOFPU
-#define TARGET_SWITCH_SH2A_NOFPU \
-  {"2a-nofpu",  TARGET_NONE, "" },	\
-  {"2a-nofpu",  SELECT_SH2A_NOFPU, "Generate SH2a FPU-less code" },
-#endif
-#ifndef TARGET_SWITCH_SH3
-#define TARGET_SWITCH_SH3 \
-  {"3",		TARGET_NONE, "" }, \
-  {"3",		SELECT_SH3, "Generate SH3 code" },
-#endif
-#ifndef TARGET_SWITCH_SH3E
-#define TARGET_SWITCH_SH3E \
-  {"3e",	TARGET_NONE, "" }, \
-  {"3e",	SELECT_SH3E, "Generate SH3e code" },
-#endif
-#ifndef TARGET_SWITCH_SH4_SINGLE_ONLY
-#define TARGET_SWITCH_SH4_SINGLE_ONLY \
-  {"4-single-only",	TARGET_NONE, "" }, \
-  {"4-single-only",	SELECT_SH4_SINGLE_ONLY, "Generate only single-precision SH4 code" },
-#endif
-#ifndef TARGET_SWITCH_SH4_SINGLE
-#define TARGET_SWITCH_SH4_SINGLE \
-  {"4-single",	TARGET_NONE, "" }, \
-  {"4-single",	SELECT_SH4_SINGLE, "Generate default single-precision SH4 code" },
-#endif
-#ifndef TARGET_SWITCH_SH4_NOFPU
-#define TARGET_SWITCH_SH4_NOFPU \
-  {"4-nofpu",	TARGET_NONE, "" }, \
-  {"4-nofpu",	SELECT_SH4_NOFPU, "Generate SH4 FPU-less code" },
-#endif
-#ifndef TARGET_SWITCH_SH4
-#define TARGET_SWITCH_SH4 \
-  {"4",		TARGET_NONE, "" }, \
-  {"4",		SELECT_SH4, "Generate SH4 code" },
-#endif
-#ifndef TARGET_SWITCH_SH4A
-#define TARGET_SWITCH_SH4A \
-  {"4a",	TARGET_NONE, "" }, \
-  {"4a",	SELECT_SH4A, "Generate SH4a code" },
-#endif
-#ifndef TARGET_SWITCH_SH4A_SINGLE_ONLY
-#define TARGET_SWITCH_SH4A_SINGLE_ONLY \
-  {"4a-single-only",	TARGET_NONE, "" },	\
-  {"4a-single-only",	SELECT_SH4A_SINGLE_ONLY, "Generate only single-precision SH4a code" },
-#endif
-#ifndef TARGET_SWITCH_SH4A_SINGLE
-#define TARGET_SWITCH_SH4A_SINGLE \
-  {"4a-single",	TARGET_NONE, "" },\
-  {"4a-single",	SELECT_SH4A_SINGLE, "Generate default single-precision SH4a code" },
-#endif
-#ifndef TARGET_SWITCH_SH4A_NOFPU
-#define TARGET_SWITCH_SH4A_NOFPU \
-  {"4a-nofpu",	TARGET_NONE, "" },\
-  {"4a-nofpu",	SELECT_SH4A_NOFPU, "Generate SH4a FPU-less code" },
-#endif
-#ifndef TARGET_SWITCH_SH4AL
-#define TARGET_SWITCH_SH4AL \
-  {"4al",	TARGET_NONE, "" },\
-  {"4al",	SELECT_SH4A_NOFPU, "Generate SH4al-dsp code" },
-#endif
-#ifndef TARGET_SWITCH_SH5_64MEDIA
-#define TARGET_SWITCH_SH5_64MEDIA \
-  {"5-64media",	TARGET_NONE, "" },		\
-  {"5-64media", SELECT_SH5_64MEDIA, "Generate 64-bit SHmedia code" },
-#endif
-#ifndef TARGET_SWITCH_SH5_64MEDIA_NOFPU
-#define TARGET_SWITCH_SH5_64MEDIA_NOFPU \
-  {"5-64media-nofpu", TARGET_NONE, "" },	\
-  {"5-64media-nofpu", SELECT_SH5_64MEDIA_NOFPU, "Generate 64-bit FPU-less SHmedia code" },
-#endif
-#ifndef TARGET_SWITCHES_SH5_32MEDIA
-#define TARGET_SWITCHES_SH5_32MEDIA \
-  {"5-32media",	TARGET_NONE, "" },		\
-  {"5-32media", SELECT_SH5_32MEDIA, "Generate 32-bit SHmedia code" }, \
-  {"5-compact",	TARGET_NONE, "" },		\
-  {"5-compact",	SELECT_SH5_COMPACT, "Generate SHcompact code" },
-#endif
-#ifndef TARGET_SWITCHES_SH5_32MEDIA_NOFPU
-#define TARGET_SWITCHES_SH5_32MEDIA_NOFPU \
-  {"5-32media-nofpu", TARGET_NONE, "" },	\
-  {"5-32media-nofpu", SELECT_SH5_32MEDIA_NOFPU, "Generate 32-bit FPU-less SHmedia code" }, \
-  {"5-compact-nofpu", TARGET_NONE, "" },	\
-  {"5-compact-nofpu", SELECT_SH5_COMPACT_NOFPU, "Generate FPU-less SHcompact code" },
-#endif
-
-#ifndef TARGET_SWITCH_SH5_32_ANY_EXTRA
-#define TARGET_SWITCH_SH5_32_ANY_EXTRA \
-  {"indexed-addressing", INDEXED_ADDRESS_BIT, "Enable the use of the indexed addressing mode for SHmedia32/SHcompact"}, \
-  {"no-indexed-addressing", -INDEXED_ADDRESS_BIT, "Disable the use of the indexed addressing mode for SHmedia32/SHcompact"},
-#endif
-
-#ifndef TARGET_SWITCH_SH5_MEDIA_ANY_EXTRA
-#define TARGET_SWITCH_SH5_MEDIA_ANY_EXTRA \
-  {"pt-fixed",	PT_FIXED_BIT, "Assume pt* instructions won't trap"}, \
-  {"no-pt-fixed", -PT_FIXED_BIT, "Assume pt* instructions may trap"}, \
-  {"invalid-symbols",INVALID_SYMBOLS_BIT, "Assume symbols might be invalid"}, \
-  {"no-invalid-symbols",-INVALID_SYMBOLS_BIT, "Assume symbols won't be invalid"}, \
-  {"adjust-unroll", ADJUST_UNROLL_BIT, "Throttle unrolling to avoid thrashing target registers unless the unroll benefit outweighs this"}, \
-  {"no-adjust-unroll", -ADJUST_UNROLL_BIT, "Don't throttle unrolling"},
-#endif
-
-#define TARGET_SWITCHES \
-{ TARGET_SWITCH_SH1 \
-  TARGET_SWITCH_SH2 \
-  TARGET_SWITCH_SH2A_SINGLE_ONLY \
-  TARGET_SWITCH_SH2A_SINGLE \
-  TARGET_SWITCH_SH2A_NOFPU \
-  TARGET_SWITCH_SH2A \
-  TARGET_SWITCH_SH2E \
-  TARGET_SWITCH_SH3 \
-  TARGET_SWITCH_SH3E \
-  TARGET_SWITCH_SH4_SINGLE_ONLY \
-  TARGET_SWITCH_SH4_SINGLE \
-  TARGET_SWITCH_SH4_NOFPU \
-  TARGET_SWITCH_SH4 \
-  TARGET_SWITCH_SH4A_SINGLE_ONLY \
-  TARGET_SWITCH_SH4A_SINGLE \
-  TARGET_SWITCH_SH4A_NOFPU \
-  TARGET_SWITCH_SH4A \
-  TARGET_SWITCH_SH4AL \
-  TARGET_SWITCH_SH5_64MEDIA \
-  TARGET_SWITCH_SH5_64MEDIA_NOFPU \
-  TARGET_SWITCHES_SH5_32MEDIA \
-  TARGET_SWITCHES_SH5_32MEDIA_NOFPU \
-  {"b",		-LITTLE_ENDIAN_BIT, "Generate code in big endian mode" }, \
-  {"bigtable", 	BIGTABLE_BIT, "Generate 32-bit offsets in switch tables" }, \
-  {"dalign",  	DALIGN_BIT, "Aligns doubles at 64-bit boundaries" },	\
-  {"fmovd",  	FMOVD_BIT, "" },					\
-  {"hitachi",	HITACHI_BIT, "Follow Renesas (formerly Hitachi) / SuperH calling conventions" }, \
-  {"renesas",	HITACHI_BIT, "Follow Renesas (formerly Hitachi) / SuperH calling conventions" }, \
-  {"no-renesas",-HITACHI_BIT,"Follow the GCC calling conventions" },	\
-  {"nomacsave", NOMACSAVE_BIT, "Mark MAC register as call-clobbered" },	\
-  {"ieee",  	IEEE_BIT, "Increase the IEEE compliance for floating-point code" }, \
-  {"isize", 	ISIZE_BIT, "Annotate assembler instructions with estimated addresses" }, \
-  {"l",		LITTLE_ENDIAN_BIT, "Generate code in little endian mode" }, \
-  {"no-ieee",  	-IEEE_BIT, "Opposite of -mieee" },			\
-  {"padstruct", PADSTRUCT_BIT, "Make structs a multiple of 4 bytes (warning: ABI altered)" }, \
-  {"prefergot",	PREFERGOT_BIT, "Emit function-calls using global offset table when generating PIC" }, \
-  {"relax",	RELAX_BIT, "Shorten address references during linking" }, \
-  {"space", 	SPACE_BIT, "Deprecated. Use -Os instead" },		\
-  {"usermode",	USERMODE_BIT, "Generate library function call to invalidate instruction cache entries after fixing trampoline" }, \
-  TARGET_SWITCH_SH5_32_ANY_EXTRA \
-  TARGET_SWITCH_SH5_MEDIA_ANY_EXTRA \
-  SUBTARGET_SWITCHES                            			\
-  {"",   	TARGET_DEFAULT, "" }					\
-}
-
-/* This are meant to be redefined in the host dependent files */
-#define SUBTARGET_SWITCHES
+#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
+		   | MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
+		   | MASK_HARD_SH4 | MASK_FPU_SINGLE | MASK_SH5)
 
 /* This defaults us to big-endian.  */
 #ifndef TARGET_ENDIAN_DEFAULT
@@ -647,7 +328,7 @@ #define TARGET_ENDIAN_DEFAULT 0
 #endif
 
 #ifndef TARGET_OPT_DEFAULT
-#define TARGET_OPT_DEFAULT  ADJUST_UNROLL_BIT
+#define TARGET_OPT_DEFAULT  MASK_ADJUST_UNROLL
 #endif
 
 #define TARGET_DEFAULT \
@@ -705,7 +386,7 @@ #define EXTRA_SPECS						\
   { "subtarget_asm_spec", SUBTARGET_ASM_SPEC },			\
   SUBTARGET_EXTRA_SPECS
 
-#if TARGET_CPU_DEFAULT & HARD_SH4_BIT
+#if TARGET_CPU_DEFAULT & MASK_HARD_SH4
 #define SUBTARGET_ASM_RELAX_SPEC "%{!m1:%{!m2:%{!m3*:%{!m5*:-isa=sh4}}}}"
 #else
 #define SUBTARGET_ASM_RELAX_SPEC "%{m4*:-isa=sh4}"
@@ -726,7 +407,7 @@ #define SH_ASM_SPEC \
 #define ASM_SPEC SH_ASM_SPEC
 
 #ifndef SUBTARGET_ASM_ENDIAN_SPEC
-#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
 #define SUBTARGET_ASM_ENDIAN_SPEC "%{mb:-big} %{!mb:-little}"
 #else
 #define SUBTARGET_ASM_ENDIAN_SPEC "%{ml:-little} %{!ml:-big}"
@@ -736,7 +417,7 @@ #define SUBTARGET_ASM_ENDIAN_SPEC "%{ml:
 #if STRICT_NOFPU == 1
 /* Strict nofpu means that the compiler should tell the assembler
    to reject FPU instructions. E.g. from ASM inserts.  */
-#if TARGET_CPU_DEFAULT & HARD_SH4_BIT && !(TARGET_CPU_DEFAULT & SH_E_BIT)
+#if TARGET_CPU_DEFAULT & MASK_HARD_SH4 && !(TARGET_CPU_DEFAULT & MASK_SH_E)
 #define SUBTARGET_ASM_ISA_SPEC "%{!m1:%{!m2:%{!m3*:%{m4-nofpu|!m4*:%{!m5:-isa=sh4-nofpu}}}}}"
 #else
 /* If there were an -isa option for sh5-nofpu then it would also go here. */
@@ -751,30 +432,30 @@ #define SUBTARGET_ASM_ISA_SPEC ASM_ISA_D
 #define SUBTARGET_ASM_SPEC ""
 #endif
 
-#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
 #define LINK_EMUL_PREFIX "sh%{!mb:l}"
 #else
 #define LINK_EMUL_PREFIX "sh%{ml:l}"
 #endif
 
-#if TARGET_CPU_DEFAULT & SH5_BIT
-#if TARGET_CPU_DEFAULT & SH_E_BIT
+#if TARGET_CPU_DEFAULT & MASK_SH5
+#if TARGET_CPU_DEFAULT & MASK_SH_E
 #define LINK_DEFAULT_CPU_EMUL "32"
-#if TARGET_CPU_DEFAULT & SH1_BIT
+#if TARGET_CPU_DEFAULT & MASK_SH1
 #define ASM_ISA_SPEC_DEFAULT "--isa=SHcompact"
 #else
 #define ASM_ISA_SPEC_DEFAULT "--isa=SHmedia --abi=32"
-#endif /* SH1_BIT */
-#else /* !SH_E_BIT */
+#endif /* MASK_SH1 */
+#else /* !MASK_SH_E */
 #define LINK_DEFAULT_CPU_EMUL "64"
 #define ASM_ISA_SPEC_DEFAULT "--isa=SHmedia --abi=64"
-#endif /* SH_E_BIT */
+#endif /* MASK_SH_E */
 #define ASM_ISA_DEFAULT_SPEC \
 " %{!m1:%{!m2*:%{!m3*:%{!m4*:%{!m5*:" ASM_ISA_SPEC_DEFAULT "}}}}}"
-#else /* !SH5_BIT */
+#else /* !MASK_SH5 */
 #define LINK_DEFAULT_CPU_EMUL ""
 #define ASM_ISA_DEFAULT_SPEC ""
-#endif /* SH5_BIT */
+#endif /* MASK_SH5 */
 
 #define SUBTARGET_LINK_EMUL_SUFFIX ""
 #define SUBTARGET_LINK_SPEC ""
@@ -806,7 +487,7 @@ do {									\
     }									\
   if (SIZE)								\
     {									\
-      target_flags |= SPACE_BIT;					\
+      target_flags |= MASK_SMALLCODE;					\
       sh_div_str = SH_DIV_STR_FOR_SIZE ;				\
     }									\
   /* We can't meaningfully test TARGET_SHMEDIA here, because -m options	\
@@ -817,7 +498,7 @@ do {									\
     {									\
       flag_branch_target_load_optimize = 1;				\
       if (! (SIZE))							\
-	target_flags |= SAVE_ALL_TR_BIT;				\
+	target_flags |= MASK_SAVE_ALL_TARGET_REGS;			\
     }									\
   /* Likewise, we can't meaningfully test TARGET_SH2E / TARGET_IEEE	\
      here, so leave it to OVERRIDE_OPTIONS to set			\
@@ -857,7 +538,7 @@ do {									\
     flag_finite_math_only						\
       = !flag_signaling_nans && TARGET_SH2E && ! TARGET_IEEE;		\
   if (TARGET_SH2E && !flag_finite_math_only)				\
-    target_flags |= IEEE_BIT;						\
+    target_flags |= MASK_IEEE;						\
   sh_cpu = CPU_SH1;							\
   assembler_dialect = 0;						\
   if (TARGET_SH2)							\
@@ -868,7 +549,7 @@ do {									\
     {									\
       sh_cpu = CPU_SH2A;						\
       if (TARGET_SH2A_DOUBLE)						\
-        target_flags |= FMOVD_BIT;					\
+        target_flags |= MASK_FMOVD;					\
     }									\
   if (TARGET_SH3)							\
     sh_cpu = CPU_SH3;							\
@@ -887,15 +568,15 @@ do {									\
   if (TARGET_SH5)							\
     {									\
       sh_cpu = CPU_SH5;							\
-      target_flags |= DALIGN_BIT;					\
+      target_flags |= MASK_ALIGN_DOUBLE;				\
       if (TARGET_SHMEDIA_FPU)						\
-	target_flags |= FMOVD_BIT;					\
+	target_flags |= MASK_FMOVD;					\
       if (TARGET_SHMEDIA)						\
 	{								\
 	  /* There are no delay slots on SHmedia.  */			\
 	  flag_delayed_branch = 0;					\
 	  /* Relaxation isn't yet supported for SHmedia */		\
-	  target_flags &= ~RELAX_BIT;					\
+	  target_flags &= ~MASK_RELAX;					\
 	  /* After reload, if conversion does little good but can cause \
 	     ICEs:							\
 	     - find_if_block doesn't do anything for SH because we don't\
Index: config/sh/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/elf.h,v
retrieving revision 1.38
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.38 elf.h
--- config/sh/elf.h	9 May 2005 17:42:33 -0000	1.38
+++ config/sh/elf.h	15 May 2005 21:49:01 -0000
@@ -61,7 +61,7 @@ #define ASM_SPEC SH_ASM_SPEC
 #undef LINK_SPEC
 #define LINK_SPEC SH_LINK_SPEC
 #undef LINK_EMUL_PREFIX
-#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
 #define LINK_EMUL_PREFIX "sh%{!mb:l}elf"
 #else
 #define LINK_EMUL_PREFIX "sh%{ml:l}elf"
Index: config/sh/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/linux.h,v
retrieving revision 1.29
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.29 linux.h
--- config/sh/linux.h	9 May 2005 17:42:34 -0000	1.29
+++ config/sh/linux.h	15 May 2005 21:49:01 -0000
@@ -48,7 +48,7 @@ #define TARGET_OS_CPP_BUILTINS() \
 
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
-  (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT \
+  (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT \
    | TARGET_OPT_DEFAULT)
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
Index: config/sh/little.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/little.h,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 little.h
--- config/sh/little.h	27 Sep 2003 04:48:28 -0000	1.2
+++ config/sh/little.h	15 May 2005 21:49:01 -0000
@@ -19,4 +19,4 @@ along with GCC; see the file COPYING.  I
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#define TARGET_ENDIAN_DEFAULT LITTLE_ENDIAN_BIT
+#define TARGET_ENDIAN_DEFAULT MASK_LITTLE_ENDIAN
Index: config/sh/netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/netbsd-elf.h,v
retrieving revision 1.12
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.12 netbsd-elf.h
--- config/sh/netbsd-elf.h	9 May 2005 17:42:34 -0000	1.12
+++ config/sh/netbsd-elf.h	15 May 2005 21:49:01 -0000
@@ -20,21 +20,21 @@ the Free Software Foundation, 59 Temple 
 Boston, MA 02111-1307, USA.  */
 
 /* Run-time Target Specification.  */
-#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
 #define TARGET_VERSION_ENDIAN "le"
 #else
 #define TARGET_VERSION_ENDIAN ""
 #endif
 
-#if TARGET_CPU_DEFAULT & SH5_BIT
-#if TARGET_CPU_DEFAULT & SH_E_BIT
+#if TARGET_CPU_DEFAULT & MASK_SH5
+#if TARGET_CPU_DEFAULT & MASK_SH_E
 #define TARGET_VERSION_CPU "sh5"
 #else
 #define TARGET_VERSION_CPU "sh64"
-#endif /* SH_E_BIT */
+#endif /* MASK_SH_E */
 #else
 #define TARGET_VERSION_CPU "sh"
-#endif /* SH5_BIT */
+#endif /* MASK_SH5 */
 
 #undef TARGET_VERSION
 #define TARGET_VERSION	fprintf (stderr, " (NetBSD/%s%s ELF)",		\
@@ -80,7 +80,7 @@ #define SUBTARGET_CPP_SPEC NETBSD_CPP_SP
 
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
-  (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+  (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT)
 
 /* Define because we use the label and we do not need them.  */
 #define NO_PROFILE_COUNTERS 1
Index: config/sh/symbian-pre.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/symbian-pre.h,v
retrieving revision 1.3
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 symbian-pre.h
--- config/sh/symbian-pre.h	6 Aug 2004 02:03:25 -0000	1.3
+++ config/sh/symbian-pre.h	15 May 2005 21:49:01 -0000
@@ -25,7 +25,7 @@
 #define SYMBIAN		1
 
 /* Default to using the Renesas ABI.  */
-#define TARGET_ABI_DEFAULT	RENESAS_BIT
+#define TARGET_ABI_DEFAULT	MASK_HITACHI
 
 #define SUBTARGET_CPP_SPEC ""
 
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.326
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.326 sh.c
--- config/sh/sh.c	15 May 2005 02:02:58 -0000	1.326
+++ config/sh/sh.c	15 May 2005 21:49:03 -0000
@@ -198,6 +198,7 @@ int assembler_dialect;
 
 static bool shmedia_space_reserved_for_target_registers;
 
+static bool sh_handle_option (size_t, const char *, int);
 static void split_branches (rtx);
 static int branch_dest (rtx);
 static void force_into (rtx, rtx);
@@ -325,6 +326,11 @@ #define TARGET_ASM_FILE_START sh_file_st
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
+#undef TARGET_DEFAULT_TARGET_FLAGS
+#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
+#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION sh_handle_option
+
 #undef TARGET_INSERT_ATTRIBUTES
 #define TARGET_INSERT_ATTRIBUTES sh_insert_attributes
 
@@ -491,6 +497,112 @@ #define TARGET_ADJUST_UNROLL_MAX sh_adju
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
+/* Implement TARGET_HANDLE_OPTION.  */
+
+static bool
+sh_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED,
+		  int value ATTRIBUTE_UNUSED)
+{
+  switch (code)
+    {
+    case OPT_m1:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH1;
+      return true;
+
+    case OPT_m2:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2;
+      return true;
+
+    case OPT_m2a:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A;
+      return true;
+
+    case OPT_m2a_nofpu:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_NOFPU;
+      return true;
+
+    case OPT_m2a_single:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE;
+      return true;
+
+    case OPT_m2a_single_only:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE_ONLY;
+      return true;
+
+    case OPT_m2e:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH2E;
+      return true;
+
+    case OPT_m3:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH3;
+      return true;
+
+    case OPT_m3e:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH3E;
+      return true;
+
+    case OPT_m4:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4;
+      return true;
+
+    case OPT_m4_nofpu:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_NOFPU;
+      return true;
+
+    case OPT_m4_single:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE;
+      return true;
+
+    case OPT_m4_single_only:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE_ONLY;
+      return true;
+
+    case OPT_m4a:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A;
+      return true;
+
+    case OPT_m4a_nofpu:
+    case OPT_m4al:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_NOFPU;
+      return true;
+
+    case OPT_m4a_single:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE;
+      return true;
+
+    case OPT_m4a_single_only:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE_ONLY;
+      return true;
+
+    case OPT_m5_32media:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA;
+      return true;
+
+    case OPT_m5_32media_nofpu:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA_NOFPU;
+      return true;
+
+    case OPT_m5_64media:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA;
+      return true;
+
+    case OPT_m5_64media_nofpu:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA_NOFPU;
+      return true;
+
+    case OPT_m5_compact:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT;
+      return true;
+
+    case OPT_m5_compact_nofpu:
+      target_flags = (target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT_NOFPU;
+      return true;
+
+    default:
+      return true;
+    }
+}
+
 /* Print the operand address in x to the stream.  */
 
 void
@@ -5236,7 +5348,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
   CLEAR_HARD_REG_SET (*live_regs_mask);
   if ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && TARGET_FMOVD && interrupt_handler
       && regs_ever_live[FPSCR_REG])
-    target_flags &= ~FPU_SINGLE_BIT;
+    target_flags &= MASK_FPU_SINGLE;
   /* If we can save a lot of saves by switching to double mode, do that.  */
   else if ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && TARGET_FMOVD && TARGET_FPU_SINGLE)
     for (count = 0, reg = FIRST_FP_REG; reg <= LAST_FP_REG; reg += 2)
@@ -5245,7 +5357,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
 	      || (interrupt_handler && ! pragma_trapa))
 	  && ++count > 2)
 	{
-	  target_flags &= ~FPU_SINGLE_BIT;
+	  target_flags &= MASK_FPU_SINGLE;
 	  break;
 	}
   /* PR_MEDIA_REG is a general purpose register, thus global_alloc already
@@ -5327,7 +5439,7 @@ calc_live_regs (HARD_REG_SET *live_regs_
 	      else if (XD_REGISTER_P (reg))
 		{
 		  /* Must switch to double mode to access these registers.  */
-		  target_flags &= ~FPU_SINGLE_BIT;
+		  target_flags &= ~MASK_FPU_SINGLE;
 		}
 	    }
 	}
@@ -7403,17 +7515,7 @@ sh_cfun_interrupt_handler_p (void)
 	  != NULL_TREE);
 }
 
-/* ??? target_switches in toplev.c is static, hence we have to duplicate it.  */
-static const struct
-{
-  const char *const name;
-  const int value;
-  const char *const description;
-}
-sh_target_switches[] = TARGET_SWITCHES;
-#define target_switches sh_target_switches
-
-/* Like default_pch_valid_p, but take flag_mask into account.  */
+/* Like default_pch_valid_p, but only check certain target_flags.  */
 const char *
 sh_pch_valid_p (const void *data_p, size_t len)
 {
@@ -7433,9 +7535,6 @@ sh_pch_valid_p (const void *data_p, size
   const char *flag_that_differs = NULL;
   size_t i;
   int old_flags;
-  int flag_mask
-    = (SH1_BIT | SH2_BIT | SH3_BIT | SH_E_BIT | HARD_SH4_BIT | FPU_SINGLE_BIT
-       | SH4_BIT | HITACHI_BIT | LITTLE_ENDIAN_BIT);
 
   /* -fpic and -fpie also usually make a PCH invalid.  */
   if (data[0] != flag_pic)
@@ -7446,24 +7545,15 @@ sh_pch_valid_p (const void *data_p, size
 
   /* Check target_flags.  */
   memcpy (&old_flags, data, sizeof (target_flags));
-  if (((old_flags ^ target_flags) & flag_mask) != 0)
-    {
-      for (i = 0; i < ARRAY_SIZE (target_switches); i++)
-	{
-	  int bits;
+  if ((old_flags ^ target_flags) & (MASK_SH1 | MASK_SH2 | MASK_SH3
+				    | MASK_SH_E | MASK_HARD_SH4
+				    | MASK_FPU_SINGLE | MASK_SH4))
+    return _("created and used with different architectures");
+  if ((old_flags ^ target_flags) & MASK_HITACHI)
+    return _("created and used with different ABIs");
+  if ((old_flags ^ target_flags) & MASK_LITTLE_ENDIAN)
+    return _("created and used with different endianness");
 
-	  bits = target_switches[i].value;
-	  if (bits < 0)
-	    bits = -bits;
-	  bits &= flag_mask;
-	  if ((target_flags & bits) != (old_flags & bits))
-	    {
-	      flag_that_differs = target_switches[i].name;
-	      goto make_message;
-	    }
-	}
-      gcc_unreachable ();
-    }
   data += sizeof (target_flags);
   len -= sizeof (target_flags);
 
@@ -10649,7 +10739,7 @@ sh_init_cumulative_args (CUMULATIVE_ARGS
 	     the TYPE or the FNDECL available so we synthesize the
 	     contents of that function as best we can.  */
 	  pcum->force_mem =
-	    (TARGET_DEFAULT & HITACHI_BIT)
+	    (TARGET_DEFAULT & MASK_HITACHI)
 	    && (mode == BLKmode
 		|| (GET_MODE_SIZE (mode) > 4
 		    && !(mode == DFmode
Index: config/sh/superh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/superh.h,v
retrieving revision 1.3
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 superh.h
--- config/sh/superh.h	10 May 2005 14:42:17 -0000	1.3
+++ config/sh/superh.h	15 May 2005 21:49:03 -0000
@@ -1,151 +0,0 @@
-/* Definitions of target machine for gcc for Super-H using sh-superh-elf.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC 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.
-
-GNU CC 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 GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-
-/* This header file is used when the vendor name is set to 'superh'.
-   It configures the compiler for SH4 only and switches the default
-   endianess to little (although big endian is still available).
-   It also configures the spec file to the default board configuration
-   but in such a way that it can be overridden by a boardspecs file
-   (using the -specs= option). This file is expected to disable the
-   defaults and provide options --defsym _start and --defsym _stack
-   which are required by the SuperH configuration of GNU ld.
-
-   This file is intended to overide sh.h */
-
-
-#ifndef _SUPERH_H
-#define _SUPERH_H
-#endif
-
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (SuperH SH special %s)", __DATE__);
-
-
-/* We override TARGET_PROCESSOR_SWITCHES in order to remove all the unrequired cpu options
-   and add options for all the SuperH CPU variants:
-   -m4-100  is an alias for -m4.
-   -m4-200  is an alias for -m4.
-   -m4-400  is an alias for -m4-nofpu and passes -isa=sh4-nommu-nofpu to the assembler.
-   -m4-500  is an alias for -m4-nofpu and passes -isa=sh4-nofpu to the assembler.  */
-#undef TARGET_PROCESSOR_SWITCHES
-#define TARGET_PROCESSOR_SWITCHES \
-  {"4-500",	TARGET_NONE, "SH4 500 series (FPU-less)" }, \
-  {"4-500",	SELECT_SH4_NOFPU, "" }, \
-  {"4-400",	TARGET_NONE, "SH4 400 series (MMU/FPU-less)" },	\
-  {"4-400",	SELECT_SH4_NOFPU, "" }, \
-  {"4-200-single-only",	TARGET_NONE, "SH4 200 series with double = float (SH3e ABI)" },	\
-  {"4-200-single-only",	SELECT_SH4_SINGLE_ONLY, "" }, \
-  {"4-200-single",	TARGET_NONE, "SH4 200 series with single precision pervading" }, \
-  {"4-200-single",	SELECT_SH4_SINGLE, "" }, \
-  {"4-200-nofpu",	TARGET_NONE, "SH4 200 series using soft floating point" }, \
-  {"4-200-nofpu",	SELECT_SH4_NOFPU, "" }, \
-  {"4-200",	TARGET_NONE, "SH4 200 series" }, \
-  {"4-200",	SELECT_SH4_NOFPU, "" }, \
-  {"4-100-single-only",	TARGET_NONE, "SH4 100 series with double = float (SH3e ABI)" },	\
-  {"4-100-single-only",	SELECT_SH4_SINGLE_ONLY, "" }, \
-  {"4-100-single",	TARGET_NONE, "SH4 100 series with single precision pervading" }, \
-  {"4-100-single",	SELECT_SH4_SINGLE, "" }, \
-  {"4-100-nofpu",	TARGET_NONE, "SH4 100 series using soft floating point" }, \
-  {"4-100-nofpu",	SELECT_SH4_NOFPU, "" }, \
-  {"4-100",	TARGET_NONE, "SH4 100 series" }, \
-  {"4-100",	SELECT_SH4_NOFPU, "" }, \
-  {"4-single-only",	TARGET_NONE, "Generic SH4 with double = float (SH3e ABI)" }, \
-  {"4-single-only",	SELECT_SH4_SINGLE_ONLY, "" }, \
-  {"4-single",	TARGET_NONE, "Generic SH4 with single precision pervading" }, \
-  {"4-single",	SELECT_SH4_SINGLE, "" }, \
-  {"4-nofpu",	TARGET_NONE, "Generic SH4 using soft floating point" },	\
-  {"4-nofpu",	SELECT_SH4_NOFPU, "" }, \
-  {"4",	        TARGET_NONE, "Generic SH4 (default)" },	\
-  {"4",	        SELECT_SH4, "" }
-
-
-/* Provide the -mboard= option used by the boardspecs file */
-#undef SUBTARGET_OPTIONS
-#define SUBTARGET_OPTIONS \
-  { "board=",   &boardtype, "Board name [and momory region].", 0 }, \
-  { "runtime=", &osruntime, "Runtime name.", 0 }, \
-
-/* These are required by the mboard= option and runtime= option
-   and are defined in sh.c but are not used anywhere */
-extern const char * boardtype;
-extern const char * osruntime;
-
-
-/* Override the linker spec strings to use the new emulation
-   The specstrings are concatenated as follows
-   LINK_EMUL_PREFIX.(''|'32'|'64'|LINK_DEFAULT_CPU_EMUL).SUBTARGET_LINK_EMUL_SUFFIX
-*/
-#undef LINK_EMUL_PREFIX
-#undef SUBTARGET_LINK_EMUL_SUFFIX
-
-#define LINK_EMUL_PREFIX "superh"
-#define SUBTARGET_LINK_EMUL_SUFFIX ""
-
-/* Add the SUBTARGET_LINK_SPEC to add the board and runtime support and
-   change the endianness */
-#undef SUBTARGET_LINK_SPEC
-#if  TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
-#define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml|!mb:-EL}%{mb:-EB}"
-#else
-#define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml:-EL}%{mb|!ml:-EB}"
-#endif
-
-
-/* This is used by the link spec if the boardspecs file is not used (for whatever reason).
-   If the boardspecs file overrides this then an alternative can be used. */
-#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
-{ "board_link", "--defsym _start=0x1000 --defsym _stack=0x30000" }, \
-{ "asruntime", "" }, \
-{ "cppruntime", "-D__GDB_SIM__" }, \
-{ "cc1runtime", "" }, \
-{ "ldruntime", "" }, \
-{ "libruntime", "-lc -lgloss" }
-
-
-/* Set the SUBTARGET_CPP_SPEC to define __EMBEDDED_CROSS__ which has an effect
-   on newlib and provide the runtime support */
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC \
-"-D__EMBEDDED_CROSS__ %{m4-100*:-D__SH4_100__} %{m4-200*:-D__SH4_200__} %{m4-400:-D__SH4_400__} %{m4-500:-D__SH4_500__} \
-%(cppruntime)"
-
-/* Override the SUBTARGET_ASM_SPEC to add the runtime support */
-#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "%{m4-100*|m4-200*:-isa=sh4} %{m4-400:-isa=sh4-nommu-nofpu} %{m4-500:-isa=sh4-nofpu} %(asruntime)"
-
-/* Override the SUBTARGET_ASM_RELAX_SPEC so it doesn't interfere with the
-   runtime support by adding -isa=sh4 in the wrong place.  */
-#undef SUBTARGET_ASM_RELAX_SPEC
-#define SUBTARGET_ASM_RELAX_SPEC "%{!m4-100*:%{!m4-200*:%{!m4-400:%{!m4-500:-isa=sh4}}}}"
-
-/* Create the CC1_SPEC to add the runtime support */
-#undef CC1_SPEC
-#define CC1_SPEC "%(cc1runtime)"
-
-#undef CC1PLUS_SPEC
-#define CC1PLUS_SPEC "%(cc1runtime)"
-
-
-/* Override the LIB_SPEC to add the runtime support */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{!symbolic:%(libruntime) -lc}} %{pg:-lprofile -lc}"
Index: config/sh/superh64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/superh64.h,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 superh64.h
--- config/sh/superh64.h	9 May 2005 17:42:40 -0000	1.2
+++ config/sh/superh64.h	15 May 2005 21:49:03 -0000
@@ -1,50 +0,0 @@
-/* 
- Definitions of target machine for gcc for SuperH using target sh-superh-elf,
- 
-   Copyright 2000 Free Software Foundation, Inc.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>
-   Modified for SuperH by Richard Shann
-
-This file is part of GNU CC.
-
-GNU CC 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.
-
-GNU CC 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 GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* This header file is used when the vendor name is set to 'superh'.
-   It configures the compiler for SH5 only and switches the default
-   endianess to little.
-   This file is intended to overide sh.h, superh.h and sh64.h (which
-   should have been included in that order) */
-
-
-#ifndef _SUPERH_H
- #error superh64.h should not be used without superh.h
-#endif
-
-/* We override TARGET_PROCESSOR_SWITCHES in order to remove all the unrequired cpu options */
-#undef TARGET_PROCESSOR_SWITCHES
-#define TARGET_PROCESSOR_SWITCHES  			\
-  {"5-64media",	TARGET_NONE, "" },		\
-  {"5-64media", SELECT_SH5_64, "SH5 64-bit SHmedia code" }, \
-  {"5-64media-nofpu", TARGET_NONE, "" },	\
-  {"5-64media-nofpu", SELECT_SH5_64_NOFPU, "SH5 64-bit FPU-less SHmedia code" }, \
-  {"5-32media",	TARGET_NONE, "" },		\
-  {"5-32media", SELECT_SH5_32, "SH5 32-bit SHmedia code" }, \
-  {"5-32media-nofpu", TARGET_NONE, "" },	\
-  {"5-32media-nofpu", SELECT_SH5_32_NOFPU, "SH5 32-bit FPU-less SHmedia code" }, \
-  {"5-compact",	TARGET_NONE, "" },		\
-  {"5-compact",	SELECT_SH5_COMPACT, "SH5 SHcompact code" }, \
-  {"5-compact-nofpu", TARGET_NONE, "" },	\
-  {"5-compact-nofpu", SELECT_SH5_COMPACT_NOFPU, "SH5 FPU-less SHcompact code" }
diff -u /dev/null config/sh/sh.opt
--- /dev/null	2005-03-29 10:04:47.000000000 +0100
+++ config/sh/sh.opt	2005-05-15 22:38:50.765320262 +0100
@@ -0,0 +1,214 @@
+; Options for the SH port of the compiler.
+
+; Copyright (C) 2005 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.
+
+;; Used for various architecture options.
+Mask(SH_E)
+
+;; Set if the default precision of th FPU is single.
+Mask(FPU_SINGLE)
+
+;; Set if we should generate code using type 2A insns.
+Mask(HARD_SH2A)
+
+;; Set if we should generate code using type 2A DF insns.
+Mask(HARD_SH2A_DOUBLE)
+
+;; Set if compiling for SH4 hardware (to be used for insn costs etc.)
+Mask(HARD_SH4)
+
+;; Set if we should generate code for a SH5 CPU (either ISA).
+Mask(SH5)
+
+;; Set if we should save all target registers.
+Mask(SAVE_ALL_TARGET_REGS)
+
+m1
+Target RejectNegative Mask(SH1) Condition(SUPPORT_SH1)
+Generate SH1 code
+
+m2
+Target RejectNegative Mask(SH2) Condition(SUPPORT_SH2)
+Generate SH2 code
+
+m2a
+Target RejectNegative Condition(SUPPORT_SH2A)
+Generate SH2a code
+
+m2a-nofpu
+Target RejectNegative Condition(SUPPORT_SH2A_NOFPU)
+Generate SH2a FPU-less code
+
+m2a-single
+Target RejectNegative Condition (SUPPORT_SH2A_SINGLE)
+Generate default single-precision SH2a code
+
+m2a-single-only
+Target RejectNegative Condition (SUPPORT_SH2A_SINGLE_ONLY)
+Generate only single-precision SH2a code
+
+m2e
+Target RejectNegative Condition(SUPPORT_SH2E)
+Generate SH2e code
+
+m3
+Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
+Generate SH3 code
+
+m3e
+Target RejectNegative Condition(SUPPORT_SH3E)
+Generate SH3e code
+
+m4
+Target RejectNegative Mask(SH4) Condition(SUPPORT_SH4)
+Generate SH4 code
+
+m4-nofpu
+Target RejectNegative Condition(SUPPORT_SH4_NOFPU)
+Generate SH4 FPU-less code
+
+m4-single
+Target RejectNegative Condition(SUPPORT_SH4_SINGLE)
+Generate default single-precision SH4 code
+
+m4-single-only
+Target RejectNegative Condition(SUPPORT_SH4_SINGLE_ONLY)
+Generate only single-precision SH4 code
+
+m4a
+Target RejectNegative Mask(SH4A) Condition(SUPPORT_SH4A)
+Generate SH4a code
+
+m4a-nofpu
+Target RejectNegative Condition(SUPPORT_SH4A_NOFPU)
+Generate SH4a FPU-less code
+
+m4a-single
+Target RejectNegative Condition(SUPPORT_SH4A_SINGLE)
+Generate default single-precision SH4a code
+
+m4a-single-only
+Target RejectNegative Condition(SUPPORT_SH4A_SINGLE_ONLY)
+Generate only single-precision SH4a code
+
+m4al
+Target RejectNegative Condition(SUPPORT_SH4AL)
+Generate SH4al-dsp code
+
+m5-32media
+Target RejectNegative Condition(SUPPORT_SH5_32MEDIA)
+Generate 32-bit SHmedia code
+
+m5-32media-nofpu
+Target RejectNegative Condition(SUPPORT_SH5_32MEDIA_NOFPU)
+Generate 32-bit FPU-less SHmedia code
+
+m5-64media
+Target RejectNegative Condition(SUPPORT_SH5_64MEDIA)
+Generate 64-bit SHmedia code
+
+m5-64media-nofpu
+Target RejectNegative Condition(SUPPORT_SH5_64MEDIA_NOFPU)
+Generate 64-bit FPU-less SHmedia code
+
+m5-compact
+Target RejectNegative Condition(SUPPORT_SH5_32MEDIA)
+Generate SHcompact code
+
+m5-compact-nofpu
+Target RejectNegative Condition(SUPPORT_SH5_32MEDIA_NOFPU)
+Generate FPU-less SHcompact code
+
+madjust-unroll
+Target Report Mask(ADJUST_UNROLL) Condition(SUPPORT_ANY_SH5)
+Throttle unrolling to avoid thrashing target registers unless the unroll benefit outweighs this
+
+mb
+Target Report RejectNegative InverseMask(LITTLE_ENDIAN)
+Generate code in big endian mode
+
+mbigtable
+Target Report RejectNegative Mask(BIGTABLE)
+Generate 32-bit offsets in switch tables
+
+mdalign
+Target Report RejectNegative Mask(ALIGN_DOUBLE)
+Align doubles at 64-bit boundaries
+
+mfmovd
+Target RejectNegative Mask(FMOVD) Undocumented
+
+mhitachi
+Target Report RejectNegative Mask(HITACHI)
+Follow Renesas (formerly Hitachi) / SuperH calling conventions
+
+mieee
+Target Report Mask(IEEE)
+Increase the IEEE compliance for floating-point code
+
+mindexed-addressing
+Target Report Mask(ALLOW_INDEXED_ADDRESS) Condition(SUPPORT_ANY_SH5_32MEDIA)
+Enable the use of the indexed addressing mode for SHmedia32/SHcompact
+
+minvalid-symbols
+Target Report Mask(INVALID_SYMBOLS) Condition(SUPPORT_ANY_SH5)
+Assume symbols might be invalid
+
+misize
+Target Report RejectNegative Mask(DUMPISIZE)
+Annotate assembler instructions with estimated addresses
+
+ml
+Target Report RejectNegative Mask(LITTLE_ENDIAN)
+Generate code in little endian mode
+
+mnomacsave
+Target Report RejectNegative Mask(NOMACSAVE)
+Mark MAC register as call-clobbered
+
+;; ??? This option is not useful, but is retained in case there are people
+;; who are still relying on it.  It may be deleted in the future.  */
+mpadstruct
+Target Report RejectNegative Mask(PADSTRUCT)
+Make structs a multiple of 4 bytes (warning: ABI altered)
+
+mprefergot
+Target Report RejectNegative Mask(PREFERGOT)
+Emit function-calls using global offset table when generating PIC
+
+mpt-fixed
+Target Report Mask(PT_FIXED) Condition(SUPPORT_ANY_SH5)
+Assume pt* instructions won't trap
+
+mrelax
+Target Report RejectNegative Mask(RELAX)
+Shorten address references during linking
+
+mrenesas
+Target Mask(HITACHI) MaskExists
+Follow Renesas (formerly Hitachi) / SuperH calling conventions
+
+mspace
+Target Report RejectNegative Mask(SMALLCODE)
+Deprecated. Use -Os instead
+
+musermode
+Target Report RejectNegative Mask(USERMODE)
+Generate library function call to invalidate instruction cache entries after fixing trampoline


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