* config/ia64/ia64-opts.h: New.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Mar 2011 22:33:40 +0000 (22:33 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Mar 2011 22:33:40 +0000 (22:33 +0000)
* config/ia64/ia64.c (ia64_tune): Remove.
(ia64_handle_option): Don't handle OPT_mfixed_range_ or OPT_mtune_
here.  Use error_at.
(ia64_option_override): Handle deferred OPT_mfixed_range_.
* config/ia64/ia64.h (enum processor_type, ia64_tune): Remove.
* config/ia64/ia64.opt (config/ia64/ia64-opts.h): New
HeaderInclude entry.
(ia64_tune): New Variable entry.
(mfixed-range=): Use Defer and Var.
(mtune=): Use Enum and Var.
(ia64_tune): New Enum and EnumValue entries.

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

gcc/ChangeLog
gcc/config/ia64/ia64-opts.h [new file with mode: 0644]
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/ia64/ia64.opt

index a303ee3..e9c325c 100644 (file)
@@ -1,5 +1,20 @@
 2011-03-22  Joseph Myers  <joseph@codesourcery.com>
 
+       * config/ia64/ia64-opts.h: New.
+       * config/ia64/ia64.c (ia64_tune): Remove.
+       (ia64_handle_option): Don't handle OPT_mfixed_range_ or OPT_mtune_
+       here.  Use error_at.
+       (ia64_option_override): Handle deferred OPT_mfixed_range_.
+       * config/ia64/ia64.h (enum processor_type, ia64_tune): Remove.
+       * config/ia64/ia64.opt (config/ia64/ia64-opts.h): New
+       HeaderInclude entry.
+       (ia64_tune): New Variable entry.
+       (mfixed-range=): Use Defer and Var.
+       (mtune=): Use Enum and Var.
+       (ia64_tune): New Enum and EnumValue entries.
+
+2011-03-22  Joseph Myers  <joseph@codesourcery.com>
+
        * config/frv/frv-opts.h: New.
        * config/frv/frv-protos.h (enum frv_cpu, frv_cpu_t): Move to
        frv-opts.h.
diff --git a/gcc/config/ia64/ia64-opts.h b/gcc/config/ia64/ia64-opts.h
new file mode 100644 (file)
index 0000000..eb28d83
--- /dev/null
@@ -0,0 +1,35 @@
+/* Definitions for option handling for IA-64.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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 IA64_OPTS_H
+#define IA64_OPTS_H
+
+/* Which processor to schedule for. The cpu attribute defines a list
+   that mirrors this list, so changes to ia64.md must be made at the
+   same time.  */
+
+enum processor_type
+{
+  PROCESSOR_ITANIUM,                   /* Original Itanium.  */
+  PROCESSOR_ITANIUM2,
+  PROCESSOR_max
+};
+
+#endif
index c3d6303..b86c4d8 100644 (file)
@@ -103,9 +103,6 @@ static const char * const ia64_local_reg_names[80] =
 static const char * const ia64_output_reg_names[8] =
 { "out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7" };
 
-/* Which cpu are we scheduling for.  */
-enum processor_type ia64_tune = PROCESSOR_ITANIUM2;
-
 /* Determines whether we run our final scheduling pass or not.  We always
    avoid the normal second scheduling pass.  */
 static int ia64_flag_schedule_insns2;
@@ -5657,54 +5654,22 @@ fix_range (const char *const_str)
 /* Implement TARGET_HANDLE_OPTION.  */
 
 static bool
-ia64_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+ia64_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
+                   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_mfixed_range_:
-      fix_range (arg);
-      return true;
-
     case OPT_mtls_size_:
       if (value != 14 && value != 22 && value != 64)
-       error ("bad value %<%s%> for -mtls-size= switch", arg);
+       error_at (loc, "bad value %<%s%> for -mtls-size= switch", arg);
       return true;
 
-    case OPT_mtune_:
-      {
-       static struct pta
-         {
-           const char *name;           /* processor name or nickname.  */
-           enum processor_type processor;
-         }
-       const processor_alias_table[] =
-         {
-           {"itanium2", PROCESSOR_ITANIUM2},
-           {"mckinley", PROCESSOR_ITANIUM2},
-         };
-       int const pta_size = ARRAY_SIZE (processor_alias_table);
-       int i;
-
-       for (i = 0; i < pta_size; i++)
-         if (!strcmp (arg, processor_alias_table[i].name))
-           {
-             ia64_tune = processor_alias_table[i].processor;
-             break;
-           }
-       if (i == pta_size)
-         error ("bad value %<%s%> for -mtune= switch", arg);
-       return true;
-      }
-
     default:
       return true;
     }
