diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2019-08-28 10:18:23 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2019-08-28 10:18:23 +0000 |
commit | 70cdb21e579191fe9f0f1d45e328908e59c0179e (patch) | |
tree | 87bd6c87d5f7ac587e7732bc7828111ec593e9ed /gcc/function.c | |
parent | e62506f36294bc26b9a64bcfd2464464ef784b72 (diff) | |
download | gcc-70cdb21e579191fe9f0f1d45e328908e59c0179e.zip gcc-70cdb21e579191fe9f0f1d45e328908e59c0179e.tar.gz gcc-70cdb21e579191fe9f0f1d45e328908e59c0179e.tar.bz2 |
expr.c (expand_assignment): Handle misaligned DECLs.
2019-09-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
Richard Biener <rguenther@suse.de>
* expr.c (expand_assignment): Handle misaligned DECLs.
(expand_expr_real_1): Handle FUNCTION_DECL as unaligned.
* function.c (assign_parm_adjust_stack_rtl): Check movmisalign optab
too.
(assign_parm_setup_stack): Allocate properly aligned stack slots.
* varasm.c (build_constant_desc): Align constants of misaligned types.
* config/arm/predicates.md (aligned_operand): New predicate.
* config/arm/arm.md (movdi, movsi, movhi, movhf, movsf, movdf): Use
aligned_operand to check restrictions on memory addresses.
* config/arm/neon.md (movti, mov<VSTRUCT>, mov<VH>): Likewise.
* config/arm/vec-common.md (mov<VALL>): Likewise.
Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r274986
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/function.c b/gcc/function.c index 05241a3..751d2de3 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2807,8 +2807,10 @@ assign_parm_adjust_stack_rtl (struct assign_parm_data_one *data) stack slot, if we need one. */ if (stack_parm && ((GET_MODE_ALIGNMENT (data->nominal_mode) > MEM_ALIGN (stack_parm) - && targetm.slow_unaligned_access (data->nominal_mode, - MEM_ALIGN (stack_parm))) + && ((optab_handler (movmisalign_optab, data->nominal_mode) + != CODE_FOR_nothing) + || targetm.slow_unaligned_access (data->nominal_mode, + MEM_ALIGN (stack_parm)))) || (data->nominal_type && TYPE_ALIGN (data->nominal_type) > MEM_ALIGN (stack_parm) && MEM_ALIGN (stack_parm) < PREFERRED_STACK_BOUNDARY))) @@ -3461,11 +3463,20 @@ assign_parm_setup_stack (struct assign_parm_data_all *all, tree parm, int align = STACK_SLOT_ALIGNMENT (data->arg.type, GET_MODE (data->entry_parm), TYPE_ALIGN (data->arg.type)); + if (align < (int)GET_MODE_ALIGNMENT (GET_MODE (data->entry_parm)) + && ((optab_handler (movmisalign_optab, + GET_MODE (data->entry_parm)) + != CODE_FOR_nothing) + || targetm.slow_unaligned_access (GET_MODE (data->entry_parm), + align))) + align = GET_MODE_ALIGNMENT (GET_MODE (data->entry_parm)); data->stack_parm = assign_stack_local (GET_MODE (data->entry_parm), GET_MODE_SIZE (GET_MODE (data->entry_parm)), align); + align = MEM_ALIGN (data->stack_parm); set_mem_attributes (data->stack_parm, parm, 1); + set_mem_align (data->stack_parm, align); } dest = validize_mem (copy_rtx (data->stack_parm)); |