OSDN Git Service

* config/bfin/bfin-opts.h: New.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Mar 2011 22:30:46 +0000 (22:30 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Mar 2011 22:30:46 +0000 (22:30 +0000)
* config/bfin/bfin.c (bfin_lib_id_given, bfin_cpu_type,
bfin_si_revision, bfin_workarounds): Remove.
(bfin_cpus): Make static const.
(bfin_load_pic_reg): Check global_options_set.x_bfin_library_id
not bfin_lib_id_given.
(bfin_handle_option): Don't set bfin_lib_id_given.  Access
bfin_cpu_type, bfin_si_revision and bfin_workarounds via opts
pointer. Use error_at.  Don't assert that global structures are in
use.
* config/bfin/bfin.h: Include bfin-opts.h.
(enum bfin_cpu_type, bfin_cpu_t): Move to bfin-opts.h.
(bfin_cpu_type, bfin_si_revision, bfin_workarounds): Remove.
* bfin.opt (config/bfin/bfin-opts.h): New HeaderInclude entry.
(bfin_cpu_type, bfin_si_revision, bfin_workarounds): New Variable
entries.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171314 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/bfin/bfin-opts.h [new file with mode: 0644]
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/bfin/bfin.opt

index 71af1f4..77c48c3 100644 (file)
@@ -1,5 +1,24 @@
 2011-03-22  Joseph Myers  <joseph@codesourcery.com>
 
+       * config/bfin/bfin-opts.h: New.
+       * config/bfin/bfin.c (bfin_lib_id_given, bfin_cpu_type,
+       bfin_si_revision, bfin_workarounds): Remove.
+       (bfin_cpus): Make static const.
+       (bfin_load_pic_reg): Check global_options_set.x_bfin_library_id
+       not bfin_lib_id_given.
+       (bfin_handle_option): Don't set bfin_lib_id_given.  Access
+       bfin_cpu_type, bfin_si_revision and bfin_workarounds via opts
+       pointer. Use error_at.  Don't assert that global structures are in
+       use.
+       * config/bfin/bfin.h: Include bfin-opts.h.
+       (enum bfin_cpu_type, bfin_cpu_t): Move to bfin-opts.h.
+       (bfin_cpu_type, bfin_si_revision, bfin_workarounds): Remove.
+       * bfin.opt (config/bfin/bfin-opts.h): New HeaderInclude entry.
+       (bfin_cpu_type, bfin_si_revision, bfin_workarounds): New Variable
+       entries.
+
+2011-03-22  Joseph Myers  <joseph@codesourcery.com>
+
        * config/arm/arm.opt (mhard-float, msoft-float): Use Alias.
        * config/arm/arm.c (arm_handle_option): Don't handle -mhard-float
        or -msoft-float here.
diff --git a/gcc/config/bfin/bfin-opts.h b/gcc/config/bfin/bfin-opts.h
new file mode 100644 (file)
index 0000000..d0780a6
--- /dev/null
@@ -0,0 +1,59 @@
+/* Definitions for the Blackfin port needed for option handling.
+   Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
+   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 3, 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 COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef BFIN_OPTS_H
+#define BFIN_OPTS_H
+
+/* CPU type.  */
+typedef enum bfin_cpu_type
+{
+  BFIN_CPU_UNKNOWN,
+  BFIN_CPU_BF512,
+  BFIN_CPU_BF514,
+  BFIN_CPU_BF516,
+  BFIN_CPU_BF518,
+  BFIN_CPU_BF522,
+  BFIN_CPU_BF523,
+  BFIN_CPU_BF524,
+  BFIN_CPU_BF525,
+  BFIN_CPU_BF526,
+  BFIN_CPU_BF527,
+  BFIN_CPU_BF531,
+  BFIN_CPU_BF532,
+  BFIN_CPU_BF533,
+  BFIN_CPU_BF534,
+  BFIN_CPU_BF536,
+  BFIN_CPU_BF537,
+  BFIN_CPU_BF538,
+  BFIN_CPU_BF539,
+  BFIN_CPU_BF542,
+  BFIN_CPU_BF542M,
+  BFIN_CPU_BF544,
+  BFIN_CPU_BF544M,
+  BFIN_CPU_BF547,
+  BFIN_CPU_BF547M,
+  BFIN_CPU_BF548,
+  BFIN_CPU_BF548M,
+  BFIN_CPU_BF549,
+  BFIN_CPU_BF549M,
+  BFIN_CPU_BF561
+} bfin_cpu_t;
+
+#endif
index 32f74cd..5d08437 100644 (file)
@@ -86,9 +86,6 @@ const char *byte_reg_names[]   =  BYTE_REGISTER_NAMES;
 static int arg_regs[] = FUNCTION_ARG_REGISTERS;
 static int ret_regs[] = FUNCTION_RETURN_REGISTERS;
 
-/* Nonzero if -mshared-library-id was given.  */
-static int bfin_lib_id_given;
-
 /* Nonzero if -fschedule-insns2 was given.  We override it and
    call the scheduler ourselves during reorg.  */
 static int bfin_flag_schedule_insns2;
@@ -97,17 +94,6 @@ static int bfin_flag_schedule_insns2;
    reorganization.  */
 static int bfin_flag_var_tracking;
 
-/* -mcpu support */
-bfin_cpu_t bfin_cpu_type = BFIN_CPU_UNKNOWN;
-
-/* -msi-revision support. There are three special values:
-   -1      -msi-revision=none.
-   0xffff  -msi-revision=any.  */
-int bfin_si_revision;
-
-/* The workarounds enabled */
-unsigned int bfin_workarounds = 0;
-
 struct bfin_cpu
 {
   const char *name;
@@ -116,7 +102,7 @@ struct bfin_cpu
   unsigned int workarounds;
 };
 
-struct bfin_cpu bfin_cpus[] =
+static const struct bfin_cpu bfin_cpus[] =
 {
   {"bf512", BFIN_CPU_BF512, 0x0000,
    WA_SPECULATIVE_LOADS | WA_05000074},
@@ -1309,7 +1295,7 @@ bfin_load_pic_reg (rtx dest)
   if (i && i->local)
     return pic_offset_table_rtx;
       
-  if (bfin_lib_id_given)
+  if (global_options_set.x_bfin_library_id)
     addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4);
   else
     addr = gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
@@ -2559,24 +2545,21 @@ bfin_class_likely_spilled_p (reg_class_t rclass)
 /* Implement TARGET_HANDLE_OPTION.  */
 
 static bool
-bfin_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+bfin_handle_option (struct gcc_options *opts,
+                   struct gcc_options *opts_set ATTRIBUTE_UNUSED,
                    const struct cl_decoded_option *decoded,
-                   location_t loc ATTRIBUTE_UNUSED)
+                   location_t loc)
 {
   size_t code = decoded->opt_index;
   const char *arg = decoded->arg;
   int value = decoded->value;
 
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set == &global_options_set);
-
   switch (code)
     {
     case OPT_mshared_library_id_:
       if (value > MAX_LIBRARY_ID)
-       error ("-mshared-library-id=%s is not between 0 and %d",
-              arg, MAX_LIBRARY_ID);
-      bfin_lib_id_given = 1;
+       error_at (loc, "-mshared-library-id=%s is not between 0 and %d",
+                 arg, MAX_LIBRARY_ID);
       return true;
 
     case OPT_mcpu_:
@@ -2594,27 +2577,27 @@ bfin_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
 
        if (p == NULL)
          {
-           error ("-mcpu=%s is not valid", arg);
+           error_at (loc, "-mcpu=%s is not valid", arg);
            return false;
          }
 
-       bfin_cpu_type = bfin_cpus[i].type;
+       opts->x_bfin_cpu_type = bfin_cpus[i].type;
 
        q = arg + strlen (p);
 
        if (*q == '\0')
          {
-           bfin_si_revision = bfin_cpus[i].si_revision;
-           bfin_workarounds |= bfin_cpus[i].workarounds;
+           opts->x_bfin_si_revision = bfin_cpus[i].si_revision;
+           opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
          }
        else if (strcmp (q, "-none") == 0)
-         bfin_si_revision = -1;
+         opts->x_bfin_si_revision = -1;
        else if (strcmp (q, "-any") == 0)
          {
-           bfin_si_revision = 0xffff;
-           while (bfin_cpus[i].type == bfin_cpu_type)
+           opts->x_bfin_si_revision = 0xffff;
+           while (bfin_cpus[i].type == opts->x_bfin_cpu_type)
              {
-               bfin_workarounds |= bfin_cpus[i].workarounds;
+               opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
                i++;
              }
          }
@@ -2630,20 +2613,20 @@ bfin_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
                || si_major > 0xff || si_minor > 0xff)
              {
              invalid_silicon_revision:
-               error ("-mcpu=%s has invalid silicon revision", arg);
+               error_at (loc, "-mcpu=%s has invalid silicon revision", arg);
                return false;
              }
 
