diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-20 21:36:35 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-20 21:36:35 +0000 |
commit | b1ff8ab1599b3b2a32fc7aa82166b29a3ac11545 (patch) | |
tree | 42b3a9f5c9abcdac10d9e5260b82f98b6774d984 /gcc/expr.c | |
parent | 10b651251fcb5e44502b9b6196034c6ebbbd5b6f (diff) | |
download | ppe42-gcc-b1ff8ab1599b3b2a32fc7aa82166b29a3ac11545.tar.gz ppe42-gcc-b1ff8ab1599b3b2a32fc7aa82166b29a3ac11545.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42361 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index beafdfdec0f..b654b460d32 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -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))) |