Move -mips16/-mno-mips16 to TARGET_SWITCHES

Richard Sandiford rsandifo@redhat.com
Sun Aug 10 07:23:00 GMT 2003


This just moves -mips16 to TARGET_SWITCHES, simplifying the -mipsN
handling a bit.

Tested on mips-sgi-irix6o32 & mipsisa64-elf.  Also tried a few
command-line options by hand.  OK to install?

Richard


	* config/mips/mips.c (mips_no_mips16_string): Remove.
	(override_options): Don't handle -mips16 as part of -mipsN.
	* config/mips/mips.h (mips_no_mips16_string): Remove declaration.
	(TARGET_SWITCHES): Add -mips16 and -mno-mips16 entries.
	(TARGET_OPTIONS): Remove -mno-mips16.

diff -cpdr config/mips.1/mips.c config/mips/mips.c
*** config/mips.1/mips.c	Sun Aug 10 07:42:53 2003
--- config/mips/mips.c	Sun Aug 10 07:44:27 2003
*************** const char *mips_tune_string;   /* for -
*** 503,513 ****
  const char *mips_isa_string;	/* for -mips{1,2,3,4} */
  const char *mips_abi_string;	/* for -mabi={32,n32,64,eabi} */
  
- /* This variable is set by -mno-mips16.  We only care whether
-    -mno-mips16 appears or not, and using a string in this fashion is
-    just a way to avoid using up another bit in target_flags.  */
- const char *mips_no_mips16_string;
- 
  /* Whether we are generating mips16 hard float code.  In mips16 mode
     we always set TARGET_SOFT_FLOAT; this variable is nonzero if
     -msoft-float was not specified by the user, which means that we
--- 503,508 ----
*************** override_options ()
*** 4701,4732 ****
    if (mips_isa_string != 0)
      {
        /* Handle -mipsN.  */
  
!       if (strcmp (mips_isa_string, "16") == 0)
! 	{
! 	  /* -mips16 specifies an ASE rather than a processor, so don't
! 	     change mips_arch here.  -mno-mips16 overrides -mips16.  */
! 	  if (mips_no_mips16_string == NULL)
! 	    target_flags |= MASK_MIPS16;
! 	}
!       else
! 	{
! 	  char *whole_isa_str = concat ("mips", mips_isa_string, NULL);
! 	  const struct mips_cpu_info *isa_info;
! 
! 	  isa_info = mips_parse_cpu ("-mips option", whole_isa_str);
! 	  free (whole_isa_str);
  
! 	  /* -march takes precedence over -mipsN, since it is more descriptive.
! 	     There's no harm in specifying both as long as the ISA levels
! 	     are the same.  */
! 	  if (mips_arch_info != 0 && mips_isa != isa_info->isa)
! 	    error ("-mips%s conflicts with the other architecture options, which specify a MIPS%d processor",
! 		   mips_isa_string, mips_isa);
  
! 	  /* Set architecture based on the given option.  */
! 	  mips_set_architecture (isa_info);
! 	}
      }
  
    if (mips_arch_info == 0)
--- 4696,4717 ----
    if (mips_isa_string != 0)
      {
        /* Handle -mipsN.  */
+       char *whole_isa_str = concat ("mips", mips_isa_string, NULL);
+       const struct mips_cpu_info *isa_info;
  
!       isa_info = mips_parse_cpu ("-mips option", whole_isa_str);
!       free (whole_isa_str);
  
!       /* -march takes precedence over -mipsN, since it is more descriptive.
! 	 There's no harm in specifying both as long as the ISA levels
! 	 are the same.  */
!       if (mips_arch_info != 0 && mips_isa != isa_info->isa)
! 	error ("-mips%s conflicts with the other architecture options, "
! 	       "which specify a MIPS%d processor",
! 	       mips_isa_string, mips_isa);
  
!       /* Set architecture based on the given option.  */
!       mips_set_architecture (isa_info);
      }
  
    if (mips_arch_info == 0)
diff -cpdr config/mips.1/mips.h config/mips/mips.h
*** config/mips.1/mips.h	Sun Aug 10 07:41:48 2003
--- config/mips/mips.h	Sun Aug 10 07:44:27 2003
*************** extern const char *mips_tune_string;    
*** 121,127 ****
  extern const char *mips_isa_string;	/* for -mips{1,2,3,4} */
  extern const char *mips_abi_string;	/* for -mabi={32,n32,64} */
  extern const char *mips_entry_string;	/* for -mentry */
- extern const char *mips_no_mips16_string;/* for -mno-mips16 */
  extern const char *mips_cache_flush_func;/* for -mflush-func= and -mno-flush-func */
  extern int mips_string_length;		/* length of strings for mips16 */
  extern const struct mips_cpu_info mips_cpu_info_table[];
--- 121,126 ----
*************** extern const struct mips_cpu_info *mips_
*** 592,597 ****
--- 591,600 ----
       N_("Use NewABI-style %reloc() assembly operators")},		\
    {"no-explicit-relocs", -MASK_EXPLICIT_RELOCS,				\
       N_("Use assembler macros instead of relocation operators")},	\
+   {"ips16",		  MASK_MIPS16,					\
+      N_("Generate mips16 code") },					\
+   {"no-mips16",		 -MASK_MIPS16,					\
+      N_("Generate normal-mode code") },					\
    {"debug",		  MASK_DEBUG,					\
       NULL},								\
    {"debuga",		  MASK_DEBUG_A,					\
*************** extern const struct mips_cpu_info *mips_
*** 718,725 ****
        N_("Specify a Standard MIPS ISA"), 0},				\
    { "entry",	&mips_entry_string,					\
        N_("Use mips16 entry/exit psuedo ops"), 0},			\
-   { "no-mips16", &mips_no_mips16_string,				\
-       N_("Don't use MIPS16 instructions"), 0},				\
    { "no-flush-func", &mips_cache_flush_func,				\
        N_("Don't call any cache flush functions"), 0},			\
    { "flush-func=", &mips_cache_flush_func,				\
--- 721,726 ----



More information about the Gcc-patches mailing list