Commit c3d32120 by Richard Kenner Committed by Richard Kenner

tree.h (TYPE_ALIGN_OK): New flag.

	* tree.h (TYPE_ALIGN_OK): New flag.
	* emit-rtl.c (set_mem_attributes): Handle it.
	* expr.c (emit_single_push_insn): Only set to alias set 0 if
	doing sibcall optimization.
	(expand_expr, case COMPONENT_REF): Call set_mem_attributes on case
	when make temporary.
	(expand_expr, case CONVERT_EXPR): Simplify convert-to-union case.
	(expand_expr, case ADDR_EXPR): Abort if TYPE_ALIGN_OK and need copy.

From-SVN: r47149
parent 69deb6e0
Sun Nov 18 14:13:52 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sun Nov 18 14:13:52 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree.h (TYPE_ALIGN_OK): New flag.
* emit-rtl.c (set_mem_attributes): Handle it.
* expr.c (emit_single_push_insn): Only set to alias set 0 if
doing sibcall optimization.
(expand_expr, case COMPONENT_REF): Call set_mem_attributes on case
when make temporary.
(expand_expr, case CONVERT_EXPR): Simplify convert-to-union case.
(expand_expr, case ADDR_EXPR): Abort if TYPE_ALIGN_OK and need copy.
* sdbout.c (sdbout_symbol): Avoid warning due to &DECL_RTL. * sdbout.c (sdbout_symbol): Avoid warning due to &DECL_RTL.
2001-11-18 Joseph S. Myers <jsm28@cam.ac.uk> 2001-11-18 Joseph S. Myers <jsm28@cam.ac.uk>
......
...@@ -1699,10 +1699,10 @@ set_mem_attributes (ref, t, objectp) ...@@ -1699,10 +1699,10 @@ set_mem_attributes (ref, t, objectp)
if ((objectp || DECL_P (t)) && ! AGGREGATE_TYPE_P (type)) if ((objectp || DECL_P (t)) && ! AGGREGATE_TYPE_P (type))
MEM_SCALAR_P (ref) = 1; MEM_SCALAR_P (ref) = 1;
/* We can set the alignment from the type if we are makign an object or /* We can set the alignment from the type if we are making an object,
if this is an INDIRECT_REF. */ this is an INDIRECT_REF, or if TYPE_ALIGN_OK. */
if (objectp || TREE_CODE (t) == INDIRECT_REF) if (objectp || TREE_CODE (t) == INDIRECT_REF || TYPE_ALIGN_OK (type))
align = TYPE_ALIGN (type); align = MAX (align, TYPE_ALIGN (type));
/* If the size is known, we can set that. */ /* If the size is known, we can set that. */
if (TYPE_SIZE_UNIT (type) && host_integerp (TYPE_SIZE_UNIT (type), 1)) if (TYPE_SIZE_UNIT (type) && host_integerp (TYPE_SIZE_UNIT (type), 1))
......
...@@ -3199,6 +3199,8 @@ emit_single_push_insn (mode, x, type) ...@@ -3199,6 +3199,8 @@ emit_single_push_insn (mode, x, type)
if (type != 0) if (type != 0)
{ {
set_mem_attributes (dest, type, 1); set_mem_attributes (dest, type, 1);
if (flag_optimize_sibling_calls)
/* Function incoming arguments may overlap with sibling call /* Function incoming arguments may overlap with sibling call
outgoing arguments and we cannot allow reordering of reads outgoing arguments and we cannot allow reordering of reads
from function arguments with stores to outgoing arguments from function arguments with stores to outgoing arguments
...@@ -7180,13 +7182,14 @@ expand_expr (exp, target, tmode, modifier) ...@@ -7180,13 +7182,14 @@ expand_expr (exp, target, tmode, modifier)
if (mode == BLKmode) if (mode == BLKmode)
{ {
tree nt = build_qualified_type (type_for_mode (ext_mode, 0), rtx new = assign_temp (build_qualified_type
TYPE_QUAL_CONST); (type_for_mode (ext_mode, 0),
rtx new = assign_temp (nt, 0, 1, 1); TYPE_QUAL_CONST), 0, 1, 1);
emit_move_insn (new, op0); emit_move_insn (new, op0);
op0 = copy_rtx (new); op0 = copy_rtx (new);
PUT_MODE (op0, BLKmode); PUT_MODE (op0, BLKmode);
set_mem_attributes (op0, exp, 1);
} }
return op0; return op0;
...@@ -7423,15 +7426,18 @@ expand_expr (exp, target, tmode, modifier) ...@@ -7423,15 +7426,18 @@ expand_expr (exp, target, tmode, modifier)
{ {
tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0)); tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0));
/* If both input and output are BLKmode, this conversion /* If both input and output are BLKmode, this conversion isn't doing
isn't actually doing anything unless we need to make the anything except possibly changing memory attribute. */
alignment stricter. */ if (mode == BLKmode && TYPE_MODE (valtype) == BLKmode)
if (mode == BLKmode && TYPE_MODE (valtype) == BLKmode {
&& (TYPE_ALIGN (type) <= TYPE_ALIGN (valtype) rtx result = expand_expr (TREE_OPERAND (exp, 0), target, tmode,
|| TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT))
return expand_expr (TREE_OPERAND (exp, 0), target, tmode,
modifier); modifier);
result = copy_rtx (result);
set_mem_attributes (result, exp, 0);
return result;
}
if (target == 0) if (target == 0)
target = assign_temp (type, 0, 1, 1); target = assign_temp (type, 0, 1, 1);
...@@ -8673,6 +8679,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -8673,6 +8679,9 @@ expand_expr (exp, target, tmode, modifier)
(TYPE_QUALS (inner_type) (TYPE_QUALS (inner_type)
| TYPE_QUAL_CONST))); | TYPE_QUAL_CONST)));
if (TYPE_ALIGN_OK (inner_type))
abort ();
emit_block_move (new, op0, expr_size (TREE_OPERAND (exp, 0))); emit_block_move (new, op0, expr_size (TREE_OPERAND (exp, 0)));
op0 = new; op0 = new;
} }
......
...@@ -596,6 +596,14 @@ extern void tree_class_check_failed PARAMS ((const tree, int, ...@@ -596,6 +596,14 @@ extern void tree_class_check_failed PARAMS ((const tree, int,
an exception. In a CALL_EXPR, nonzero means the call cannot throw. */ an exception. In a CALL_EXPR, nonzero means the call cannot throw. */
#define TREE_NOTHROW(NODE) ((NODE)->common.nothrow_flag) #define TREE_NOTHROW(NODE) ((NODE)->common.nothrow_flag)
/* In a type, nonzero means that all objects of the type are guaranteed by the
language or front-end to be properly aligned, so we can indicate that a MEM
of this type is aligned at least to the alignment of the type, even if it
doesn't appear that it is. We see this, for example, in object-oriented
languages where a tag field may show this is an object of a more-aligned
variant of the more generic type. */
#define TYPE_ALIGN_OK(NODE) (TYPE_CHECK (NODE)->common.nothrow_flag)
/* Used in classes in C++. */ /* Used in classes in C++. */
#define TREE_PRIVATE(NODE) ((NODE)->common.private_flag) #define TREE_PRIVATE(NODE) ((NODE)->common.private_flag)
/* Used in classes in C++. /* Used in classes in C++.
......
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