This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [MIPS] Pass -mdsp if compiling for DSP core


Hi Richard,

I'm attaching an updated patch which addresses your comments. Does this version look okay to install? Thanks,

Catherine

	* config.gcc (mips64vrel-*-elf*): Include the tm_file prior to vr.h.
	* config/mips/linux.h (LINUX_DRIVER_SELF_SPECS): New.
	(BASE_DRIVER_SELF_SPECS): Remove.
	(DRIVER_SELF_SPECS): New definition.
	* config/mips/elfoabi.h: (DRIVER_SELF_SPECS): Include BASE_DRIVER_SELF_SPECS.
	* config/mips/sde.h: Likewise.
	* config/mips/iris6.h: Likewise.
	* config/mips/vr.h: Likewise.
	* config/mips/mips.h (BASE_DRIVER_SELF_SPECS): New.
	

Richard Sandiford wrote:
Catherine Moore <clm@codesourcery.com> writes:
This patch will cause gcc to pass -mdsp by default if the arch setting
is for the 24ke, 74k or 34k families.  Current behavior requires that -mdsp
be passed on the command line.

Thanks for following the existing style here. Unfortunately, I think -mdsp is a slightly different case.

We have three reasons for wanting to simulate command lines:

(1) To make implicit options appear explicitly.  This makes other specs
    easier to write, and can help in picking the right multilib.

MIPS_ISA_LEVEL_SPEC is an example of this. It sets -mips* from -march*.

(2) To select a calling convention based on other flags.

    MIPS_ARCH_FLOAT_SPEC is an example of this.  It selects the hard-float
    or soft-float ABI from -march.

(3) To select processor-specific features that do not affect the
    calling convention.

Your new spec is an example of this.

(1) is at worst a no-op, so it doesn't matter whether we do it for all
targets or not.  We have traditionally only done it when we've needed to,
but that can be changed.

On the other hand, (2) _must_ be target-specific.  It is a
configuration-specific decision whether -march affects the calling
convention.  Many configurations don't support hard-float and soft-float
simultaneously.

I think (3) should be target-independent.  The idea behind the patch
is that -march=* should enable all features of the processor _within
the confines of the current ABI_.  It would be confusing if -march only
did that for some configurations.

So I think we finally have a reason to have a definition of
DEFAULT_SELF_SPECS in mips.h.  Something like:

mips.h:
#define BASE_DRIVER_SELF_SPECS  /* your new stuff */
#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS

linux.h:
rename BASE_DRIVER_SELF_SPECS to LINUX_DRIVER_SELF_SPECS
update uses
include BASE_DRIVER_SELF_SPECS in LINUX_DRIVER_SELF_SPECS
undef DRIVER_SELF_SPECS before redefining it

elfoabi.h:
iris.h:
sde.h:
vr.h:
undef DRIVER_SELF_SPECS before redefining it
add BASE_DRIVER_SELF_SPECS to DRIVER_SELF_SPECS

The reason for doing it this way round (and the reason we do it
this way round in linux.h already) is that we might in general
want to add target-specific rules both before and after the
target-independent rules.  E.g. vr.h starts with rules that
insert a default -march.

Richard
Index: config.gcc
===================================================================
--- config.gcc	(revision 141641)
+++ config.gcc	(working copy)
@@ -1672,7 +1672,7 @@ mips64-*-elf* | mips64el-*-elf*)
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
-        tm_file="mips/vr.h elfos.h ${tm_file} mips/elf.h"
+        tm_file="elfos.h ${tm_file} mips/vr.h mips/elf.h"
         tmake_file=mips/t-vr
         ;;
 mips64orion-*-elf* | mips64orionel-*-elf*)
Index: config/mips/linux.h
===================================================================
--- config/mips/linux.h	(revision 141641)
+++ config/mips/linux.h	(working copy)
@@ -134,7 +134,7 @@ extern const char *host_detect_local_cpu
 # define MARCH_MTUNE_NATIVE_SPECS ""
 #endif
 
-#define BASE_DRIVER_SELF_SPECS \
+#define LINUX_DRIVER_SELF_SPECS \
   NO_SHARED_SPECS							\
   MARCH_MTUNE_NATIVE_SPECS,						\
   /* -mplt has no effect without -mno-shared.  Simplify later		\
@@ -142,4 +142,8 @@ extern const char *host_detect_local_cpu
   "%{!mno-shared:%<mplt}",						\
   /* -mplt likewise has no effect for -mabi=64 without -msym32.  */	\
   "%{mabi=64:%{!msym32:%<mplt}}"
