diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2001-05-20 21:36:35 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2001-05-20 17:36:35 -0400 |
commit | cb5fa0f8ea731239b4e5927b9b9c668854d9fd68 (patch) | |
tree | 42b3a9f5c9abcdac10d9e5260b82f98b6774d984 /gcc | |
parent | eabb9ed02da2738eb1fa31cc0d1d99a84cb0b713 (diff) | |
download | gcc-cb5fa0f8ea731239b4e5927b9b9c668854d9fd68.zip gcc-cb5fa0f8ea731239b4e5927b9b9c668854d9fd68.tar.gz gcc-cb5fa0f8ea731239b4e5927b9b9c668854d9fd68.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expr.c | 54 |
2 files changed, 31 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c791d46..03a594c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 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. 2001-05-20 Richard Henderson <rth@redhat.com> @@ -6828,7 +6828,8 @@ expand_expr (exp, target, tmode, modifier) Don't fold if this is for wide characters since it's too 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 && compare_tree_int (index, TREE_STRING_LENGTH (array)) < 0 && GET_MODE_CLASS (mode) == MODE_INT @@ -6841,7 +6842,8 @@ expand_expr (exp, target, tmode, modifier) we have an explicit constructor and when our operand is a variable 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 && 0 > compare_tree_int (index, list_length (CONSTRUCTOR_ELTS @@ -6860,6 +6862,8 @@ expand_expr (exp, target, tmode, modifier) } else if (optimize >= 1 + && modifier != EXPAND_CONST_ADDRESS + && modifier != EXPAND_INITIALIZER && TREE_READONLY (array) && ! TREE_SIDE_EFFECTS (array) && TREE_CODE (array) == VAR_DECL && DECL_INITIAL (array) && TREE_CODE (DECL_INITIAL (array)) != ERROR_MARK) @@ -7102,34 +7106,28 @@ expand_expr (exp, target, tmode, modifier) an integer-mode (e.g., SImode) object. Handle this case by doing the extract into an object as wide as the field (which we know to be the width of a basic mode), then - 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. */ + storing into memory, and changing the mode to BLKmode. */ if (mode1 == VOIDmode || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG - || (modifier != EXPAND_CONST_ADDRESS - && modifier != EXPAND_INITIALIZER - && ((mode1 != BLKmode && ! direct_load[(int) mode1] - && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT - && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT) - /* If the field isn't aligned enough to fetch as a memref, - fetch it as a bit field. */ - || (mode1 != BLKmode - && SLOW_UNALIGNED_ACCESS (mode1, alignment) - && ((TYPE_ALIGN (TREE_TYPE (tem)) - < GET_MODE_ALIGNMENT (mode)) - || (bitpos % GET_MODE_ALIGNMENT (mode) != 0))) - /* If the type and the field are a constant size and the - size of the type isn't the same size as the bitfield, - we must use bitfield operations. */ - || ((bitsize >= 0 - && (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) - == INTEGER_CST) - && 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), - bitsize))))) - || (modifier != EXPAND_CONST_ADDRESS - && modifier != EXPAND_INITIALIZER - && mode == BLKmode + || (mode1 != BLKmode && ! direct_load[(int) mode1] + && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT + && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT) + /* If the field isn't aligned enough to fetch as a memref, + fetch it as a bit field. */ + || (mode1 != BLKmode + && SLOW_UNALIGNED_ACCESS (mode1, alignment) + && ((TYPE_ALIGN (TREE_TYPE (tem)) + < GET_MODE_ALIGNMENT (mode)) + || (bitpos % GET_MODE_ALIGNMENT (mode) != 0))) + /* If the type and the field are a constant size and the + size of the type isn't the same size as the bitfield, + we must use bitfield operations. */ + || (bitsize >= 0 + && (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) + == INTEGER_CST) + && 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), + bitsize)) + || (mode == BLKmode && SLOW_UNALIGNED_ACCESS (mode, alignment) && (TYPE_ALIGN (type) > alignment || bitpos % TYPE_ALIGN (type) != 0))) |