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]

[patch] m68k: Turn off -mstrict-align on ColdFire.


Hi,

Attached is a patch to turn off -mstrict-align on ColdFire as strict
alignment is not required on ColdFire (other than on the stack)
according to Paul Brook and Nathan Sidwell.

The patch implements the idea by removing TARGET_DEFAULT_TARGET_FLAGS
and turning on MASK_STRICT_ALIGNMENT on a non-ColdFire target.  The
reason why I turn it on instead of turning it off on ColdFire targets
is because that's easier.  In m68k.c, we have

  target_flags |= target_mask & ~target_flags_explicit;

a few lines after a bunch of

  target_mask |= blah;

Tested on m68k-elf.  OK to apply?

Kazu Hirata

2007-08-29  Kazu Hirata  <kazu@codesourcery.com>

	* config/m68k/m68k.c (TARGET_DEFAULT_TARGET_FLAGS): Remove.
	(override_options): Turn on -mstrict-align on non-ColdFire
	targets.
	* config/m68k/m68k.h (BIGGEST_ALIGNMENT): Update a comment.

Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c	(revision 127883)
+++ gcc/config/m68k/m68k.c	(working copy)
@@ -185,8 +185,6 @@ int m68k_last_compare_had_fp_operands;
 #undef TARGET_ASM_FILE_START_APP_OFF
 #define TARGET_ASM_FILE_START_APP_OFF true
 
-#undef TARGET_DEFAULT_TARGET_FLAGS
-#define TARGET_DEFAULT_TARGET_FLAGS MASK_STRICT_ALIGNMENT
 #undef TARGET_HANDLE_OPTION
 #define TARGET_HANDLE_OPTION m68k_handle_option
 
@@ -510,6 +508,11 @@ override_options (void)
   /* Use the architecture setting to derive default values for
      certain flags.  */
   target_mask = 0;
+
+  /* ColdFire is lenient about alignment.  */
+  if (!TARGET_COLDFIRE)
+    target_mask |= MASK_STRICT_ALIGNMENT;
+
   if ((m68k_cpu_flags & FL_BITFIELD) != 0)
     target_mask |= MASK_BITFIELD;
   if ((m68k_cpu_flags & FL_CF_HWDIV) != 0)
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h	(revision 127883)
+++ gcc/config/m68k/m68k.h	(working copy)
@@ -305,8 +305,7 @@ along with GCC; see the file COPYING3.  
 /* No data type wants to be aligned rounder than this.
    Most published ABIs say that ints should be aligned on 16-bit
    boundaries, but CPUs with 32-bit busses get better performance
-   aligned on 32-bit boundaries.  ColdFires without a misalignment
-   module require 32-bit alignment.  */
+   aligned on 32-bit boundaries.  */
 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
 
 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)


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