Use Enum for MIPS -march=, -mtune=, -mips options

Submitted by Richard Sandiford on May 22, 2011, 9:23 p.m.


Message ID 87pqna4eft.fsf@firetop.home
State New
Headers show

Commit Message

Richard Sandiford May 22, 2011, 9:23 p.m.
"Joseph S. Myers" <> writes:
> The processing of MIPS_CPU_STRING_DEFAULT is replaced by much simpler
> use of strcmp to find a matching entry; the "from-abi" default
> definition of that macro is replaced by code in mips_default_arch if
> that macro is not defined.  (Previously it would always have been
> defined, so the previous fallback for it being undefined was dead
> code.)

For the record, the fallback really was needed.  The "from-abi" default
came from:

> -/* 'from-abi' makes a good default: you get whatever the ABI requires.  */
> -#define MIPS_CPU_STRING_DEFAULT "from-abi"
> -#endif
> -#endif

so it was only used if both MIPS_CPU_STRING_DEFAULT and
MIPS_ISA_DEFAULT were undefined.  The default was tested here:

> -      mips_set_architecture (mips_parse_cpu (MIPS_CPU_STRING_DEFAULT));
> -#else
> -      mips_set_architecture (mips_cpu_info_from_isa (MIPS_ISA_DEFAULT));
> -#endif

So the patch had the effect of ignoring MIPS_ISA_DEFAULT.  This showed
up on mipsisa64-elf, where crt0.S was assembled as MIPS I rather than

I've applied the fix below.  Tested on mipsisa64-elf and mips-linux-gnu.


	* config/mips/mips.c (mips_default_arch): Honor MIPS_ISA_DEFAULT.

Patch hide | download patch | download mbox

Index: gcc/config/mips/mips.c
--- gcc/config/mips/mips.c	2011-05-22 22:19:08.000000000 +0100
+++ gcc/config/mips/mips.c	2011-05-22 22:20:47.000000000 +0100
@@ -15239,12 +15239,14 @@  mips_cpu_info_from_opt (int opt)
 static const struct mips_cpu_info *
 mips_default_arch (void)
   unsigned int i;
   for (i = 0; i < ARRAY_SIZE (mips_cpu_info_table); i++)
     if (strcmp (mips_cpu_info_table[i].name, MIPS_CPU_STRING_DEFAULT) == 0)
       return mips_cpu_info_table + i;
   gcc_unreachable ();
+#elif defined (MIPS_ISA_DEFAULT)
+  return mips_cpu_info_from_isa (MIPS_ISA_DEFAULT);
   /* 'from-abi' makes a good default: you get whatever the ABI
      requires.  */