OSDN Git Service

* config/mn10300/mn10300-protos.h (mn10300_override_options): Declare.
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Apr 2005 07:40:31 +0000 (07:40 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Apr 2005 07:40:31 +0000 (07:40 +0000)
* config/mn10300/mn10300.h (target_flags, TARGET_MULT_BUG)
(TARGET_SWITCHES, TARGET_DEFAULT): Delete.
(processor_type): New enum.
(mn10300_processor): New variable.
(TARGET_AM33, TARGET_AM33_2): Redefine in terms of mn10300_processor.
(PROCESSOR_DEFAULT, OVERRIDE_OPTIONS): New macros.
* config/mn10300/linux.h (TARGET_SWITCHES, TARGET_DEFAULT): Delete.
(PROCESSOR_DEFAULT): New macro.
* config/mn10300/mn10300.c (mn10300_processor): New variable.
(TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Override defaults.
(mn10300_handle_option, mn10300_override_options): New functions.
* config/mn10300/mn10300.opt: New file.

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

gcc/ChangeLog
gcc/config/mn10300/linux.h
gcc/config/mn10300/mn10300-protos.h
gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.h
gcc/config/mn10300/mn10300.opt [new file with mode: 0644]

index bbbade7..d97b440 100644 (file)
@@ -1,3 +1,19 @@
+2004-04-05  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mn10300/mn10300-protos.h (mn10300_override_options): Declare.
+       * config/mn10300/mn10300.h (target_flags, TARGET_MULT_BUG)
+       (TARGET_SWITCHES, TARGET_DEFAULT): Delete.
+       (processor_type): New enum.
+       (mn10300_processor): New variable.
+       (TARGET_AM33, TARGET_AM33_2): Redefine in terms of mn10300_processor.
+       (PROCESSOR_DEFAULT, OVERRIDE_OPTIONS): New macros.
+       * config/mn10300/linux.h (TARGET_SWITCHES, TARGET_DEFAULT): Delete.
+       (PROCESSOR_DEFAULT): New macro.
+       * config/mn10300/mn10300.c (mn10300_processor): New variable.
+       (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Override defaults.
+       (mn10300_handle_option, mn10300_override_options): New functions.
+       * config/mn10300/mn10300.opt: New file.
+
 2005-04-05  Eric Botcazou  <ebotcazou@libertysurf.fr>
             Sebastian Pop <sebastian.pop@cri.ensmp.fr>
 
index 4a67179..ddbaced 100644 (file)
      %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
    %{static:-static}"
 
-#undef  TARGET_SWITCHES
-#define TARGET_SWITCHES        \
-  {{ "am33",           -0x4,   N_("Target the AM33 processor") }, \
-   { "am33-2",         6,      N_("Target the AM33/2.0 processor") }, \
-   { "relax",          0,      N_("Enable linker relaxations") }, \
-   { "", TARGET_DEFAULT, NULL }}
-
-#undef  TARGET_DEFAULT
-#define TARGET_DEFAULT 6
+#undef  PROCESSOR_DEFAULT
+#define PROCESSOR_DEFAULT PROCESSOR_AM33_2
 
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (AM33/2.0 GNU/Linux)");
index 2936dcf..294e6ec 100644 (file)
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 extern void mn10300_va_start (tree, rtx);
 #endif /* TREE_CODE */
 
+extern void mn10300_override_options (void);
 extern struct rtx_def *legitimize_address (rtx, rtx, enum machine_mode);
 extern rtx legitimize_pic_address (rtx, rtx);
 extern int legitimate_pic_operand_p (rtx);
index c419101..23503c1 100644 (file)
@@ -54,6 +54,9 @@ int mn10300_unspec_int_label_counter;
    symbol names from register names.  */
 int mn10300_protect_label;
 
+/* The selected processor.  */
+enum processor_type mn10300_processor = PROCESSOR_DEFAULT;
+
 /* The size of the callee register save area.  Right now we save everything
    on entry since it costs us nothing in code size.  It does cost us from a
    speed standpoint, so we want to optimize this sooner or later.  */
@@ -65,6 +68,7 @@ int mn10300_protect_label;
                                || regs_ever_live[16] || regs_ever_live[17]))
 
 
+static bool mn10300_handle_option (size_t, const char *, int);
 static int mn10300_address_cost_1 (rtx, int *);
 static int mn10300_address_cost (rtx);
 static bool mn10300_rtx_costs (rtx, int, int, int *);
@@ -90,6 +94,11 @@ static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 #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_MULT_BUG
+#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION mn10300_handle_option
+
 #undef  TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO mn10300_encode_section_info
 
@@ -110,6 +119,37 @@ static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 static void mn10300_encode_section_info (tree, rtx, int);
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
+/* Implement TARGET_HANDLE_OPTION.  */
+
+static bool
+mn10300_handle_option (size_t code,
+                      const char *arg ATTRIBUTE_UNUSED,
+                      int value)
+{
+  switch (code)
+    {
+    case OPT_mam33:
+      mn10300_processor = value ? PROCESSOR_AM33 : PROCESSOR_MN10300;
+      return true;
+    case OPT_mam33_2:
+      mn10300_processor = (value
+                          ? PROCESSOR_AM33_2
+                          : MIN (PROCESSOR_AM33, PROCESSOR_DEFAULT));
+      return true;
+    default:
+      return true;
+    }
+}
+
+/* Implement OVERRIDE_OPTIONS.  */
+
+void
+mn10300_override_options (void)
+{
+  if (TARGET_AM33)
+    target_flags &= ~MASK_MULT_BUG;
+}
+
 static void
 mn10300_file_start (void)
 {
index 4b1e44d..da5d339 100644 (file)
@@ -42,46 +42,25 @@ Boston, MA 02111-1307, USA.  */
 
 #define CPP_SPEC "%{mam33:-D__AM33__} %{mam33-2:-D__AM33__=2 -D__AM33_2__}"
 
-/* Run-time compilation parameters selecting different hardware subsets.  */
+extern GTY(()) int mn10300_unspec_int_label_counter;
 
-extern int target_flags;
+enum processor_type {
+  PROCESSOR_MN10300,
+  PROCESSOR_AM33,
+  PROCESSOR_AM33_2
+};
 
-extern GTY(()) int mn10300_unspec_int_label_counter;
+extern enum processor_type mn10300_processor;
 
-/* Macros used in the machine description to test the flags.  */
-
-/* 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.  */
-
-/* Generate code to work around mul/mulq bugs on the mn10300.  */
-#define TARGET_MULT_BUG                        (target_flags & 0x1)
-
-/* Generate code for the AM33 processor.  */
-#define TARGET_AM33                    (target_flags & 0x2)
-
-/* Generate code for the AM33/2.0 processor.  */
-#define TARGET_AM33_2                  (target_flags & 0x4)
-
-#define TARGET_SWITCHES  \
-  {{ "mult-bug",       0x1,  N_("Work around hardware multiply bug")}, \
-   { "no-mult-bug",    -0x1, N_("Do not work around hardware multiply bug")},\
-   { "am33",           0x2,  N_("Target the AM33 processor")}, \
-   { "am33",           -(0x1), ""},\
-   { "no-am33",        -0x2, ""},      \
-   { "no-crt0",                0,    N_("No default crt0.o") }, \
-   { "am33-2",         0x6,  N_("Target the AM33/2.0 processor")},   \
-   { "am33-2",         -(0x1), ""},\
-   { "no-am33-2",      -0x4,   ""},  \
-   { "relax",          0,    N_("Enable linker relaxations") }, \
-   { "", TARGET_DEFAULT, NULL}}
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0x1
+#define TARGET_AM33    (mn10300_processor >= PROCESSOR_AM33)
+#define TARGET_AM33_2  (mn10300_processor == PROCESSOR_AM33_2)
+
+#ifndef PROCESSOR_DEFAULT
+#define PROCESSOR_DEFAULT PROCESSOR_MN10300
 #endif
 
+#define OVERRIDE_OPTIONS mn10300_override_options ()
+
 /* Print subsidiary information on the compiler version in use.  */
 
 #define TARGET_VERSION fprintf (stderr, " (MN10300)");
diff --git a/gcc/config/mn10300/mn10300.opt b/gcc/config/mn10300/mn10300.opt
new file mode 100644 (file)
index 0000000..31161c9
--- /dev/null
@@ -0,0 +1,37 @@
+; Options for the Matsushita MN10300 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.
+
+mam33
+Target
+Target the AM33 processor
+
+mam33-2
+Target
+Target the AM33/2.0 processor
+
+mmult-bug
+Target Report Mask(MULT_BUG)
+Work around hardware multiply bug
+
+; Ignored by the compiler
+mrelax
+Target RejectNegative
+Enable linker relaxations