Convert legacy ColdFire options to .opt aliases

Message ID
State New
Headers show

Commit Message

Joseph Myers April 4, 2011, 9:05 p.m.
This patch begins simplifying m68k option handling, in preparation for
using the .opt Enum facility to process enumerated options, avoiding
global state in option handlers and sharing option hanlders with the
driver, by converting the legacy -m options for particular ColdFire
CPUs into .opt Alias entries for the corresponding -mcpu options.

Tested building cc1 and xgcc for cross to m68k-elf.  Will commit to
trunk in the absence of target maintainer objections - and will then
follow up with similar changes for the legacy -m options for
particular non-ColdFire CPUs.  I think it's reasonable to presume
ColdFire users are already using binutils versions with -mcpu=
assembler support (required to use any option converted to an alias by
this patch) - and since that support went in over five years ago, I
think it's reasonable to require a binutils version with that support
for non-ColdFire users as well (with a documentation update in the
non-ColdFire patch noting that binutils 2.17 or later is required).

Note that the MULTILIB_MATCHES setting that I removed as no longer
needed with the Alias entries in place had mappings for -m5300 and
-m5400, although there were no such options, and it mapped -mcfv4e to
-mcpu=5475 although the actual alias, following the code in
m68k_handle_option, is to -mcpu=547x.

2011-04-04  Joseph Myers  <>

	* config/m68k/m68k.c (m68k_handle_option): Don't handle OPT_m5200,
	OPT_m5206e, OPT_m528x, OPT_m5307, OPT_m5407 and OPT_mcfv4e.
	* config/m68k/m68k.h (OPTION_DEFAULT_SPECS, ASM_CPU_SPEC): Don't
	handle -m5200, -m5206e, -m528x, -m5307, -m5407 and -mcfv4e.
	* config/m68k/m68k.opt (m5200, m5206e, m528x, m5307, m5407,
	mcfv4e): Use Alias.
	* config/m68k/t-mlibs (MULTILIB_MATCHES): Don't map legacy
	ColdFire options to -mcpu= options.


Index: gcc/config/m68k/t-mlibs
--- gcc/config/m68k/t-mlibs	(revision 171942)
+++ gcc/config/m68k/t-mlibs	(working copy)
@@ -1,6 +1,6 @@ 
 # multilibs  -*- mode:Makefile -*-
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2011 Free Software Foundation, Inc.
 # This file is part of GCC.
@@ -73,11 +73,6 @@  MULTILIB_MATCHES += m68000=mcpu?68000 m6
 ifneq ($(M68K_ARCH),m68k)
-# Map the legacy ColdFire options to the new ones.
-MULTILIB_MATCHES += mcpu?5206=m5200 mcpu?5206e=m5206e mcpu?5208=m528x \
-		    mcpu?5307=m5300 mcpu?5307=m5307 \
-		    mcpu?5407=m5400 mcpu?5407=m5407 \
-		    mcpu?5475=mcfv4e
 # Map -march=* options to the representative -mcpu=* option.
 MULTILIB_MATCHES += mcpu?5206e=march?isaa mcpu?5208=march?isaaplus \
Index: gcc/config/m68k/m68k.opt
--- gcc/config/m68k/m68k.opt	(revision 171942)
+++ gcc/config/m68k/m68k.opt	(working copy)
@@ -1,6 +1,7 @@ 
 ; Options for the Motorola 68000 port of the compiler.
-; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011
+; Free Software Foundation, Inc.
 ; This file is part of GCC.
@@ -19,23 +20,23 @@ 
 ; <>.
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 5206)
 Generate code for a 520X
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 5206e)
 Generate code for a 5206e
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 528x)
 Generate code for a 528x
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 5307)
 Generate code for a 5307
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 5407)
 Generate code for a 5407
@@ -108,7 +109,7 @@  Target RejectNegative
 Generate code for a 68020
-Target RejectNegative
+Target RejectNegative Alias(mcpu=, 547x)
 Generate code for a ColdFire v4e
Index: gcc/config/m68k/m68k.c
--- gcc/config/m68k/m68k.c	(revision 171942)
+++ gcc/config/m68k/m68k.c	(working copy)
@@ -499,24 +499,6 @@  m68k_handle_option (struct gcc_options *
     case OPT_mtune_:
       return m68k_find_selection (&m68k_tune_entry, all_microarchs, arg);
-    case OPT_m5200:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "5206");
-    case OPT_m5206e:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "5206e");
-    case OPT_m528x:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "528x");
-    case OPT_m5307:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "5307");
-    case OPT_m5407:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "5407");
-    case OPT_mcfv4e:
-      return m68k_find_selection (&m68k_cpu_entry, all_devices, "547x");
     case OPT_m68000:
     case OPT_mc68000:
       return m68k_find_selection (&m68k_cpu_entry, all_devices, "68000");
Index: gcc/config/m68k/m68k.h
--- gcc/config/m68k/m68k.h	(revision 171942)
+++ gcc/config/m68k/m68k.h	(working copy)
@@ -31,9 +31,8 @@  along with GCC; see the file COPYING3.  
 /* Handle --with-cpu default option from configure script.  */
 #define OPTION_DEFAULT_SPECS						\
   { "cpu",   "%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:\
-%{!mcpu=*:%{!march=*:-%(VALUE)}}}}}}}}}}}}}}}}}}}}}" },
+%{!mcpu=*:%{!march=*:-%(VALUE)}}}}}}}}}}}}}}}" },
 /* Pass flags to gas indicating which type of processor we have.  This
    can be simplified when we can rely on the assembler supporting .cpu
@@ -43,7 +42,7 @@  along with GCC; see the file COPYING3.  
 %{m68851}%{mno-68851} %{m68881}%{mno-68881} %{msoft-float:-mno-float} \
 #define ASM_PCREL_SPEC "%{fPIC|fpic|mpcrel:--pcrel} \