@@ -5715,6 +5680,24 @@ ia64_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
 static void
 ia64_option_override (void)
 {
+  unsigned int i;
+  cl_deferred_option *opt;
+  VEC(cl_deferred_option,heap) *vec
+    = (VEC(cl_deferred_option,heap) *) ia64_deferred_options;
+
+  FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt)
+    {
+      switch (opt->opt_index)
+       {
+       case OPT_mfixed_range_:
+         fix_range (opt->arg);
+         break;
+
+       default:
+         gcc_unreachable ();
+       }
+    }
+
   if (TARGET_AUTO_PIC)
     target_flags |= MASK_CONST_GP;
 
index 8e6d298..ed618f2 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of target machine GNU compiler.  IA-64 version.
    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-   2009, 2010 Free Software Foundation, Inc.
+   2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by James E. Wilson <wilson@cygnus.com> and
                  David Mosberger <davidm@hpl.hp.com>.
 
@@ -102,19 +102,6 @@ enum ia64_inline_type
 #ifndef TARGET_CPU_DEFAULT
 #define TARGET_CPU_DEFAULT 0
 #endif
-
-/* Which processor to schedule for. The cpu attribute defines a list
-   that mirrors this list, so changes to ia64.md must be made at the
-   same time.  */
-
-enum processor_type
-{
-  PROCESSOR_ITANIUM,                   /* Original Itanium.  */
-  PROCESSOR_ITANIUM2,
-  PROCESSOR_max
-};
-
-extern enum processor_type ia64_tune;
 \f
 /* Driver configuration */
 
index 49d099a..b924c10 100644 (file)
@@ -1,4 +1,5 @@
-; Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2006, 2008, 2009, 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/ia64/ia64-opts.h
+
+; Which cpu are we scheduling for.
+Variable
+enum processor_type ia64_tune = PROCESSOR_ITANIUM2
+
 mbig-endian
 Target Report RejectNegative Mask(BIG_ENDIAN)
 Generate big endian code
@@ -103,7 +111,7 @@ Target Report Mask(EARLY_STOP_BITS)
 Enable earlier placing stop bits for better scheduling
 
 mfixed-range=
-Target RejectNegative Joined
+Target RejectNegative Joined Var(ia64_deferred_options) Defer
 Specify range of registers to make fixed
 
 mtls-size=
@@ -111,9 +119,19 @@ Target RejectNegative Joined UInteger Var(ia64_tls_size) Init(22)
 Specify bit size of immediate TLS offsets
 
 mtune=
-Target RejectNegative Joined
+Target RejectNegative Joined Enum(ia64_tune) Var(ia64_tune)
 Schedule code for given CPU
 
+Enum
+Name(ia64_tune) Type(enum processor_type)
+Known Itanium CPUs (for use with the -mtune= option):
+
+EnumValue
+Enum(ia64_tune) String(itanium2) Value(PROCESSOR_ITANIUM2)
+
+EnumValue
+Enum(ia64_tune) String(mckinley) Value(PROCESSOR_ITANIUM2)
+
 msched-br-data-spec
 Target Report Var(mflag_sched_br_data_spec) Init(0)
 Use data speculation before reload