score.c (score_handle_option): Don't assert that global structures are in use.
authorJoseph Myers <joseph@codesourcery.com>
Tue, 22 Mar 2011 22:50:03 +0000 (22:50 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Tue, 22 Mar 2011 22:50:03 +0000 (22:50 +0000)
* config/score/score.c (score_handle_option): Don't assert that
global structures are in use.  Access target_flags via opts
pointer.  Use value of -march= option to determine target_flags
settings.
* config/score/score.opt (march=): Use Enum.
(score_arch): New Enum and EnumValue entries.

From-SVN: r171329

gcc/ChangeLog
gcc/config/score/score.c
gcc/config/score/score.opt

index 522d016cbe4b1891b39cb76b6711c4d9deda6b54..9e28d5d0af2420965c537db7ee9f5ee287100e0f 100644 (file)
@@ -1,3 +1,12 @@
+2011-03-22  Joseph Myers  <joseph@codesourcery.com>
+
+       * config/score/score.c (score_handle_option): Don't assert that
+       global structures are in use.  Access target_flags via opts
+       pointer.  Use value of -march= option to determine target_flags
+       settings.
+       * config/score/score.opt (march=): Use Enum.
+       (score_arch): New Enum and EnumValue entries.
+
 2011-03-22  Joseph Myers  <joseph@codesourcery.com>
 
        * config/mep/mep.c (option_mtiny_specified): Remove.
index ddb04cb1451df66d0b9259acbb3da03496a56d56..1c745f061937a96ff5d429c8ca8dc79f900e68ee 100644 (file)
@@ -283,38 +283,25 @@ score_asm_file_end (void)
 
 /* Implement TARGET_HANDLE_OPTION.  */
 static bool
-score_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+score_handle_option (struct gcc_options *opts,
+                    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
                     const struct cl_decoded_option *decoded,
                     location_t loc ATTRIBUTE_UNUSED)
 {
   size_t code = decoded->opt_index;
-  const char *arg = decoded->arg;
-
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set == &global_options_set);
+  int value = decoded->value;
 
   switch (code)
     {
     case OPT_mscore7d:
-      target_flags &= ~(MASK_ALL_CPU_BITS);
-      target_flags |= MASK_SCORE7 | MASK_SCORE7D;
+      opts->x_target_flags &= ~(MASK_ALL_CPU_BITS);
+      opts->x_target_flags |= MASK_SCORE7 | MASK_SCORE7D;
       return true;
 
     case OPT_march_:
-      if (strcmp (arg, "score7") == 0)
-        {
-          target_flags &= ~(MASK_ALL_CPU_BITS);
-          target_flags |= MASK_SCORE7;
-          return true;
-        }
-      else if (strcmp (arg, "score7d") == 0)
-        {
-          target_flags &= ~(MASK_ALL_CPU_BITS);
-          target_flags |= MASK_SCORE7 | MASK_SCORE7D;
-          return true;
-        }
-      else
-        return false;
+      opts->x_target_flags &= ~(MASK_ALL_CPU_BITS);
+      opts->x_target_flags |= value;
+      return true;
 
     default:
       return true;
index dc8cd351e2c24de4145d87da7d56f1712949423b..292607c294a36194ba2badaa7f97d8870ec95a2f 100644 (file)
@@ -1,6 +1,6 @@
 ; Options for the Sunnorth port of the compiler.
 
-; Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2010, 2011 Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
 ;
@@ -43,5 +43,15 @@ Target RejectNegative Report Mask(SCORE7D)
 Support SCORE 7D ISA
 
 march=
-Target RejectNegative Joined
+Target RejectNegative Joined Enum(score_arch)
 Specify the name of the target architecture
+
+Enum
+Name(score_arch) Type(int)
+Known SCORE architectures (for use with the -march= option):
+
+EnumValue
+Enum(score_arch) String(score7) Value(MASK_SCORE7)
+
+EnumValue
+Enum(score_arch) String(score7d) Value(MASK_SCORE7 | MASK_SCORE7D)