diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2005-04-06 09:40:41 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2005-04-06 09:40:41 +0000 |
commit | 0a0da1bc9069e13533a9cb1f99d6da1731299719 (patch) | |
tree | 53ddc5fbd42820a9b883d7e8db8673cfa90bdb5b /gcc/config/v850/v850.c | |
parent | ed23bd30c12f3dfeb1f74a19c10d83109b92cf56 (diff) | |
download | gcc-0a0da1bc9069e13533a9cb1f99d6da1731299719.zip gcc-0a0da1bc9069e13533a9cb1f99d6da1731299719.tar.gz gcc-0a0da1bc9069e13533a9cb1f99d6da1731299719.tar.bz2 |
v850-protos.h (override_options): Delete.
* config/v850/v850-protos.h (override_options): Delete.
* config/v850/v850.h (target_flags, MASK_GHS, MASK_LONG_CALLS, MASK_EP)
(MASK_PROLOG_FUNCTION, MASK_DEBUG, MASK_V850, MASK_V850E)
(MASK_SMALL_SLD, MASK_BIG_SWITCH, MASK_NO_APP_REGS, MASK_DISABLE_CALLT)
(MASK_STRICT_ALIGN, MASK_US_BIT_SET, MASK_US_MASK_SET, TARGET_GHS)
(TARGET_LONG_CALLS, TARGET_EP, TARGET_PROLOG_FUNCTION, TARGET_V850)
(TARGET_BIG_SWITCH, TARGET_DEBUG, TARGET_V850E, TARGET_US_BIT_SET)
(TARGET_SMALL_SLD, TARGET_DISABLE_CALLT, TARGET_NO_APP_REGS)
(TARGET_STRICT_ALIGN, TARGET_SWITCHES, TARGET_OPTIONS)
(OVERRIDE_OPTIONS): Delete.
(MASK_CPU): Redefine as MASK_V850 | MASK_V850E.
(small_memory_info): Remove the value field.
(CONDITIONAL_REGISTER_USAGE): Check !TARGET_APP_REGS rather than
TARGET_NO_APP_REGS.
* config/v850/v850.c (small_memory): Remove the value field.
(TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Override defaults.
(override_options): Delete.
(v850_handle_memory_option, v850_handle_option): New functions.
* config/v850/v850.opt: New file.
From-SVN: r97710
Diffstat (limited to 'gcc/config/v850/v850.c')
-rw-r--r-- | gcc/config/v850/v850.c | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 9026fa8..0215882 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -49,6 +49,7 @@ #endif /* Function prototypes for stupid compilers: */ +static bool v850_handle_option (size_t, const char *, int); static void const_double_split (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *); static int const_costs_int (HOST_WIDE_INT, int); static int const_costs (rtx, enum rtx_code); @@ -75,10 +76,10 @@ static int v850_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, /* Information about the various small memory areas. */ struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = { - /* name value max physical max */ - { "tda", (char *)0, 0, 256 }, - { "sda", (char *)0, 0, 65536 }, - { "zda", (char *)0, 0, 32768 }, + /* name max physical max */ + { "tda", 0, 256 }, + { "sda", 0, 65536 }, + { "zda", 0, 32768 }, }; /* Names of the various data areas used on the v850. */ @@ -115,6 +116,11 @@ static int v850_interrupt_p = FALSE; #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true +#undef TARGET_DEFAULT_TARGET_FLAGS +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_DEFAULT | MASK_APP_REGS) +#undef TARGET_HANDLE_OPTION +#define TARGET_HANDLE_OPTION v850_handle_option + #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS v850_rtx_costs @@ -144,49 +150,64 @@ static int v850_interrupt_p = FALSE; struct gcc_target targetm = TARGET_INITIALIZER; -/* Sometimes certain combinations of command options do not make - sense on a particular target machine. You can define a macro - `OVERRIDE_OPTIONS' to take account of this. This macro, if - defined, is executed once just after all the command options have - been parsed. - - Don't use this macro to turn on various extra optimizations for - `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ +/* 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 "=". */ -void -override_options (void) +static bool +v850_handle_memory_option (enum small_memory_type type, const char *value) { - int i; - extern int atoi (const char *); + int i, size; - /* Parse -m{s,t,z}da=nnn switches */ - for (i = 0; i < (int)SMALL_MEMORY_max; i++) - { - if (small_memory[i].value) - { - if (!ISDIGIT (*small_memory[i].value)) - error ("%s=%s is not numeric", - small_memory[i].name, - small_memory[i].value); - else - { - small_memory[i].max = atoi (small_memory[i].value); - if (small_memory[i].max > small_memory[i].physical_max) - error ("%s=%s is too large", - small_memory[i].name, - small_memory[i].value); - } - } - } + 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); + else + small_memory[type].max = size; + return true; +} - /* Make sure that the US_BIT_SET mask has been correctly initialized. */ - if ((target_flags & MASK_US_MASK_SET) == 0) +/* Implement TARGET_HANDLE_OPTION. */ + +static bool +v850_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +{ + switch (code) { - target_flags |= MASK_US_MASK_SET; - target_flags &= ~MASK_US_BIT_SET; + case OPT_mspace: + target_flags |= MASK_EP | MASK_PROLOG_FUNCTION; + return true; + + case OPT_mv850: + target_flags &= ~(MASK_CPU ^ MASK_V850); + return true; + + case OPT_mv850e: + case OPT_mv850e1: + target_flags &= ~(MASK_CPU ^ MASK_V850E); + return true; + + case OPT_mtda: + return v850_handle_memory_option (SMALL_MEMORY_TDA, arg); + + case OPT_msda: + return v850_handle_memory_option (SMALL_MEMORY_SDA, arg); + + case OPT_mzda: + return v850_handle_memory_option (SMALL_MEMORY_ZDA, arg); + + default: + return true; } } - static bool v850_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, |