diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2007-08-28 13:51:20 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2007-08-28 13:51:20 +0000 |
commit | 1c445f037f02fcf3e52e1b2cbc80aa38a5c93fd4 (patch) | |
tree | 72aca8403d903709427f44647431177f499ac55c /gcc/config | |
parent | 7f97f938a70df00a44ad2cadc2bc5381e7ea27fa (diff) | |
download | gcc-1c445f037f02fcf3e52e1b2cbc80aa38a5c93fd4.zip gcc-1c445f037f02fcf3e52e1b2cbc80aa38a5c93fd4.tar.gz gcc-1c445f037f02fcf3e52e1b2cbc80aa38a5c93fd4.tar.bz2 |
* gcc/config/m68k/linux.h
(M68K_HONOR_TARGET_STRICT_ALIGNMENT): Redefine as 0.
* config/m68k/m68k.c (TARGET_RETURN_IN_MEMORY): New.
(m68k_return_in_memory): New.
* gcc/config/m68k/m68k.h (M68K_HONOR_TARGET_STRICT_ALIGNMENT):
New.
Co-Authored-By: Kazu Hirata <kazu@codesourcery.com>
From-SVN: r127858
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/m68k/linux.h | 2 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.c | 30 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.h | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h index f09a2c7..cdd510b 100644 --- a/gcc/config/m68k/linux.h +++ b/gcc/config/m68k/linux.h @@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see #undef STRICT_ALIGNMENT #define STRICT_ALIGNMENT 0 +#undef M68K_HONOR_TARGET_STRICT_ALIGNMENT +#define M68K_HONOR_TARGET_STRICT_ALIGNMENT 0 /* Here are four prefixes that are used by asm_fprintf to facilitate customization for alternate assembler syntaxes. diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 395161f..2b06b6c 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -134,6 +134,9 @@ static void m68k_compute_frame_layout (void); static bool m68k_save_reg (unsigned int regno, bool interrupt_handler); static bool m68k_ok_for_sibcall_p (tree, tree); static bool m68k_rtx_costs (rtx, int, int, int *); +#if M68K_HONOR_TARGET_STRICT_ALIGNMENT +static bool m68k_return_in_memory (tree, tree); +#endif /* Specify the identification number of the library being built */ @@ -205,6 +208,11 @@ int m68k_last_compare_had_fp_operands; #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL m68k_ok_for_sibcall_p +#if M68K_HONOR_TARGET_STRICT_ALIGNMENT +#undef TARGET_RETURN_IN_MEMORY +#define TARGET_RETURN_IN_MEMORY m68k_return_in_memory +#endif + static const struct attribute_spec m68k_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ @@ -4386,3 +4394,25 @@ m68k_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED) else return gen_rtx_REG (mode, D0_REG); } + +/* Worker function for TARGET_RETURN_IN_MEMORY. */ +#if M68K_HONOR_TARGET_STRICT_ALIGNMENT +static bool +m68k_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED) +{ + enum machine_mode mode = TYPE_MODE (type); + + if (mode == BLKmode) + return true; + + /* If TYPE's known alignment is less than the alignment of MODE that + would contain the structure, then return in memory. We need to + do so to maintain the compatibility between code compiled with + -mstrict-align and that compiled with -mno-strict-align. */ + if (AGGREGATE_TYPE_P (type) + && TYPE_ALIGN (type) < GET_MODE_ALIGNMENT (mode)) + return true; + + return false; +} +#endif diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 75d6d6a..a5f6eed 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -310,6 +310,7 @@ along with GCC; see the file COPYING3. If not see #define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16) #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT) +#define M68K_HONOR_TARGET_STRICT_ALIGNMENT 1 #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32) |