Commit c952ff4b by Richard Kenner Committed by Richard Kenner

expr.c (expand_expr, [...]): Refine test for when to copy misaligned data.

	* expr.c (expand_expr, case ADDR_EXPR): Refine test for when to
	copy misaligned data.
	* varasm.c (assemble_variable): Set alignment into MEM when changed.

From-SVN: r47089
parent f4dc10d1
Fri Nov 16 09:06:25 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (expand_expr, case ADDR_EXPR): Refine test for when to
copy misaligned data.
* varasm.c (assemble_variable): Set alignment into MEM when changed.
2001-11-16 Graham Stott <grahams@redhat.com> 2001-11-16 Graham Stott <grahams@redhat.com>
* optabs.c (prepare_cmp_insn): Correct lossage in last change fix * optabs.c (prepare_cmp_insn): Correct lossage in last change fix
......
...@@ -8649,11 +8649,19 @@ expand_expr (exp, target, tmode, modifier) ...@@ -8649,11 +8649,19 @@ expand_expr (exp, target, tmode, modifier)
return op0; return op0;
} }
/* If OP0 is not aligned as least as much as the type requires, /* If OP0 is not aligned as least as much as the type requires, we
we need to make a temporary, copy OP0 to it, and take the need to make a temporary, copy OP0 to it, and take the address of
address of the temporary. */ the temporary. We want to use the alignment of the type, not of
if (GET_MODE (op0) == BLKmode the operand. Note that this is incorrect for FUNCTION_TYPE, but
&& expr_align (TREE_OPERAND (exp, 0)) > MEM_ALIGN (op0)) the test for BLKmode means that can't happen. The test for
BLKmode is because we never make mis-aligned MEMs with
non-BLKmode.
We don't need to do this at all if the machine doesn't have
strict alignment. */
if (STRICT_ALIGNMENT && GET_MODE (op0) == BLKmode
&& (TYPE_ALIGN (TREE_TYPE (TREE_OPERAND (exp, 0)))
> MEM_ALIGN (op0)))
{ {
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0)); tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
rtx new rtx new
......
...@@ -1615,6 +1615,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data) ...@@ -1615,6 +1615,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
/* Reset the alignment in case we have made it tighter, so we can benefit /* Reset the alignment in case we have made it tighter, so we can benefit
from it in get_pointer_alignment. */ from it in get_pointer_alignment. */
DECL_ALIGN (decl) = align; DECL_ALIGN (decl) = align;
set_mem_align (decl_rtl, align);
/* Handle uninitialized definitions. */ /* Handle uninitialized definitions. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment