From 05b12036e2747d540392008c6b177a6414e2e29d Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 22 Mar 2011 22:50:03 +0000 Subject: [PATCH] score.c (score_handle_option): Don't assert that global structures are in use. * 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 | 9 +++++++++ gcc/config/score/score.c | 29 ++++++++--------------------- gcc/config/score/score.opt | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 522d016cbe4..9e28d5d0af2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-03-22 Joseph Myers + + * 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 * config/mep/mep.c (option_mtiny_specified): Remove. diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index ddb04cb1451..1c745f06193 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -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; diff --git a/gcc/config/score/score.opt b/gcc/config/score/score.opt index dc8cd351e2c..292607c294a 100644 --- a/gcc/config/score/score.opt +++ b/gcc/config/score/score.opt @@ -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) -- 2.30.2