* config/v850/v850-opts.h: New.
* config/v850/v850.c (small_memory): Replace with
small_memory_physical_max array. Make that array static const.
(v850_handle_memory_option): Take integer value of argument. Take
gcc_options pointer, option text and location. Return void.
Update for changes to small memory structures.
(v850_handle_option): Access target_flags via opts pointer. Don't
assert that global structures are in use. Update calls to
v850_handle_memory_option.
(v850_encode_data_area): Update references to small memory
settings.
* config/v850/v850.h (struct small_memory_info, small_memory):
Remove.
(enum small_memory_type): Move to v850-opts.h.
* config/v850/v850.opt (config/v850/v850-opts.h): New
HeaderInclude entry.
(small_memory_max): New Variable entry.
(msda): Replace by pair of options msda= and msda-. Use UInteger.
(mtda, mzda): Likewise.
From-SVN: r171327
+2011-03-22 Joseph Myers <joseph@codesourcery.com>
+
+ * config/v850/v850-opts.h: New.
+ * config/v850/v850.c (small_memory): Replace with
+ small_memory_physical_max array. Make that array static const.
+ (v850_handle_memory_option): Take integer value of argument. Take
+ gcc_options pointer, option text and location. Return void.
+ Update for changes to small memory structures.
+ (v850_handle_option): Access target_flags via opts pointer. Don't
+ assert that global structures are in use. Update calls to
+ v850_handle_memory_option.
+ (v850_encode_data_area): Update references to small memory
+ settings.
+ * config/v850/v850.h (struct small_memory_info, small_memory):
+ Remove.
+ (enum small_memory_type): Move to v850-opts.h.
+ * config/v850/v850.opt (config/v850/v850-opts.h): New
+ HeaderInclude entry.
+ (small_memory_max): New Variable entry.
+ (msda): Replace by pair of options msda= and msda-. Use UInteger.
+ (mtda, mzda): Likewise.
+
2011-03-22 Joseph Myers <joseph@codesourcery.com>
* config/sh/sh.c (sh_handle_option): Access target_flags via opts
--- /dev/null
+/* Definitions for option handling for NEC V850 series.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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 V850_OPTS_H
+#define V850_OPTS_H
+
+enum small_memory_type {
+ /* tiny data area, using EP as base register */
+ SMALL_MEMORY_TDA = 0,
+ /* small data area using dp as base register */
+ SMALL_MEMORY_SDA,
+ /* zero data area using r0 as base register */
+ SMALL_MEMORY_ZDA,
+ SMALL_MEMORY_max
+};
+
+#endif
static void v850_print_operand_address (FILE *, rtx);
/* Information about the various small memory areas. */
-struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
+static const int small_memory_physical_max[(int) SMALL_MEMORY_max] =
{
- /* Name Max Physical max. */
- { "tda", 0, 256 },
- { "sda", 0, 65536 },
- { "zda", 0, 32768 },
+ 256,
+ 65536,
+ 32768,
};
/* Names of the various data areas used on the v850. */
static GTY(()) section * zbss_section;
\f
/* Set the maximum size of small memory area TYPE to the value given
- by VALUE. Return true if VALUE was syntactically correct. VALUE
- starts with the argument separator: either "-" or "=". */
+ by SIZE in structure OPTS (option text OPT passed at location LOC). */
-static bool
-v850_handle_memory_option (enum small_memory_type type, const char *value)
+static void
+v850_handle_memory_option (enum small_memory_type type,
+ struct gcc_options *opts, const char *opt,
+ int size, location_t loc)
{
- int i, size;
-
- if (*value != '-' && *value != '=')
- return false;
-
- value++;
- for (i = 0; value[i]; i++)
- if (!ISDIGIT (value[i]))
- return false;
-
- size = atoi (value);
- if (size > small_memory[type].physical_max)
- error ("value passed to %<-m%s%> is too large", small_memory[type].name);
+ if (size > small_memory_physical_max[type])
+ error_at (loc, "value passed in %qs is too large", opt);
else
- small_memory[type].max = size;
- return true;
+ opts->x_small_memory_max[type] = size;
}
/* Implement TARGET_HANDLE_OPTION. */
static bool
-v850_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+v850_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;
-
- gcc_assert (opts == &global_options);
- gcc_assert (opts_set == &global_options_set);
+ int value = decoded->value;
switch (code)
{
case OPT_mspace:
- target_flags |= MASK_EP | MASK_PROLOG_FUNCTION;
+ opts->x_target_flags |= MASK_EP | MASK_PROLOG_FUNCTION;
return true;
case OPT_mv850:
- target_flags &= ~(MASK_CPU ^ MASK_V850);
+ opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850);
return true;
case OPT_mv850e:
case OPT_mv850e1:
- target_flags &= ~(MASK_CPU ^ MASK_V850E);
+ opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E);
return true;
- case OPT_mtda:
- return v850_handle_memory_option (SMALL_MEMORY_TDA, arg);
+ case OPT_mtda_:
+ v850_handle_memory_option (SMALL_MEMORY_TDA, opts,
+ decoded->orig_option_with_args_text,
+ value, loc);
+ return true;
- case OPT_msda:
- return v850_handle_memory_option (SMALL_MEMORY_SDA, arg);
+ case OPT_msda_:
+ v850_handle_memory_option (SMALL_MEMORY_SDA, opts,
+ decoded->orig_option_with_args_text,
+ value, loc);
+ return true;
- case OPT_mzda:
- return v850_handle_memory_option (SMALL_MEMORY_ZDA, arg);
+ case OPT_mzda_:
+ v850_handle_memory_option (SMALL_MEMORY_ZDA, opts,
+ decoded->orig_option_with_args_text,
+ value, loc);
+ return true;
default:
return true;
if (size <= 0)
;
- else if (size <= small_memory [(int) SMALL_MEMORY_TDA].max)
+ else if (size <= small_memory_max [(int) SMALL_MEMORY_TDA])
v850_set_data_area (decl, DATA_AREA_TDA);
- else if (size <= small_memory [(int) SMALL_MEMORY_SDA].max)
+ else if (size <= small_memory_max [(int) SMALL_MEMORY_SDA])
v850_set_data_area (decl, DATA_AREA_SDA);
- else if (size <= small_memory [(int) SMALL_MEMORY_ZDA].max)
+ else if (size <= small_memory_max [(int) SMALL_MEMORY_ZDA])
v850_set_data_area (decl, DATA_AREA_ZDA);
}
} while(0)
#define MASK_CPU (MASK_V850 | MASK_V850E)
-
-/* Information about the various small memory areas. */
-struct small_memory_info {
- const char *name;
- long max;
- long physical_max;
-};
-
-enum small_memory_type {
- /* tiny data area, using EP as base register */
- SMALL_MEMORY_TDA = 0,
- /* small data area using dp as base register */
- SMALL_MEMORY_SDA,
- /* zero data area using r0 as base register */
- SMALL_MEMORY_ZDA,
- SMALL_MEMORY_max
-};
-
-extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
\f
/* Target machine storage layout */
; Options for the NEC V850 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.
;
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
+HeaderInclude
+config/v850/v850-opts.h
+
+Variable
+int small_memory_max[(int)SMALL_MEMORY_max] = { 0, 0, 0 }
+
mapp-regs
Target Report Mask(APP_REGS)
Use registers r2 and r5
Target Report Mask(PROLOG_FUNCTION)
Use stubs for function prologues
-msda
-Target RejectNegative Joined
+msda=
+Target RejectNegative Joined UInteger
Set the max size of data eligible for the SDA area
+msda-
+Target RejectNegative Joined Undocumented Alias(msda=)
+
msmall-sld
Target Report Mask(SMALL_SLD)
Enable the use of the short load instructions
Target RejectNegative
Same as: -mep -mprolog-function
-mtda
-Target RejectNegative Joined
+mtda=
+Target RejectNegative Joined UInteger
Set the max size of data eligible for the TDA area
+mtda-
+Target RejectNegative Joined Undocumented Alias(mtda=)
+
mno-strict-align
Target Report Mask(NO_STRICT_ALIGN)
Do not enforce strict alignment
Target Report RejectNegative Mask(V850E2V3)
Compile for the v850e2v3 processor
-mzda
-Target RejectNegative Joined
+mzda=
+Target RejectNegative Joined UInteger
Set the max size of data eligible for the ZDA area
+
+mzda-
+Target RejectNegative Joined Undocumented Alias(mzda=)