Commit c21c775a by Richard Guenther Committed by Richard Biener

tree-dfa.c (get_ref_base_and_extent): Replace bit_offset and computations with…

tree-dfa.c (get_ref_base_and_extent): Replace bit_offset and computations with it with a HOST_WIDE_INT variable.

2007-03-27  Richard Guenther  <rguenther@suse.de>

	* tree-dfa.c (get_ref_base_and_extent): Replace bit_offset and
	computations with it with a HOST_WIDE_INT variable.

From-SVN: r123259
parent 3761d39c
2007-03-27 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (get_ref_base_and_extent): Replace bit_offset and
computations with it with a HOST_WIDE_INT variable.
2007-03-26 Mike Stump <mrs@apple.com> 2007-03-26 Mike Stump <mrs@apple.com>
* config/rs6000/darwin.h (DARWIN_MINVERSION_SPEC): Add * config/rs6000/darwin.h (DARWIN_MINVERSION_SPEC): Add
......
...@@ -859,7 +859,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -859,7 +859,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
HOST_WIDE_INT bitsize = -1; HOST_WIDE_INT bitsize = -1;
HOST_WIDE_INT maxsize = -1; HOST_WIDE_INT maxsize = -1;
tree size_tree = NULL_TREE; tree size_tree = NULL_TREE;
tree bit_offset = bitsize_zero_node; HOST_WIDE_INT bit_offset = 0;
bool seen_variable_array_ref = false; bool seen_variable_array_ref = false;
gcc_assert (!SSA_VAR_P (exp)); gcc_assert (!SSA_VAR_P (exp));
...@@ -896,8 +896,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -896,8 +896,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
case BIT_FIELD_REF: case BIT_FIELD_REF:
bit_offset = size_binop (PLUS_EXPR, bit_offset, bit_offset += tree_low_cst (TREE_OPERAND (exp, 2), 1);
TREE_OPERAND (exp, 2));
break; break;
case COMPONENT_REF: case COMPONENT_REF:
...@@ -907,14 +906,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -907,14 +906,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (this_offset && TREE_CODE (this_offset) == INTEGER_CST) if (this_offset && TREE_CODE (this_offset) == INTEGER_CST)
{ {
this_offset = size_binop (MULT_EXPR, HOST_WIDE_INT hthis_offset = tree_low_cst (this_offset, 1);
fold_convert (bitsizetype,
this_offset), hthis_offset *= BITS_PER_UNIT;
bitsize_unit_node); bit_offset += hthis_offset;
bit_offset = size_binop (PLUS_EXPR, bit_offset += tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1);
bit_offset, this_offset);
bit_offset = size_binop (PLUS_EXPR, bit_offset,
DECL_FIELD_BIT_OFFSET (field));
} }
else else
{ {
...@@ -925,8 +921,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -925,8 +921,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (maxsize != -1 if (maxsize != -1
&& csize && host_integerp (csize, 1)) && csize && host_integerp (csize, 1))
{ {
maxsize = (TREE_INT_CST_LOW (csize) maxsize = (TREE_INT_CST_LOW (csize) - bit_offset);
- TREE_INT_CST_LOW (bit_offset));
} }
else else
maxsize = -1; maxsize = -1;
...@@ -941,17 +936,17 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -941,17 +936,17 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
tree low_bound = array_ref_low_bound (exp); tree low_bound = array_ref_low_bound (exp);
tree unit_size = array_ref_element_size (exp); tree unit_size = array_ref_element_size (exp);
if (! integer_zerop (low_bound)) /* If the resulting bit-offset is constant, track it. */
index = fold_build2 (MINUS_EXPR, TREE_TYPE (index), if (host_integerp (index, 0)
index, low_bound); && host_integerp (low_bound, 0)
index = size_binop (MULT_EXPR, && host_integerp (unit_size, 1))
fold_convert (sizetype, index), unit_size);
if (TREE_CODE (index) == INTEGER_CST)
{ {
index = size_binop (MULT_EXPR, HOST_WIDE_INT hindex = tree_low_cst (index, 0);
fold_convert (bitsizetype, index),
bitsize_unit_node); hindex -= tree_low_cst (low_bound, 0);
bit_offset = size_binop (PLUS_EXPR, bit_offset, index); hindex *= tree_low_cst (unit_size, 1);
hindex *= BITS_PER_UNIT;
bit_offset += hindex;
/* An array ref with a constant index up in the structure /* An array ref with a constant index up in the structure
hierarchy will constrain the size of any variable array ref hierarchy will constrain the size of any variable array ref
...@@ -967,8 +962,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -967,8 +962,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (maxsize != -1 if (maxsize != -1
&& asize && host_integerp (asize, 1)) && asize && host_integerp (asize, 1))
{ {
maxsize = (TREE_INT_CST_LOW (asize) maxsize = (TREE_INT_CST_LOW (asize) - bit_offset);
- TREE_INT_CST_LOW (bit_offset));
} }
else else
maxsize = -1; maxsize = -1;
...@@ -984,8 +978,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -984,8 +978,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
break; break;
case IMAGPART_EXPR: case IMAGPART_EXPR:
bit_offset = size_binop (PLUS_EXPR, bit_offset, bit_offset += bitsize;
bitsize_int (bitsize));
break; break;
case VIEW_CONVERT_EXPR: case VIEW_CONVERT_EXPR:
...@@ -1011,14 +1004,14 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, ...@@ -1011,14 +1004,14 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (seen_variable_array_ref if (seen_variable_array_ref
&& maxsize != -1 && maxsize != -1
&& host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1) && host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
&& TREE_INT_CST_LOW (bit_offset) + maxsize && bit_offset + maxsize
== TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp)))) == (signed)TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))
maxsize = -1; maxsize = -1;
/* ??? Due to negative offsets in ARRAY_REF we can end up with /* ??? Due to negative offsets in ARRAY_REF we can end up with
negative bit_offset here. We might want to store a zero offset negative bit_offset here. We might want to store a zero offset
in this case. */ in this case. */
*poffset = TREE_INT_CST_LOW (bit_offset); *poffset = bit_offset;
*psize = bitsize; *psize = bitsize;
*pmax_size = maxsize; *pmax_size = maxsize;
......
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