aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2005-04-06 09:40:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2005-04-06 09:40:41 +0000
commit0a0da1bc9069e13533a9cb1f99d6da1731299719 (patch)
tree53ddc5fbd42820a9b883d7e8db8673cfa90bdb5b
parented23bd30c12f3dfeb1f74a19c10d83109b92cf56 (diff)
downloadgcc-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
-rw-r--r--gcc/ChangeLog22
-rw-r--r--gcc/config/v850/v850-protos.h1
-rw-r--r--gcc/config/v850/v850.c101
-rw-r--r--gcc/config/v850/v850.h160
-rw-r--r--gcc/config/v850/v850.opt91
5 files changed, 179 insertions, 196 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fbdb515..fbca7d6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2005-04-06 Richard Sandiford <rsandifo@redhat.com>
+
+ * 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.
+
2005-04-06 Geoffrey Keating <geoffk@apple.com>
* config.host: Add a section for generic hosts, and a subsection
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h
index 5512c7e..010e335 100644
--- a/gcc/config/v850/v850-protos.h
+++ b/gcc/config/v850/v850-protos.h
@@ -35,7 +35,6 @@ extern void zdata_section (void);
extern void rozdata_section (void);
extern void zbss_section (void);
extern int v850_handle_pragma (int (*)(void), void (*)(int), char *);
-extern void override_options (void);
extern int compute_register_save_size (long *);
extern int compute_frame_size (int, long *);
extern void v850_init_expanders (void);
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,
diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h
index 1d2b91c..8aefe03 100644
--- a/gcc/config/v850/v850.h
+++ b/gcc/config/v850/v850.h
@@ -83,137 +83,11 @@
builtin_assert( "cpu=v850" ); \
} while(0)
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Target flags bits, see below for an explanation of the bits. */
-#define MASK_GHS 0x00000001
-#define MASK_LONG_CALLS 0x00000002
-#define MASK_EP 0x00000004
-#define MASK_PROLOG_FUNCTION 0x00000008
-#define MASK_DEBUG 0x40000000
-
-#define MASK_CPU 0x00000030
-#define MASK_V850 0x00000010
-#define MASK_V850E 0x00000020
-#define MASK_SMALL_SLD 0x00000040
-
-#define MASK_BIG_SWITCH 0x00000100
-#define MASK_NO_APP_REGS 0x00000200
-#define MASK_DISABLE_CALLT 0x00000400
-#define MASK_STRICT_ALIGN 0x00000800
-
-#define MASK_US_BIT_SET 0x00001000
-#define MASK_US_MASK_SET 0x00002000
-
-/* Macros used in the machine description to test the flags. */
-
-/* The GHS calling convention support doesn't really work,
- mostly due to a lack of documentation. Outstanding issues:
-
- * How do varargs & stdarg really work. How to they handle
- passing structures (if at all).
-
- * Doubles are normally 4 byte aligned, except in argument
- lists where they are 8 byte aligned. Is the alignment
- in the argument list based on the first parameter,
- first stack parameter, etc etc.
-
- * Passing/returning of large structures probably isn't the same
- as GHS. We don't have enough documentation on their conventions
- to be compatible.
-
- * Tests of TARGET_SETUP_INCOMING_VARARGS need to be made runtime checks
- since it depends on TARGET_GHS. */
-#define TARGET_GHS (target_flags & MASK_GHS)
-
-/* Don't do PC-relative calls, instead load the address of the target
- function into a register and perform a register indirect call. */
-#define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
-
-/* Whether to optimize space by using ep (r30) for pointers with small offsets
- in basic blocks. */
-#define TARGET_EP (target_flags & MASK_EP)
-
-/* Whether to call out-of-line functions to save registers or not. */
-#define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)
-
-#define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850)
-
-/* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */
-#define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)
-
-/* General debug flag. */
-#define TARGET_DEBUG (target_flags & MASK_DEBUG)
-#define TARGET_V850E ((target_flags & MASK_V850E) == MASK_V850E)
-
-#define TARGET_US_BIT_SET (target_flags & MASK_US_BIT_SET)
-
-/* Whether to assume that the SLD.B and SLD.H instructions only have small
- displacement fields, thus allowing the generated code to run on any of
- the V850 range of processors. */
-#define TARGET_SMALL_SLD (target_flags & MASK_SMALL_SLD)
-
-/* True if callt will not be used for function prolog & epilog. */
-#define TARGET_DISABLE_CALLT (target_flags & MASK_DISABLE_CALLT)
-
-/* False if r2 and r5 can be used by the compiler. True if r2
- and r5 are to be fixed registers (for compatibility with GHS). */
-#define TARGET_NO_APP_REGS (target_flags & MASK_NO_APP_REGS)
-
-#define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- {{ "ghs", MASK_GHS, N_("Support Green Hills ABI") }, \
- { "no-ghs", -MASK_GHS, "" }, \
- { "long-calls", MASK_LONG_CALLS, \
- N_("Prohibit PC relative function calls") },\
- { "no-long-calls", -MASK_LONG_CALLS, "" }, \
- { "ep", MASK_EP, \
- N_("Reuse r30 on a per function basis") }, \
- { "no-ep", -MASK_EP, "" }, \
- { "prolog-function", MASK_PROLOG_FUNCTION, \
- N_("Use stubs for function prologues") }, \
- { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \
- { "space", MASK_EP | MASK_PROLOG_FUNCTION, \
- N_("Same as: -mep -mprolog-function") }, \
- { "debug", MASK_DEBUG, N_("Enable backend debugging") }, \
- { "v850", MASK_V850, \
- N_("Compile for the v850 processor") }, \
- { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \
- { "v850e1", MASK_V850E, N_("Compile for v850e1 processor") }, \
- { "v850e1", -(MASK_V850E ^ MASK_CPU), "" }, /* Make sure that the other bits are cleared. */ \
- { "v850e", MASK_V850E, N_("Compile for v850e processor") }, \
- { "v850e", -(MASK_V850E ^ MASK_CPU), "" }, /* Make sure that the other bits are cleared. */ \
- { "small-sld", MASK_SMALL_SLD, N_("Enable the use of the short load instructions") }, \
- { "no-small-sld", -MASK_SMALL_SLD, "" }, \
- { "disable-callt", MASK_DISABLE_CALLT, \
- N_("Do not use the callt instruction") }, \
- { "no-disable-callt", -MASK_DISABLE_CALLT, "" }, \
- { "US-bit-set", (MASK_US_BIT_SET | MASK_US_MASK_SET), "" }, \
- { "no-US-bit-set", -MASK_US_BIT_SET, "" }, \
- { "no-US-bit-set", MASK_US_MASK_SET, "" }, \
- { "app-regs", -MASK_NO_APP_REGS, "" }, \
- { "no-app-regs", MASK_NO_APP_REGS, \
- N_("Do not use registers r2 and r5") }, \
- { "strict-align", MASK_STRICT_ALIGN, \
- N_("Enforce strict alignment") }, \
- { "no-strict-align", -MASK_STRICT_ALIGN, "" }, \
- { "big-switch", MASK_BIG_SWITCH, \
- N_("Use 4 byte entries in switch tables") },\
- { "", MASK_DEFAULT, ""}}
+#define MASK_CPU (MASK_V850 | MASK_V850E)
/* Information about the various small memory areas. */
struct small_memory_info {
const char *name;
- const char *value;
long max;
long physical_max;
};
@@ -230,30 +104,6 @@ enum small_memory_type {
extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
-#define TARGET_OPTIONS \
-{ \
- { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \
- N_("Set the max size of data eligible for the TDA area"), 0}, \
- { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "", 0}, \
- { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \
- N_("Set the max size of data eligible for the SDA area"), 0}, \
- { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "", 0}, \
- { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \
- N_("Set the max size of data eligible for the ZDA area"), 0}, \
- { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "", 0}, \
-}
-
-/* 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. */
-#define OVERRIDE_OPTIONS override_options ()
-
-
/* Show we can debug even without a frame pointer. */
#define CAN_DEBUG_WITHOUT_FP
@@ -400,14 +250,14 @@ extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \
}
-/* If TARGET_NO_APP_REGS is not defined then add r2 and r5 to
+/* If TARGET_APP_REGS is not defined then add r2 and r5 to
the pool of fixed registers. See PR 14505. */
#define CONDITIONAL_REGISTER_USAGE \
{ \
- if (TARGET_NO_APP_REGS) \
+ if (!TARGET_APP_REGS) \
{ \
- fixed_regs[2] = 1; call_used_regs[2] = 1; \
- fixed_regs[5] = 1; call_used_regs[5] = 1; \
+ fixed_regs[2] = 1; call_used_regs[2] = 1; \
+ fixed_regs[5] = 1; call_used_regs[5] = 1; \
} \
}
diff --git a/gcc/config/v850/v850.opt b/gcc/config/v850/v850.opt
new file mode 100644
index 0000000..8b19791
--- /dev/null
+++ b/gcc/config/v850/v850.opt
@@ -0,0 +1,91 @@
+; Options for the NEC V850 port of the compiler.
+
+; Copyright (C) 2005 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 2, 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 COPYING. If not, write to the Free
+; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+; 02111-1307, USA.
+
+mapp-regs
+Target Report Mask(APP_REGS)
+Use registers r2 and r5
+
+mbig-switch
+Target Report Mask(BIG_SWITCH)
+Use 4 byte entries in switch tables
+
+mdebug
+Target Report Mask(DEBUG)
+Enable backend debugging
+
+mdisable-callt
+Target Report Mask(DISABLE_CALLT)
+Do not use the callt instruction
+
+mep
+Target Report Mask(EP)
+Reuse r30 on a per function basis
+
+mghs
+Target Report Mask(GHS)
+Support Green Hills ABI
+
+mlong-calls
+Target Report Mask(LONG_CALLS)
+Prohibit PC relative function calls
+
+mprolog-function
+Target Report Mask(PROLOG_FUNCTION)
+Use stubs for function prologues
+
+msda
+Target RejectNegative Joined
+Set the max size of data eligible for the SDA area
+
+msmall-sld
+Target Report Mask(SMALL_SLD)
+Enable the use of the short load instructions
+
+mspace
+Target RejectNegative
+Same as: -mep -mprolog-function
+
+mtda
+Target RejectNegative Joined
+Set the max size of data eligible for the TDA area
+
+mstrict-align
+Target Report Mask(STRICT_ALIGN)
+Enforce strict alignment
+
+mUS-bit-set
+Target Report Mask(US_BIT_SET)
+
+mv850
+Target Report RejectNegative Mask(V850)
+Compile for the v850 processor
+
+mv850e
+Target Report RejectNegative Mask(V850E)
+Compile for the v850e processor
+
+mv850e1
+Target RejectNegative Mask(V850E) MaskExists
+Compile for the v850e1 processor
+
+mzda
+Target RejectNegative Joined
+Set the max size of data eligible for the ZDA area