-           bfin_si_revision = (si_major << 8) | si_minor;
+           opts->x_bfin_si_revision = (si_major << 8) | si_minor;
 
-           while (bfin_cpus[i].type == bfin_cpu_type
-                  && bfin_cpus[i].si_revision != bfin_si_revision)
+           while (bfin_cpus[i].type == opts->x_bfin_cpu_type
+                  && bfin_cpus[i].si_revision != opts->x_bfin_si_revision)
              i++;
 
-           if (bfin_cpus[i].type != bfin_cpu_type)
+           if (bfin_cpus[i].type != opts->x_bfin_cpu_type)
              goto invalid_silicon_revision;
 
-           bfin_workarounds |= bfin_cpus[i].workarounds;
+           opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
          }
 
        return true;
@@ -2690,7 +2673,7 @@ bfin_option_override (void)
     flag_omit_frame_pointer = 1;
 
   /* Library identification */
-  if (bfin_lib_id_given && ! TARGET_ID_SHARED_LIBRARY)
+  if (global_options_set.x_bfin_library_id && ! TARGET_ID_SHARED_LIBRARY)
     error ("-mshared-library-id= specified without -mid-shared-library");
 
   if (stack_limit_rtx && TARGET_STACK_CHECK_L1)
index c26b41c..441e202 100644 (file)
 #ifndef _BFIN_CONFIG
 #define _BFIN_CONFIG
 
