diff options
author | Christian Bruel <christian.bruel@st.com> | 2015-10-16 15:37:14 +0200 |
---|---|---|
committer | Christian Bruel <chrbr@gcc.gnu.org> | 2015-10-16 15:37:14 +0200 |
commit | f66a9a76137456a12b3720add7b9b2c3bbcfff3f (patch) | |
tree | e49fc7000143d5cca7ec5d9fd4d426118d5709c5 /gcc/config/arm | |
parent | 2346b8064304115b851646532e1738d4afdc89b8 (diff) | |
download | gcc-f66a9a76137456a12b3720add7b9b2c3bbcfff3f.zip gcc-f66a9a76137456a12b3720add7b9b2c3bbcfff3f.tar.gz gcc-f66a9a76137456a12b3720add7b9b2c3bbcfff3f.tar.bz2 |
re PR target/67745 ([ARM] wrong alignments when __attribute__ ((optimize,target,align) is used)
2015-10-16 Christian Bruel <christian.bruel@st.com>
PR target/67745
* config/arm/arm.h (FUNCTION_BOUNDARY): Move optimize_size condition to:
* config/arm/arm.c (arm_option_override_internal): Call
arm_override_options_after_change_1.
(arm_override_options_after_change): New function.
(arm_override_options_after_change_1): Likewise.
(TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): Define hook.
From-SVN: r228904
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/arm.c | 22 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 0bf1164..2c8215c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -246,6 +246,7 @@ static tree arm_build_builtin_va_list (void); static void arm_expand_builtin_va_start (tree, rtx); static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static void arm_option_override (void); +static void arm_override_options_after_change (void); static void arm_option_print (FILE *, int, struct cl_target_option *); static void arm_set_current_function (tree); static bool arm_can_inline_p (tree, tree); @@ -407,6 +408,9 @@ static const struct attribute_spec arm_attribute_table[] = #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE arm_option_override +#undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE +#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE arm_override_options_after_change + #undef TARGET_OPTION_PRINT #define TARGET_OPTION_PRINT arm_option_print @@ -2810,11 +2814,29 @@ static GTY(()) bool thumb_flipper; /* Options after initial target override. */ static GTY(()) tree init_optimize; +static void +arm_override_options_after_change_1 (struct gcc_options *opts) +{ + if (opts->x_align_functions <= 0) + opts->x_align_functions = TARGET_THUMB_P (opts->x_target_flags) + && opts->x_optimize_size ? 2 : 4; +} + +/* Implement targetm.override_options_after_change. */ + +static void +arm_override_options_after_change (void) +{ + arm_override_options_after_change_1 (&global_options); +} + /* Reset options between modes that the user has specified. */ static void arm_option_override_internal (struct gcc_options *opts, struct gcc_options *opts_set) { + arm_override_options_after_change_1 (opts); + if (TARGET_THUMB_P (opts->x_target_flags) && !(ARM_FSET_HAS_CPU1 (insn_flags, FL_THUMB))) { diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 87c9f90..9715969 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -565,7 +565,7 @@ extern int arm_arch_crc; #define PREFERRED_STACK_BOUNDARY \ (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY) -#define FUNCTION_BOUNDARY ((TARGET_THUMB && optimize_size) ? 16 : 32) +#define FUNCTION_BOUNDARY (TARGET_THUMB ? 16 : 32) /* The lowest bit is used to indicate Thumb-mode functions, so the vbit must go into the delta field of pointers to member |