+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.
--- /dev/null
+/* 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
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;
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;
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},
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,
/* 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_:
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++;
}
}
|| 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;
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)