+#ifndef BFIN_OPTS_H
+#include "config/bfin/bfin-opts.h"
+#endif
+
 #define OBJECT_FORMAT_ELF
 
 #define BRT 1
 #define BRF 0
 
-/* CPU type.  */
-typedef enum bfin_cpu_type
-{
-  BFIN_CPU_UNKNOWN,
-  BFIN_CPU_BF512,
-  BFIN_CPU_BF514,
-  BFIN_CPU_BF516,
-  BFIN_CPU_BF518,
-  BFIN_CPU_BF522,
-  BFIN_CPU_BF523,
-  BFIN_CPU_BF524,
-  BFIN_CPU_BF525,
-  BFIN_CPU_BF526,
-  BFIN_CPU_BF527,
-  BFIN_CPU_BF531,
-  BFIN_CPU_BF532,
-  BFIN_CPU_BF533,
-  BFIN_CPU_BF534,
-  BFIN_CPU_BF536,
-  BFIN_CPU_BF537,
-  BFIN_CPU_BF538,
-  BFIN_CPU_BF539,
-  BFIN_CPU_BF542,
-  BFIN_CPU_BF542M,
-  BFIN_CPU_BF544,
-  BFIN_CPU_BF544M,
-  BFIN_CPU_BF547,
-  BFIN_CPU_BF547M,
-  BFIN_CPU_BF548,
-  BFIN_CPU_BF548M,
-  BFIN_CPU_BF549,
-  BFIN_CPU_BF549M,
-  BFIN_CPU_BF561
-} bfin_cpu_t;
-
-/* Value of -mcpu= */
-extern bfin_cpu_t bfin_cpu_type;
-
-/* Value of -msi-revision= */
-extern int bfin_si_revision;
-
-extern unsigned int bfin_workarounds;
-
 /* Print subsidiary information on the compiler version in use.  */
 #define TARGET_VERSION fprintf (stderr, " (BlackFin bfin)")
 
index c7a9056..15aebf3 100644 (file)
@@ -1,6 +1,6 @@
 ; Options for the Blackfin port of the compiler
 ;
-; Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2008, 2011 Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
 ;
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
+HeaderInclude
+config/bfin/bfin-opts.h
+
+; Value of -mcpu=.
+Variable
+bfin_cpu_t bfin_cpu_type = BFIN_CPU_UNKNOWN
+
+; -msi-revision support. There are three special values:
+; -1      -msi-revision=none.
+; 0xffff  -msi-revision=any.
+Variable
+int bfin_si_revision
+
+; The workarounds enabled.
+Variable
+unsigned int bfin_workarounds = 0
+
 msim
 Target RejectNegative
 Use simulator runtime