-#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
+
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+  BASE_DRIVER_SELF_SPECS, \
+  LINUX_DRIVER_SELF_SPECS
Index: config/mips/elfoabi.h
===================================================================
--- config/mips/elfoabi.h	(revision 141641)
+++ config/mips/elfoabi.h	(working copy)
@@ -19,6 +19,7 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#undef DRIVER_SELF_SPECS
 #define DRIVER_SELF_SPECS						\
   /* Make sure a -mips option is present.  This helps us to pick	\
      the right multilib, and also makes the later specs easier		\
@@ -32,4 +33,8 @@ along with GCC; see the file COPYING3.  
   /* Remove a redundant -mfp64 for -mabi=o64; we want the !mfp64	\
      multilibs.  There's no need to check whether the architecture	\
      is 64-bit; cc1 will complain if it isn't.  */			\
-  "%{mabi=o64: %<mfp64}"
+  "%{mabi=o64: %<mfp64}",						\
+									\
+  /* Target-specific rules.  */						\
+  BASE_DRIVER_SELF_SPECS
+
Index: config/mips/sde.h
===================================================================
--- config/mips/sde.h	(revision 141641)
+++ config/mips/sde.h	(working copy)
@@ -19,6 +19,7 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#undef DRIVER_SELF_SPECS
 #define DRIVER_SELF_SPECS						\
   /* Make sure a -mips option is present.  This helps us to pick	\
      the right multilib, and also makes the later specs easier		\
@@ -46,7 +47,10 @@ along with GCC; see the file COPYING3.  
      The latter trumps the former.  */					\
   "%{mno-data-in-code: -mcode-readable=no}",				\
   "%{!mcode-readable=no: %{mcode-xonly: -mcode-readable=pcrel}}",	\
-  "%<mno-data-in-code %<mcode-xonly"
+  "%<mno-data-in-code %<mcode-xonly",					\
+									\
+  /* Target-specific rules.  */						\
+  BASE_DRIVER_SELF_SPECS				
 
 /* Use trap rather than break for all but MIPS I ISA.  Force -no-mips16,
    so that MIPS16 assembler code requires an explicit ".set mips16".
Index: config/mips/iris6.h
===================================================================
--- config/mips/iris6.h	(revision 141641)
+++ config/mips/iris6.h	(working copy)
@@ -29,9 +29,12 @@ along with GCC; see the file COPYING3.  
 
 /* Force the default ABI onto the command line in order to make the specs
    easier to write.  Default to the mips2 ISA for the O32 ABI.  */
-#define DRIVER_SELF_SPECS \
-  "%{!mabi=*: -mabi=n32}", \
-  "%{mabi=32: %{!mips*: %{!march*: -mips2}}}"
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS 			\
+  "%{!mabi=*: -mabi=n32}", 			\
+  "%{mabi=32: %{!mips*: %{!march*: -mips2}}}", 	\
+  /* Target-specific rules.  */		 	\
+  BASE_DRIVER_SELF_SPECS
 
 /* Force the generation of dwarf .debug_frame sections even if not
    compiling -g.  This guarantees that we can unwind the stack.  */
Index: config/mips/mips.h
===================================================================
--- config/mips/mips.h	(revision 141641)
+++ config/mips/mips.h	(working copy)
@@ -742,6 +742,12 @@ enum mips_code_readable_setting {
   {"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }
 
 
+/* A spec that infers the -mdsp setting from an -march argument.  */
+#define BASE_DRIVER_SELF_SPECS \
+  "%{!mno-dsp:%{march=24ke*|march=34k*|march=74k*: -mdsp}}"
+
+#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
+
 #define GENERATE_DIVIDE_TRAPS (TARGET_DIVIDE_TRAPS \
                                && ISA_HAS_COND_TRAP)
 
Index: config/mips/vr.h
===================================================================
--- config/mips/vr.h	(revision 141641)
+++ config/mips/vr.h	(working copy)
@@ -20,12 +20,15 @@ along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 
 #define DEFAULT_VR_ARCH "mfix-vr4130"
+#undef MIPS_ABI_DEFAULT
 #define MIPS_ABI_DEFAULT ABI_EABI
+#undef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \
 	{ MULTILIB_ENDIAN_DEFAULT,		\
 	  MULTILIB_ABI_DEFAULT,			\
 	  DEFAULT_VR_ARCH }
 
+#undef DRIVER_SELF_SPECS
 #define DRIVER_SELF_SPECS \
 	/* Enforce the default architecture.  This is mostly for	\
 	   the assembler's benefit.  */					\
@@ -51,4 +54,7 @@ along with GCC; see the file COPYING3.  
 	"%{mabi=eabi:%{!mlong*:%{!mgp32:-mlong64}}}",			\
 									\
 	/* Remove -mgp32 if it is redundant.  */			\
-	"%{mabi=32:%<mgp32}"
+	"%{mabi=32:%<mgp32}",						\
+									\
+	/* Target-specific rules.  */					\
+	BASE_DRIVER_SELF_SPECS

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]