Commit cb5fa0f8 by Richard Kenner Committed by Richard Kenner

expr.c (expand_expr, [...]): Don't fold constant access if EXPAND_CONST_ADDRESS…

expr.c (expand_expr, [...]): Don't fold constant access if EXPAND_CONST_ADDRESS or EXPAND_INITIALIZER.

	* expr.c (expand_expr, case ARRAY_REF): Don't fold constant
	access if EXPAND_CONST_ADDRESS or EXPAND_INITIALIZER.
	(expand_expr, case COMPONENT_REF): Do copy if misaligned even
	if EXPAND_CONST_ADDRESS or EXPAND_INITIALIZER.

From-SVN: r42361
parent eabb9ed0
Sun May 20 16:39:24 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sun May 20 16:39:24 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (expand_expr, case ARRAY_REF): Don't fold constant
access if EXPAND_CONST_ADDRESS or EXPAND_INITIALIZER.
(expand_expr, case COMPONENT_REF): Do copy if misaligned even
if EXPAND_CONST_ADDRESS or EXPAND_INITIALIZER.
* stmt.c (expand_decl): Set mode, alignment, and sizes for CONST_DECL. * stmt.c (expand_decl): Set mode, alignment, and sizes for CONST_DECL.
2001-05-20 Richard Henderson <rth@redhat.com> 2001-05-20 Richard Henderson <rth@redhat.com>
......
...@@ -6828,7 +6828,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6828,7 +6828,8 @@ expand_expr (exp, target, tmode, modifier)
Don't fold if this is for wide characters since it's too Don't fold if this is for wide characters since it's too
difficult to do correctly and this is a very rare case. */ difficult to do correctly and this is a very rare case. */
if (TREE_CODE (array) == STRING_CST if (modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_INITIALIZER
&& TREE_CODE (array) == STRING_CST
&& TREE_CODE (index) == INTEGER_CST && TREE_CODE (index) == INTEGER_CST
&& compare_tree_int (index, TREE_STRING_LENGTH (array)) < 0 && compare_tree_int (index, TREE_STRING_LENGTH (array)) < 0
&& GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_CLASS (mode) == MODE_INT
...@@ -6841,7 +6842,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6841,7 +6842,8 @@ expand_expr (exp, target, tmode, modifier)
we have an explicit constructor and when our operand is a variable we have an explicit constructor and when our operand is a variable
that was declared const. */ that was declared const. */
if (TREE_CODE (array) == CONSTRUCTOR && ! TREE_SIDE_EFFECTS (array) if (modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_INITIALIZER
&& TREE_CODE (array) == CONSTRUCTOR && ! TREE_SIDE_EFFECTS (array)
&& TREE_CODE (index) == INTEGER_CST && TREE_CODE (index) == INTEGER_CST
&& 0 > compare_tree_int (index, && 0 > compare_tree_int (index,
list_length (CONSTRUCTOR_ELTS list_length (CONSTRUCTOR_ELTS
...@@ -6860,6 +6862,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6860,6 +6862,8 @@ expand_expr (exp, target, tmode, modifier)
} }
else if (optimize >= 1 else if (optimize >= 1
&& modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER
&& TREE_READONLY (array) && ! TREE_SIDE_EFFECTS (array) && TREE_READONLY (array) && ! TREE_SIDE_EFFECTS (array)
&& TREE_CODE (array) == VAR_DECL && DECL_INITIAL (array) && TREE_CODE (array) == VAR_DECL && DECL_INITIAL (array)
&& TREE_CODE (DECL_INITIAL (array)) != ERROR_MARK) && TREE_CODE (DECL_INITIAL (array)) != ERROR_MARK)
...@@ -7102,34 +7106,28 @@ expand_expr (exp, target, tmode, modifier) ...@@ -7102,34 +7106,28 @@ expand_expr (exp, target, tmode, modifier)
an integer-mode (e.g., SImode) object. Handle this case an integer-mode (e.g., SImode) object. Handle this case
by doing the extract into an object as wide as the field by doing the extract into an object as wide as the field
(which we know to be the width of a basic mode), then (which we know to be the width of a basic mode), then
storing into memory, and changing the mode to BLKmode. storing into memory, and changing the mode to BLKmode. */
If we ultimately want the address (EXPAND_CONST_ADDRESS or
EXPAND_INITIALIZER), then we must not copy to a temporary. */
if (mode1 == VOIDmode if (mode1 == VOIDmode
|| GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG
|| (modifier != EXPAND_CONST_ADDRESS || (mode1 != BLKmode && ! direct_load[(int) mode1]
&& modifier != EXPAND_INITIALIZER && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
&& ((mode1 != BLKmode && ! direct_load[(int) mode1] && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_INT /* If the field isn't aligned enough to fetch as a memref,
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT) fetch it as a bit field. */
/* If the field isn't aligned enough to fetch as a memref, || (mode1 != BLKmode
fetch it as a bit field. */ && SLOW_UNALIGNED_ACCESS (mode1, alignment)
|| (mode1 != BLKmode && ((TYPE_ALIGN (TREE_TYPE (tem))
&& SLOW_UNALIGNED_ACCESS (mode1, alignment) < GET_MODE_ALIGNMENT (mode))
&& ((TYPE_ALIGN (TREE_TYPE (tem)) || (bitpos % GET_MODE_ALIGNMENT (mode) != 0)))
< GET_MODE_ALIGNMENT (mode)) /* If the type and the field are a constant size and the
|| (bitpos % GET_MODE_ALIGNMENT (mode) != 0))) size of the type isn't the same size as the bitfield,
/* If the type and the field are a constant size and the we must use bitfield operations. */
size of the type isn't the same size as the bitfield, || (bitsize >= 0
we must use bitfield operations. */ && (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp)))
|| ((bitsize >= 0 == INTEGER_CST)
&& (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) && 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)),
== INTEGER_CST) bitsize))
&& 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), || (mode == BLKmode
bitsize)))))
|| (modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER
&& mode == BLKmode
&& SLOW_UNALIGNED_ACCESS (mode, alignment) && SLOW_UNALIGNED_ACCESS (mode, alignment)
&& (TYPE_ALIGN (type) > alignment && (TYPE_ALIGN (type) > alignment
|| bitpos % TYPE_ALIGN (type) != 0))) || bitpos % TYPE_ALIGN (type) != 0)))
......
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