diff options
author | Jan Hubicka <jh@suse.cz> | 2002-09-08 12:41:20 +0200 |
---|---|---|
committer | Andreas Jaeger <aj@gcc.gnu.org> | 2002-09-08 12:41:20 +0200 |
commit | 2567406a17362fdf2f3b7150d1c006b87c63ee1f (patch) | |
tree | 55dd83715af1de496408e6e73457d8b79a04f206 /gcc/emit-rtl.c | |
parent | 6bb72ea0be35697c3317b4f558bb378f5331a646 (diff) | |
download | gcc-2567406a17362fdf2f3b7150d1c006b87c63ee1f.zip gcc-2567406a17362fdf2f3b7150d1c006b87c63ee1f.tar.gz gcc-2567406a17362fdf2f3b7150d1c006b87c63ee1f.tar.bz2 |
emit-rtl.c (set_mem_attributes_minus_bitpos): Fix array_ref handling.
2002-09-08 Jan Hubicka <jh@suse.cz>
* emit-rtl.c (set_mem_attributes_minus_bitpos): Fix array_ref
handling.
* loop.c (loop_gics_reduce): Emit addition after.
From-SVN: r56950
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index cf138d3..e94fc4ec 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1805,11 +1805,36 @@ set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos) do { + tree index = TREE_OPERAND (t, 1); + tree array = TREE_OPERAND (t, 0); + tree domain = TYPE_DOMAIN (TREE_TYPE (array)); + tree low_bound = (domain ? TYPE_MIN_VALUE (domain) : 0); + tree unit_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array))); + + /* We assume all arrays have sizes that are a multiple of a byte. + First subtract the lower bound, if any, in the type of the + index, then convert to sizetype and multiply by the size of the + array element. */ + if (low_bound != 0 && ! integer_zerop (low_bound)) + index = fold (build (MINUS_EXPR, TREE_TYPE (index), + index, low_bound)); + + /* If the index has a self-referential type, pass it to a + WITH_RECORD_EXPR; if the component size is, pass our + component to one. */ + if (! TREE_CONSTANT (index) + && contains_placeholder_p (index)) + index = build (WITH_RECORD_EXPR, TREE_TYPE (index), index, t); + if (! TREE_CONSTANT (unit_size) + && contains_placeholder_p (unit_size)) + unit_size = build (WITH_RECORD_EXPR, sizetype, + unit_size, array); + off_tree = fold (build (PLUS_EXPR, sizetype, fold (build (MULT_EXPR, sizetype, - TREE_OPERAND (t, 1), - TYPE_SIZE_UNIT (TREE_TYPE (t)))), + index, + unit_size)), off_tree)); t = TREE_OPERAND (t, 0); } |