aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2019-08-28 10:18:23 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2019-08-28 10:18:23 +0000
commit70cdb21e579191fe9f0f1d45e328908e59c0179e (patch)
tree87bd6c87d5f7ac587e7732bc7828111ec593e9ed /gcc/expr.c
parente62506f36294bc26b9a64bcfd2464464ef784b72 (diff)
downloadgcc-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/expr.c')
-rw-r--r--gcc/expr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 5ca0e20..022b571 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5001,9 +5001,10 @@ expand_assignment (tree to, tree from, bool nontemporal)
/* Handle misaligned stores. */
mode = TYPE_MODE (TREE_TYPE (to));
if ((TREE_CODE (to) == MEM_REF
- || TREE_CODE (to) == TARGET_MEM_REF)
+ || TREE_CODE (to) == TARGET_MEM_REF
+ || DECL_P (to))
&& mode != BLKmode
- && !mem_ref_refers_to_non_mem_p (to)
+ && (DECL_P (to) || !mem_ref_refers_to_non_mem_p (to))
&& ((align = get_object_alignment (to))
< GET_MODE_ALIGNMENT (mode))
&& (((icode = optab_handler (movmisalign_optab, mode))
@@ -10795,6 +10796,14 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
MEM_VOLATILE_P (op0) = 1;
}
+ if (MEM_P (op0) && TREE_CODE (tem) == FUNCTION_DECL)
+ {
+ if (op0 == orig_op0)
+ op0 = copy_rtx (op0);
+
+ set_mem_align (op0, BITS_PER_UNIT);
+ }
+
/* In cases where an aligned union has an unaligned object
as a field, we might be extracting a BLKmode value from
an integer-mode (e.g., SImode) object. Handle this case